tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f59731777940f7851680b9a53f9d3273f9f52158
parent bf4c9a1fffda48c7516d6b729d07375410ecfa0d
Author: Ryan VanderMeulen <rvandermeulen@mozilla.com>
Date:   Tue,  7 Oct 2025 03:06:05 +0000

Bug 1987308 - Update FreeType to 2.14.1. r=jfkthame

Differential Revision: https://phabricator.services.mozilla.com/D264006

Diffstat:
Mmodules/freetype2/CMakeLists.txt | 90++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mmodules/freetype2/ChangeLog | 3076+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/freetype2/LICENSE.TXT | 7++++---
Mmodules/freetype2/MSBuild.rsp | 4+++-
Mmodules/freetype2/MSBuild.sln | 2+-
Mmodules/freetype2/Makefile | 2+-
Mmodules/freetype2/README | 20++++++++++----------
Mmodules/freetype2/README.git | 2+-
Mmodules/freetype2/README.moz-patches | 4++--
Mmodules/freetype2/autogen.sh | 6+++---
Mmodules/freetype2/builds/amiga/README | 2+-
Mmodules/freetype2/builds/amiga/include/config/ftconfig.h | 2+-
Mmodules/freetype2/builds/amiga/include/config/ftmodule.h | 2+-
Mmodules/freetype2/builds/amiga/makefile | 2+-
Mmodules/freetype2/builds/amiga/makefile.os4 | 2+-
Mmodules/freetype2/builds/amiga/smakefile | 2+-
Mmodules/freetype2/builds/amiga/src/base/ftdebug.c | 2+-
Mmodules/freetype2/builds/amiga/src/base/ftsystem.c | 2+-
Mmodules/freetype2/builds/ansi/ansi-def.mk | 2+-
Mmodules/freetype2/builds/ansi/ansi.mk | 2+-
Mmodules/freetype2/builds/beos/beos-def.mk | 2+-
Mmodules/freetype2/builds/beos/beos.mk | 2+-
Mmodules/freetype2/builds/beos/detect.mk | 2+-
Mmodules/freetype2/builds/cmake/FindBrotliDec.cmake | 2+-
Mmodules/freetype2/builds/cmake/FindHarfBuzz.cmake | 4++--
Mmodules/freetype2/builds/cmake/iOS.cmake | 2+-
Mmodules/freetype2/builds/cmake/testbuild.sh | 2+-
Mmodules/freetype2/builds/compiler/ansi-cc.mk | 2+-
Mmodules/freetype2/builds/compiler/bcc-dev.mk | 2+-
Mmodules/freetype2/builds/compiler/bcc.mk | 2+-
Mmodules/freetype2/builds/compiler/emx.mk | 2+-
Mmodules/freetype2/builds/compiler/gcc-dev.mk | 3++-
Mmodules/freetype2/builds/compiler/gcc.mk | 2+-
Mmodules/freetype2/builds/compiler/intelc.mk | 2+-
Mmodules/freetype2/builds/compiler/unix-lcc.mk | 2+-
Mmodules/freetype2/builds/compiler/visualage.mk | 2+-
Mmodules/freetype2/builds/compiler/visualc.mk | 2+-
Mmodules/freetype2/builds/compiler/watcom.mk | 2+-
Mmodules/freetype2/builds/compiler/win-lcc.mk | 2+-
Mmodules/freetype2/builds/detect.mk | 2+-
Mmodules/freetype2/builds/dos/detect.mk | 2+-
Mmodules/freetype2/builds/dos/dos-def.mk | 2+-
Mmodules/freetype2/builds/dos/dos-emx.mk | 2+-
Mmodules/freetype2/builds/dos/dos-gcc.mk | 2+-
Mmodules/freetype2/builds/dos/dos-wat.mk | 2+-
Mmodules/freetype2/builds/exports.mk | 2+-
Mmodules/freetype2/builds/freetype.mk | 2+-
Mmodules/freetype2/builds/link_dos.mk | 2+-
Mmodules/freetype2/builds/link_std.mk | 2+-
Mmodules/freetype2/builds/mac/ftmac.c | 2+-
Mmodules/freetype2/builds/meson/extract_freetype_version.py | 2+-
Mmodules/freetype2/builds/meson/extract_libtool_version.py | 2+-
Mmodules/freetype2/builds/meson/generate_reference_docs.py | 2+-
Mmodules/freetype2/builds/meson/parse_modules_cfg.py | 2+-
Mmodules/freetype2/builds/meson/process_ftoption_h.py | 2+-
Mmodules/freetype2/builds/modules.mk | 2+-
Mmodules/freetype2/builds/os2/detect.mk | 2+-
Mmodules/freetype2/builds/os2/os2-def.mk | 2+-
Mmodules/freetype2/builds/os2/os2-dev.mk | 2+-
Mmodules/freetype2/builds/os2/os2-gcc.mk | 2+-
Mmodules/freetype2/builds/symbian/bld.inf | 2+-
Mmodules/freetype2/builds/symbian/freetype.mmp | 2+-
Mmodules/freetype2/builds/toplevel.mk | 15+++++++++++----
Mmodules/freetype2/builds/unix/aclocal.m4 | 582++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
Mmodules/freetype2/builds/unix/config.guess | 17++++++++++-------
Mmodules/freetype2/builds/unix/config.sub | 28+++++++++++++++++++---------
Mmodules/freetype2/builds/unix/configure | 1662+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
Mmodules/freetype2/builds/unix/configure.ac | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
Mmodules/freetype2/builds/unix/configure.raw | 81++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
Mmodules/freetype2/builds/unix/detect.mk | 2+-
Mmodules/freetype2/builds/unix/freetype-config.in | 2+-
Mmodules/freetype2/builds/unix/freetype2.m4 | 2+-
Mmodules/freetype2/builds/unix/ft-munmap.m4 | 2+-
Mmodules/freetype2/builds/unix/ftconfig.h.in | 2+-
Mmodules/freetype2/builds/unix/ftsystem.c | 2+-
Mmodules/freetype2/builds/unix/install-sh | 14+++++++-------
Mmodules/freetype2/builds/unix/install.mk | 2+-
Mmodules/freetype2/builds/unix/ltmain.sh | 736++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mmodules/freetype2/builds/unix/unix-cc.in | 14+++++++++-----
Mmodules/freetype2/builds/unix/unix-def.in | 2+-
Mmodules/freetype2/builds/unix/unix-dev.mk | 2+-
Mmodules/freetype2/builds/unix/unix-lcc.mk | 2+-
Mmodules/freetype2/builds/unix/unix.mk | 2+-
Mmodules/freetype2/builds/unix/unixddef.mk | 2+-
Mmodules/freetype2/builds/vms/apinames_vms.bash | 2+-
Mmodules/freetype2/builds/vms/ftconfig.h | 2+-
Mmodules/freetype2/builds/vms/ftsystem.c | 2+-
Amodules/freetype2/builds/vms/patch_ftcalc.sed | 4++++
Mmodules/freetype2/builds/wince/ftdebug.c | 2+-
Mmodules/freetype2/builds/wince/vc2005-ce/freetype.sln | 2+-
Mmodules/freetype2/builds/wince/vc2005-ce/index.html | 2+-
Mmodules/freetype2/builds/wince/vc2008-ce/index.html | 2+-
Mmodules/freetype2/builds/windows/detect.mk | 2+-
Mmodules/freetype2/builds/windows/ftdebug.c | 4++--
Mmodules/freetype2/builds/windows/ftsystem.c | 4++--
Mmodules/freetype2/builds/windows/vc2010/index.html | 2+-
Mmodules/freetype2/builds/windows/visualc/index.html | 2+-
Mmodules/freetype2/builds/windows/visualce/index.html | 2+-
Mmodules/freetype2/builds/windows/w32-bcc.mk | 2+-
Mmodules/freetype2/builds/windows/w32-bccd.mk | 2+-
Mmodules/freetype2/builds/windows/w32-dev.mk | 2+-
Mmodules/freetype2/builds/windows/w32-gcc.mk | 2+-
Mmodules/freetype2/builds/windows/w32-icc.mk | 2+-
Mmodules/freetype2/builds/windows/w32-intl.mk | 2+-
Mmodules/freetype2/builds/windows/w32-lcc.mk | 2+-
Mmodules/freetype2/builds/windows/w32-mingw32.mk | 2+-
Mmodules/freetype2/builds/windows/w32-vcc.mk | 2+-
Mmodules/freetype2/builds/windows/w32-wat.mk | 2+-
Mmodules/freetype2/builds/windows/win32-def.mk | 2+-
Mmodules/freetype2/configure | 2+-
Mmodules/freetype2/devel/ft2build.h | 2+-
Mmodules/freetype2/devel/ftoption.h | 49+++++++++++++++++++++++++++++++++++++------------
Mmodules/freetype2/include/freetype/config/ftconfig.h | 2+-
Mmodules/freetype2/include/freetype/config/ftheader.h | 2+-
Mmodules/freetype2/include/freetype/config/ftoption.h | 49+++++++++++++++++++++++++++++++++++++------------
Mmodules/freetype2/include/freetype/config/ftstdlib.h | 2+-
Mmodules/freetype2/include/freetype/config/integer-types.h | 31+++++++++++++++++++++++++++++--
Mmodules/freetype2/include/freetype/config/mac-support.h | 2+-
Mmodules/freetype2/include/freetype/config/public-macros.h | 6+++---
Mmodules/freetype2/include/freetype/freetype.h | 98+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mmodules/freetype2/include/freetype/ftadvanc.h | 2+-
Mmodules/freetype2/include/freetype/ftbbox.h | 2+-
Mmodules/freetype2/include/freetype/ftbdf.h | 2+-
Mmodules/freetype2/include/freetype/ftbitmap.h | 2+-
Mmodules/freetype2/include/freetype/ftbzip2.h | 2+-
Mmodules/freetype2/include/freetype/ftcache.h | 2+-
Mmodules/freetype2/include/freetype/ftcid.h | 2+-
Mmodules/freetype2/include/freetype/ftcolor.h | 17+++++++++++++----
Mmodules/freetype2/include/freetype/ftdriver.h | 6+++---
Mmodules/freetype2/include/freetype/fterrdef.h | 2+-
Mmodules/freetype2/include/freetype/fterrors.h | 2+-
Mmodules/freetype2/include/freetype/ftfntfmt.h | 2+-
Mmodules/freetype2/include/freetype/ftgasp.h | 2+-
Mmodules/freetype2/include/freetype/ftglyph.h | 2+-
Mmodules/freetype2/include/freetype/ftgxval.h | 2+-
Mmodules/freetype2/include/freetype/ftgzip.h | 2+-
Mmodules/freetype2/include/freetype/ftimage.h | 8++++++--
Mmodules/freetype2/include/freetype/ftincrem.h | 2+-
Mmodules/freetype2/include/freetype/ftlcdfil.h | 2+-
Mmodules/freetype2/include/freetype/ftlist.h | 2+-
Mmodules/freetype2/include/freetype/ftlogging.h | 2+-
Mmodules/freetype2/include/freetype/ftlzw.h | 2+-
Mmodules/freetype2/include/freetype/ftmac.h | 2+-
Mmodules/freetype2/include/freetype/ftmm.h | 262++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
Mmodules/freetype2/include/freetype/ftmodapi.h | 2+-
Mmodules/freetype2/include/freetype/ftmoderr.h | 2+-
Mmodules/freetype2/include/freetype/ftotval.h | 2+-
Mmodules/freetype2/include/freetype/ftoutln.h | 2+-
Mmodules/freetype2/include/freetype/ftparams.h | 2+-
Mmodules/freetype2/include/freetype/ftpfr.h | 2+-
Mmodules/freetype2/include/freetype/ftrender.h | 2+-
Mmodules/freetype2/include/freetype/ftsizes.h | 2+-
Mmodules/freetype2/include/freetype/ftsnames.h | 2+-
Mmodules/freetype2/include/freetype/ftstroke.h | 2+-
Mmodules/freetype2/include/freetype/ftsynth.h | 2+-
Mmodules/freetype2/include/freetype/ftsystem.h | 2+-
Mmodules/freetype2/include/freetype/fttrigon.h | 2+-
Mmodules/freetype2/include/freetype/fttypes.h | 2+-
Mmodules/freetype2/include/freetype/ftwinfnt.h | 5++---
Mmodules/freetype2/include/freetype/internal/autohint.h | 2+-
Mmodules/freetype2/include/freetype/internal/cffotypes.h | 2+-
Mmodules/freetype2/include/freetype/internal/cfftypes.h | 2+-
Mmodules/freetype2/include/freetype/internal/compiler-macros.h | 6+++---
Mmodules/freetype2/include/freetype/internal/ftcalc.h | 296+++++++++++++++++++++++++------------------------------------------------------
Mmodules/freetype2/include/freetype/internal/ftdebug.h | 2+-
Mmodules/freetype2/include/freetype/internal/ftdrv.h | 2+-
Mmodules/freetype2/include/freetype/internal/ftgloadr.h | 2+-
Mmodules/freetype2/include/freetype/internal/fthash.h | 23+++++++++++++++++++++++
Mmodules/freetype2/include/freetype/internal/ftmemory.h | 2+-
Mmodules/freetype2/include/freetype/internal/ftmmtypes.h | 2+-
Mmodules/freetype2/include/freetype/internal/ftobjs.h | 30++++++++++++++++++++++++++----
Mmodules/freetype2/include/freetype/internal/ftpsprop.h | 2+-
Mmodules/freetype2/include/freetype/internal/ftrfork.h | 2+-
Mmodules/freetype2/include/freetype/internal/ftserv.h | 2+-
Mmodules/freetype2/include/freetype/internal/ftstream.h | 2+-
Mmodules/freetype2/include/freetype/internal/fttrace.h | 5+++--
Mmodules/freetype2/include/freetype/internal/ftvalid.h | 2+-
Mmodules/freetype2/include/freetype/internal/psaux.h | 2+-
Mmodules/freetype2/include/freetype/internal/pshints.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svbdf.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svcfftl.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svcid.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svfntfmt.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svgldict.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svgxval.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svkern.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svmetric.h | 4++--
Mmodules/freetype2/include/freetype/internal/services/svmm.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svotval.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svpfr.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svpostnm.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svprop.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svpscmap.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svpsinfo.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svsfnt.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svttcmap.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svtteng.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svttglyf.h | 2+-
Mmodules/freetype2/include/freetype/internal/services/svwinfnt.h | 2+-
Mmodules/freetype2/include/freetype/internal/sfnt.h | 8++++----
Mmodules/freetype2/include/freetype/internal/svginterface.h | 2+-
Mmodules/freetype2/include/freetype/internal/t1types.h | 2+-
Mmodules/freetype2/include/freetype/internal/tttypes.h | 41++++++++++++-----------------------------
Mmodules/freetype2/include/freetype/internal/wofftypes.h | 2+-
Mmodules/freetype2/include/freetype/otsvg.h | 2+-
Mmodules/freetype2/include/freetype/t1tables.h | 2+-
Mmodules/freetype2/include/freetype/ttnameid.h | 258++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mmodules/freetype2/include/freetype/tttables.h | 13++++++++-----
Mmodules/freetype2/include/freetype/tttags.h | 2+-
Mmodules/freetype2/include/ft2build.h | 2+-
Mmodules/freetype2/meson.build | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
Mmodules/freetype2/meson_options.txt | 10++++++++--
Mmodules/freetype2/modules.cfg | 2+-
Amodules/freetype2/src/autofit/afadjust.c | 1612+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/freetype2/src/autofit/afadjust.h | 130+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/freetype2/src/autofit/afblue.c | 194++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mmodules/freetype2/src/autofit/afblue.cin | 2+-
Mmodules/freetype2/src/autofit/afblue.dat | 194++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mmodules/freetype2/src/autofit/afblue.h | 11+++++++----
Mmodules/freetype2/src/autofit/afblue.hin | 11+++++++----
Mmodules/freetype2/src/autofit/afcjk.c | 49++++++++++++++++++-------------------------------
Mmodules/freetype2/src/autofit/afcjk.h | 2+-
Mmodules/freetype2/src/autofit/afcover.h | 2+-
Mmodules/freetype2/src/autofit/afdummy.c | 2+-
Mmodules/freetype2/src/autofit/afdummy.h | 2+-
Mmodules/freetype2/src/autofit/aferrors.h | 2+-
Mmodules/freetype2/src/autofit/afglobal.c | 40++++++++++++++++++++++++++++++++--------
Mmodules/freetype2/src/autofit/afglobal.h | 15+++++++++++----
Amodules/freetype2/src/autofit/afgsub.c | 693+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/freetype2/src/autofit/afgsub.h | 38++++++++++++++++++++++++++++++++++++++
Mmodules/freetype2/src/autofit/afhints.c | 23+++++++++++++++++++----
Mmodules/freetype2/src/autofit/afhints.h | 19++++++++++++++-----
Mmodules/freetype2/src/autofit/afindic.c | 2+-
Mmodules/freetype2/src/autofit/afindic.h | 2+-
Mmodules/freetype2/src/autofit/aflatin.c | 1915+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
Mmodules/freetype2/src/autofit/aflatin.h | 25+++++++++++++++++--------
Mmodules/freetype2/src/autofit/afloader.c | 2+-
Mmodules/freetype2/src/autofit/afloader.h | 2+-
Mmodules/freetype2/src/autofit/afmodule.c | 14++++++++++++--
Mmodules/freetype2/src/autofit/afmodule.h | 8+++++++-
Mmodules/freetype2/src/autofit/afranges.c | 63++++++++++++++++++++++++++++++++++++++++++++++-----------------
Mmodules/freetype2/src/autofit/afranges.h | 2+-
Mmodules/freetype2/src/autofit/afscript.h | 2+-
Mmodules/freetype2/src/autofit/afshaper.c | 340++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
Mmodules/freetype2/src/autofit/afshaper.h | 19++++++++-----------
Mmodules/freetype2/src/autofit/afstyles.h | 58+++++++++++++++++++++++++++++-----------------------------
Mmodules/freetype2/src/autofit/aftypes.h | 6+++++-
Mmodules/freetype2/src/autofit/afws-decl.h | 2+-
Mmodules/freetype2/src/autofit/afws-iter.h | 2+-
Mmodules/freetype2/src/autofit/autofit.c | 5++++-
Amodules/freetype2/src/autofit/ft-hb-decls.h | 203+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/freetype2/src/autofit/ft-hb-ft.c | 117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/freetype2/src/autofit/ft-hb-ft.h | 46++++++++++++++++++++++++++++++++++++++++++++++
Amodules/freetype2/src/autofit/ft-hb-types.h | 129+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/freetype2/src/autofit/ft-hb.c | 252++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mmodules/freetype2/src/autofit/ft-hb.h | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
Amodules/freetype2/src/autofit/hb-script-list.h | 484+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/freetype2/src/autofit/module.mk | 2+-
Mmodules/freetype2/src/autofit/rules.mk | 26+++++++++++++++-----------
Mmodules/freetype2/src/base/ftadvanc.c | 2+-
Mmodules/freetype2/src/base/ftbase.c | 4++--
Mmodules/freetype2/src/base/ftbase.h | 4++--
Mmodules/freetype2/src/base/ftbbox.c | 2+-
Mmodules/freetype2/src/base/ftbdf.c | 2+-
Mmodules/freetype2/src/base/ftbitmap.c | 12++++++------
Mmodules/freetype2/src/base/ftcalc.c | 146+++++++++++++++++++------------------------------------------------------------
Mmodules/freetype2/src/base/ftcid.c | 2+-
Mmodules/freetype2/src/base/ftcolor.c | 21+++++++++++----------
Mmodules/freetype2/src/base/ftdbgmem.c | 3+--
Mmodules/freetype2/src/base/ftdebug.c | 4++--
Mmodules/freetype2/src/base/fterrors.c | 2+-
Mmodules/freetype2/src/base/ftfntfmt.c | 2+-
Mmodules/freetype2/src/base/ftfstype.c | 2+-
Mmodules/freetype2/src/base/ftgasp.c | 2+-
Mmodules/freetype2/src/base/ftgloadr.c | 2+-
Mmodules/freetype2/src/base/ftglyph.c | 2+-
Mmodules/freetype2/src/base/ftgxval.c | 2+-
Mmodules/freetype2/src/base/fthash.c | 104++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Mmodules/freetype2/src/base/ftinit.c | 2+-
Mmodules/freetype2/src/base/ftlcdfil.c | 2+-
Mmodules/freetype2/src/base/ftmac.c | 2+-
Mmodules/freetype2/src/base/ftmm.c | 37++++++++++++++++++++++++++-----------
Mmodules/freetype2/src/base/ftobjs.c | 64+++++++++++++++++++++++++---------------------------------------
Mmodules/freetype2/src/base/ftotval.c | 2+-
Mmodules/freetype2/src/base/ftoutln.c | 2+-
Mmodules/freetype2/src/base/ftpatent.c | 2+-
Mmodules/freetype2/src/base/ftpfr.c | 2+-
Mmodules/freetype2/src/base/ftpsprop.c | 2+-
Mmodules/freetype2/src/base/ftrfork.c | 10++--------
Mmodules/freetype2/src/base/ftsnames.c | 2+-
Mmodules/freetype2/src/base/ftstream.c | 4++--
Mmodules/freetype2/src/base/ftstroke.c | 24++++++++++++++----------
Mmodules/freetype2/src/base/ftsynth.c | 4++--
Mmodules/freetype2/src/base/ftsystem.c | 4++--
Mmodules/freetype2/src/base/fttrigon.c | 2+-
Mmodules/freetype2/src/base/fttype1.c | 2+-
Mmodules/freetype2/src/base/ftutil.c | 2+-
Mmodules/freetype2/src/base/ftver.rc | 8++++----
Mmodules/freetype2/src/base/ftwinfnt.c | 2+-
Mmodules/freetype2/src/base/rules.mk | 2+-
Mmodules/freetype2/src/bdf/bdf.h | 45++++++++-------------------------------------
Mmodules/freetype2/src/bdf/bdfdrivr.c | 75+++++++++++++++++++++++++++++++++++++++++++++------------------------------
Mmodules/freetype2/src/bdf/bdflib.c | 1594+++++++++++++++++++++++++------------------------------------------------------
Mmodules/freetype2/src/bzip2/ftbzip2.c | 2+-
Mmodules/freetype2/src/bzip2/rules.mk | 2+-
Mmodules/freetype2/src/cache/ftcache.c | 2+-
Mmodules/freetype2/src/cache/ftcbasic.c | 2+-
Mmodules/freetype2/src/cache/ftccache.c | 2+-
Mmodules/freetype2/src/cache/ftccache.h | 2+-
Mmodules/freetype2/src/cache/ftccback.h | 2+-
Mmodules/freetype2/src/cache/ftccmap.c | 2+-
Mmodules/freetype2/src/cache/ftcerror.h | 2+-
Mmodules/freetype2/src/cache/ftcglyph.c | 2+-
Mmodules/freetype2/src/cache/ftcglyph.h | 2+-
Mmodules/freetype2/src/cache/ftcimage.c | 2+-
Mmodules/freetype2/src/cache/ftcimage.h | 2+-
Mmodules/freetype2/src/cache/ftcmanag.c | 2+-
Mmodules/freetype2/src/cache/ftcmanag.h | 2+-
Mmodules/freetype2/src/cache/ftcmru.c | 2+-
Mmodules/freetype2/src/cache/ftcmru.h | 2+-
Mmodules/freetype2/src/cache/ftcsbits.c | 2+-
Mmodules/freetype2/src/cache/ftcsbits.h | 2+-
Mmodules/freetype2/src/cache/rules.mk | 2+-
Mmodules/freetype2/src/cff/cff.c | 2+-
Mmodules/freetype2/src/cff/cffcmap.c | 2+-
Mmodules/freetype2/src/cff/cffcmap.h | 2+-
Mmodules/freetype2/src/cff/cffdrivr.c | 164++++++++++++++++++++++++++++++-------------------------------------------------
Mmodules/freetype2/src/cff/cffdrivr.h | 2+-
Mmodules/freetype2/src/cff/cfferrs.h | 2+-
Mmodules/freetype2/src/cff/cffgload.c | 70+++++++++++++++++++++++++++++-----------------------------------------
Mmodules/freetype2/src/cff/cffgload.h | 2+-
Mmodules/freetype2/src/cff/cffload.c | 16++++++++--------
Mmodules/freetype2/src/cff/cffload.h | 2+-
Mmodules/freetype2/src/cff/cffobjs.c | 16+++++++++-------
Mmodules/freetype2/src/cff/cffobjs.h | 2+-
Mmodules/freetype2/src/cff/cffparse.c | 10+++++-----
Mmodules/freetype2/src/cff/cffparse.h | 2+-
Mmodules/freetype2/src/cff/cfftoken.h | 2+-
Mmodules/freetype2/src/cff/module.mk | 2+-
Mmodules/freetype2/src/cff/rules.mk | 2+-
Mmodules/freetype2/src/cid/ciderrs.h | 2+-
Mmodules/freetype2/src/cid/cidgload.c | 46++++++++++++++++++++--------------------------
Mmodules/freetype2/src/cid/cidgload.h | 2+-
Mmodules/freetype2/src/cid/cidload.c | 2+-
Mmodules/freetype2/src/cid/cidload.h | 2+-
Mmodules/freetype2/src/cid/cidobjs.c | 2+-
Mmodules/freetype2/src/cid/cidobjs.h | 2+-
Mmodules/freetype2/src/cid/cidparse.c | 2+-
Mmodules/freetype2/src/cid/cidparse.h | 2+-
Mmodules/freetype2/src/cid/cidriver.c | 2+-
Mmodules/freetype2/src/cid/cidriver.h | 2+-
Mmodules/freetype2/src/cid/cidtoken.h | 2+-
Mmodules/freetype2/src/cid/module.mk | 2+-
Mmodules/freetype2/src/cid/rules.mk | 2+-
Mmodules/freetype2/src/cid/type1cid.c | 2+-
Mmodules/freetype2/src/dlg/dlgwrap.c | 2+-
Mmodules/freetype2/src/dlg/rules.mk | 2+-
Mmodules/freetype2/src/gxvalid/README | 2+-
Mmodules/freetype2/src/gxvalid/gxvalid.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvalid.h | 2+-
Mmodules/freetype2/src/gxvalid/gxvbsln.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvcommn.c | 4++--
Mmodules/freetype2/src/gxvalid/gxvcommn.h | 2+-
Mmodules/freetype2/src/gxvalid/gxverror.h | 2+-
Mmodules/freetype2/src/gxvalid/gxvfeat.c | 4++--
Mmodules/freetype2/src/gxvalid/gxvfeat.h | 2+-
Mmodules/freetype2/src/gxvalid/gxvfgen.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvjust.c | 4++--
Mmodules/freetype2/src/gxvalid/gxvkern.c | 4++--
Mmodules/freetype2/src/gxvalid/gxvlcar.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmod.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmod.h | 2+-
Mmodules/freetype2/src/gxvalid/gxvmort.c | 4++--
Mmodules/freetype2/src/gxvalid/gxvmort.h | 2+-
Mmodules/freetype2/src/gxvalid/gxvmort0.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmort1.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmort2.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmort4.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmort5.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmorx.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmorx.h | 2+-
Mmodules/freetype2/src/gxvalid/gxvmorx0.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmorx1.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmorx2.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmorx4.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvmorx5.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvopbd.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvprop.c | 2+-
Mmodules/freetype2/src/gxvalid/gxvtrak.c | 4++--
Mmodules/freetype2/src/gxvalid/module.mk | 2+-
Mmodules/freetype2/src/gxvalid/rules.mk | 2+-
Mmodules/freetype2/src/gzip/ftgzip.c | 2+-
Mmodules/freetype2/src/gzip/ftzconf.h | 10+---------
Mmodules/freetype2/src/gzip/gzguts.h | 8++------
Mmodules/freetype2/src/gzip/inflate.c | 2+-
Mmodules/freetype2/src/gzip/inftrees.c | 6+++---
Mmodules/freetype2/src/gzip/inftrees.h | 4++--
Mmodules/freetype2/src/gzip/patches/freetype-zlib.diff | 24++++++++++++------------
Mmodules/freetype2/src/gzip/rules.mk | 2+-
Mmodules/freetype2/src/gzip/zlib.h | 22+++++++++++-----------
Mmodules/freetype2/src/gzip/zutil.h | 27+++------------------------
Mmodules/freetype2/src/lzw/ftlzw.c | 2+-
Mmodules/freetype2/src/lzw/ftzopen.c | 2+-
Mmodules/freetype2/src/lzw/ftzopen.h | 2+-
Mmodules/freetype2/src/lzw/rules.mk | 2+-
Mmodules/freetype2/src/otvalid/module.mk | 2+-
Mmodules/freetype2/src/otvalid/otvalid.c | 2+-
Mmodules/freetype2/src/otvalid/otvalid.h | 2+-
Mmodules/freetype2/src/otvalid/otvbase.c | 14+++++++-------
Mmodules/freetype2/src/otvalid/otvcommn.c | 66+++++++++++++++++++++++++++++++++---------------------------------
Mmodules/freetype2/src/otvalid/otvcommn.h | 2+-
Mmodules/freetype2/src/otvalid/otverror.h | 2+-
Mmodules/freetype2/src/otvalid/otvgdef.c | 8++++----
Mmodules/freetype2/src/otvalid/otvgpos.c | 38+++++++++++++++++++-------------------
Mmodules/freetype2/src/otvalid/otvgpos.h | 2+-
Mmodules/freetype2/src/otvalid/otvgsub.c | 28++++++++++++++--------------
Mmodules/freetype2/src/otvalid/otvjstf.c | 6+++---
Mmodules/freetype2/src/otvalid/otvmath.c | 2+-
Mmodules/freetype2/src/otvalid/otvmod.c | 2+-
Mmodules/freetype2/src/otvalid/otvmod.h | 2+-
Mmodules/freetype2/src/otvalid/rules.mk | 2+-
Mmodules/freetype2/src/pcf/pcfdrivr.c | 2+-
Mmodules/freetype2/src/pcf/pcfread.c | 20++++++++++----------
Mmodules/freetype2/src/pfr/module.mk | 2+-
Mmodules/freetype2/src/pfr/pfr.c | 2+-
Mmodules/freetype2/src/pfr/pfrcmap.c | 2+-
Mmodules/freetype2/src/pfr/pfrcmap.h | 2+-
Mmodules/freetype2/src/pfr/pfrdrivr.c | 2+-
Mmodules/freetype2/src/pfr/pfrdrivr.h | 2+-
Mmodules/freetype2/src/pfr/pfrerror.h | 2+-
Mmodules/freetype2/src/pfr/pfrgload.c | 16++++++++--------
Mmodules/freetype2/src/pfr/pfrgload.h | 2+-
Mmodules/freetype2/src/pfr/pfrload.c | 2+-
Mmodules/freetype2/src/pfr/pfrload.h | 2+-
Mmodules/freetype2/src/pfr/pfrobjs.c | 16++++++----------
Mmodules/freetype2/src/pfr/pfrobjs.h | 2+-
Mmodules/freetype2/src/pfr/pfrsbit.c | 2+-
Mmodules/freetype2/src/pfr/pfrsbit.h | 2+-
Mmodules/freetype2/src/pfr/pfrtypes.h | 2+-
Mmodules/freetype2/src/pfr/rules.mk | 2+-
Mmodules/freetype2/src/psaux/afmparse.c | 2+-
Mmodules/freetype2/src/psaux/afmparse.h | 2+-
Mmodules/freetype2/src/psaux/cffdecode.c | 6+++---
Mmodules/freetype2/src/psaux/cffdecode.h | 2+-
Mmodules/freetype2/src/psaux/module.mk | 2+-
Mmodules/freetype2/src/psaux/psaux.c | 2+-
Mmodules/freetype2/src/psaux/psauxerr.h | 2+-
Mmodules/freetype2/src/psaux/psauxmod.c | 2+-
Mmodules/freetype2/src/psaux/psauxmod.h | 5+----
Mmodules/freetype2/src/psaux/psconv.c | 2+-
Mmodules/freetype2/src/psaux/psconv.h | 2+-
Mmodules/freetype2/src/psaux/psintrp.c | 2+-
Mmodules/freetype2/src/psaux/psobjs.c | 9++++++---
Mmodules/freetype2/src/psaux/psobjs.h | 2+-
Mmodules/freetype2/src/psaux/rules.mk | 2+-
Mmodules/freetype2/src/psaux/t1cmap.c | 2+-
Mmodules/freetype2/src/psaux/t1cmap.h | 2+-
Mmodules/freetype2/src/psaux/t1decode.c | 4++--
Mmodules/freetype2/src/psaux/t1decode.h | 2+-
Mmodules/freetype2/src/pshinter/module.mk | 2+-
Mmodules/freetype2/src/pshinter/pshalgo.c | 4++--
Mmodules/freetype2/src/pshinter/pshalgo.h | 2+-
Mmodules/freetype2/src/pshinter/pshglob.c | 2+-
Mmodules/freetype2/src/pshinter/pshglob.h | 2+-
Mmodules/freetype2/src/pshinter/pshinter.c | 2+-
Mmodules/freetype2/src/pshinter/pshmod.c | 2+-
Mmodules/freetype2/src/pshinter/pshmod.h | 2+-
Mmodules/freetype2/src/pshinter/pshnterr.h | 2+-
Mmodules/freetype2/src/pshinter/pshrec.c | 12++++++------
Mmodules/freetype2/src/pshinter/pshrec.h | 2+-
Mmodules/freetype2/src/pshinter/rules.mk | 2+-
Mmodules/freetype2/src/psnames/module.mk | 2+-
Mmodules/freetype2/src/psnames/psmodule.c | 2+-
Mmodules/freetype2/src/psnames/psmodule.h | 2+-
Mmodules/freetype2/src/psnames/psnamerr.h | 2+-
Mmodules/freetype2/src/psnames/psnames.c | 2+-
Mmodules/freetype2/src/psnames/pstables.h | 2+-
Mmodules/freetype2/src/psnames/rules.mk | 2+-
Mmodules/freetype2/src/raster/ftmisc.h | 2+-
Mmodules/freetype2/src/raster/ftraster.c | 18+++++++++++-------
Mmodules/freetype2/src/raster/ftraster.h | 2+-
Mmodules/freetype2/src/raster/ftrend1.c | 2+-
Mmodules/freetype2/src/raster/ftrend1.h | 2+-
Mmodules/freetype2/src/raster/module.mk | 2+-
Mmodules/freetype2/src/raster/raster.c | 2+-
Mmodules/freetype2/src/raster/rasterrs.h | 2+-
Mmodules/freetype2/src/raster/rules.mk | 2+-
Mmodules/freetype2/src/sdf/ftbsdf.c | 18+++++++++++++++---
Mmodules/freetype2/src/sdf/ftsdf.c | 18+++++++++---------
Mmodules/freetype2/src/sdf/ftsdf.h | 4++--
Mmodules/freetype2/src/sdf/ftsdfcommon.c | 2+-
Mmodules/freetype2/src/sdf/ftsdfcommon.h | 2+-
Mmodules/freetype2/src/sdf/ftsdferrs.h | 2+-
Mmodules/freetype2/src/sdf/ftsdfrend.c | 2+-
Mmodules/freetype2/src/sdf/ftsdfrend.h | 2+-
Mmodules/freetype2/src/sdf/module.mk | 2+-
Mmodules/freetype2/src/sdf/rules.mk | 2+-
Mmodules/freetype2/src/sdf/sdf.c | 2+-
Mmodules/freetype2/src/sfnt/module.mk | 2+-
Mmodules/freetype2/src/sfnt/pngshim.c | 2+-
Mmodules/freetype2/src/sfnt/pngshim.h | 2+-
Mmodules/freetype2/src/sfnt/rules.mk | 2+-
Mmodules/freetype2/src/sfnt/sfdriver.c | 4++--
Mmodules/freetype2/src/sfnt/sfdriver.h | 2+-
Mmodules/freetype2/src/sfnt/sferrors.h | 2+-
Mmodules/freetype2/src/sfnt/sfnt.c | 2+-
Mmodules/freetype2/src/sfnt/sfobjs.c | 9++++++---
Mmodules/freetype2/src/sfnt/sfobjs.h | 2+-
Mmodules/freetype2/src/sfnt/sfwoff.c | 2+-
Mmodules/freetype2/src/sfnt/sfwoff.h | 2+-
Mmodules/freetype2/src/sfnt/sfwoff2.c | 8++++----
Mmodules/freetype2/src/sfnt/sfwoff2.h | 2+-
Mmodules/freetype2/src/sfnt/ttbdf.c | 2+-
Mmodules/freetype2/src/sfnt/ttbdf.h | 2+-
Mmodules/freetype2/src/sfnt/ttcmap.c | 22+++++++++++-----------
Mmodules/freetype2/src/sfnt/ttcmap.h | 2+-
Mmodules/freetype2/src/sfnt/ttcmapc.h | 2+-
Mmodules/freetype2/src/sfnt/ttcolr.c | 4++--
Mmodules/freetype2/src/sfnt/ttcolr.h | 2+-
Mmodules/freetype2/src/sfnt/ttcpal.c | 2+-
Mmodules/freetype2/src/sfnt/ttcpal.h | 2+-
Mmodules/freetype2/src/sfnt/ttgpos.c | 1148+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Mmodules/freetype2/src/sfnt/ttgpos.h | 13++++++-------
Mmodules/freetype2/src/sfnt/ttkern.c | 5++---
Mmodules/freetype2/src/sfnt/ttkern.h | 8+++-----
Mmodules/freetype2/src/sfnt/ttload.c | 32++++++++++++++++++++++++++------
Mmodules/freetype2/src/sfnt/ttload.h | 2+-
Mmodules/freetype2/src/sfnt/ttmtx.c | 4++--
Mmodules/freetype2/src/sfnt/ttmtx.h | 2+-
Mmodules/freetype2/src/sfnt/ttpost.c | 2+-
Mmodules/freetype2/src/sfnt/ttpost.h | 2+-
Mmodules/freetype2/src/sfnt/ttsbit.c | 55++++++++++++++++++++++++++++++++++++++++++++++---------
Mmodules/freetype2/src/sfnt/ttsbit.h | 2+-
Mmodules/freetype2/src/sfnt/ttsvg.c | 14++++++++++++--
Mmodules/freetype2/src/sfnt/ttsvg.h | 2+-
Mmodules/freetype2/src/sfnt/woff2tags.c | 2+-
Mmodules/freetype2/src/sfnt/woff2tags.h | 2+-
Mmodules/freetype2/src/smooth/ftgrays.c | 84++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mmodules/freetype2/src/smooth/ftgrays.h | 13+++----------
Mmodules/freetype2/src/smooth/ftsmerrs.h | 2+-
Mmodules/freetype2/src/smooth/ftsmooth.c | 2+-
Mmodules/freetype2/src/smooth/ftsmooth.h | 2+-
Mmodules/freetype2/src/smooth/module.mk | 2+-
Mmodules/freetype2/src/smooth/rules.mk | 2+-
Mmodules/freetype2/src/smooth/smooth.c | 2+-
Mmodules/freetype2/src/svg/ftsvg.c | 2+-
Mmodules/freetype2/src/svg/ftsvg.h | 2+-
Mmodules/freetype2/src/svg/module.mk | 2+-
Mmodules/freetype2/src/svg/rules.mk | 2+-
Mmodules/freetype2/src/svg/svg.c | 2+-
Mmodules/freetype2/src/svg/svgtypes.h | 2+-
Mmodules/freetype2/src/tools/afblue.pl | 2+-
Mmodules/freetype2/src/tools/apinames.c | 37+++++++++++++++++++++++++------------
Mmodules/freetype2/src/tools/glnames.py | 2+-
Mmodules/freetype2/src/tools/update-copyright-year | 2+-
Mmodules/freetype2/src/truetype/module.mk | 2+-
Mmodules/freetype2/src/truetype/rules.mk | 2+-
Mmodules/freetype2/src/truetype/truetype.c | 2+-
Mmodules/freetype2/src/truetype/ttdriver.c | 6+++---
Mmodules/freetype2/src/truetype/ttdriver.h | 2+-
Mmodules/freetype2/src/truetype/tterrors.h | 2+-
Mmodules/freetype2/src/truetype/ttgload.c | 407++++++++++++++++++++++++++++++-------------------------------------------------
Mmodules/freetype2/src/truetype/ttgload.h | 2+-
Mmodules/freetype2/src/truetype/ttgxvar.c | 702+++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
Mmodules/freetype2/src/truetype/ttgxvar.h | 7++++++-
Mmodules/freetype2/src/truetype/ttinterp.c | 1575++++++++++++++++++++++++++++++++++---------------------------------------------
Mmodules/freetype2/src/truetype/ttinterp.h | 132++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
Mmodules/freetype2/src/truetype/ttobjs.c | 436++++++++++++++++++++++++-------------------------------------------------------
Mmodules/freetype2/src/truetype/ttobjs.h | 127++++++++++++-------------------------------------------------------------------
Mmodules/freetype2/src/truetype/ttpload.c | 18+++++++++---------
Mmodules/freetype2/src/truetype/ttpload.h | 2+-
Mmodules/freetype2/src/type1/module.mk | 2+-
Mmodules/freetype2/src/type1/rules.mk | 2+-
Mmodules/freetype2/src/type1/t1afm.c | 2+-
Mmodules/freetype2/src/type1/t1afm.h | 2+-
Mmodules/freetype2/src/type1/t1driver.c | 2+-
Mmodules/freetype2/src/type1/t1driver.h | 2+-
Mmodules/freetype2/src/type1/t1errors.h | 2+-
Mmodules/freetype2/src/type1/t1gload.c | 44+++++++++++++++++++++++---------------------
Mmodules/freetype2/src/type1/t1gload.h | 2+-
Mmodules/freetype2/src/type1/t1load.c | 8++++----
Mmodules/freetype2/src/type1/t1load.h | 2+-
Mmodules/freetype2/src/type1/t1objs.c | 2+-
Mmodules/freetype2/src/type1/t1objs.h | 2+-
Mmodules/freetype2/src/type1/t1parse.c | 2+-
Mmodules/freetype2/src/type1/t1parse.h | 2+-
Mmodules/freetype2/src/type1/t1tokens.h | 2+-
Mmodules/freetype2/src/type1/type1.c | 2+-
Mmodules/freetype2/src/type42/module.mk | 2+-
Mmodules/freetype2/src/type42/rules.mk | 2+-
Mmodules/freetype2/src/type42/t42drivr.c | 2+-
Mmodules/freetype2/src/type42/t42drivr.h | 2+-
Mmodules/freetype2/src/type42/t42error.h | 2+-
Mmodules/freetype2/src/type42/t42objs.c | 9+++++----
Mmodules/freetype2/src/type42/t42objs.h | 2+-
Mmodules/freetype2/src/type42/t42parse.c | 6+++---
Mmodules/freetype2/src/type42/t42parse.h | 2+-
Mmodules/freetype2/src/type42/t42types.h | 2+-
Mmodules/freetype2/src/type42/type42.c | 2+-
Mmodules/freetype2/src/winfonts/fnterrs.h | 2+-
Mmodules/freetype2/src/winfonts/module.mk | 2+-
Mmodules/freetype2/src/winfonts/rules.mk | 2+-
Mmodules/freetype2/src/winfonts/winfnt.c | 4++--
Mmodules/freetype2/src/winfonts/winfnt.h | 2+-
Mmodules/freetype2/subprojects/harfbuzz.wrap | 16+++++++---------
Mmodules/freetype2/subprojects/libpng.wrap | 18+++++++++---------
Mmodules/freetype2/subprojects/zlib.wrap | 10+++++-----
Mmodules/freetype2/vms_make.com | 543+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
608 files changed, 16625 insertions(+), 7297 deletions(-)

diff --git a/modules/freetype2/CMakeLists.txt b/modules/freetype2/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright (C) 2013-2024 by +# Copyright (C) 2013-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written originally by John Cary <cary@txcorp.com> @@ -87,6 +87,11 @@ # -D FT_REQUIRE_HARFBUZZ=TRUE \ # -D FT_REQUIRE_BROTLI=TRUE [...] # +# - Set the `FT_DYNAMIC_HARFBUZZ' CMake variable to `ON' or `TRUE' to load +# the HarfBuzz library dynamically at runtime, if possible. Example: +# +# cmake -B build -D FT_DYNAMIC_HARFBUZZ=TRUE [...] +# # - Set `FT_DISABLE_XXX=TRUE' to disable a dependency completely (where # `XXX' is a CMake package name like `BZip2'). Example for disabling all # dependencies: @@ -108,18 +113,8 @@ # (this is compatible with the same CMake variables in zlib's CMake # support). -# To minimize the number of cmake_policy() workarounds, -# CMake >= 3 is requested. -cmake_minimum_required(VERSION 3.0...3.5) - -if (NOT CMAKE_VERSION VERSION_LESS 3.3) - # Allow symbol visibility settings also on static libraries. CMake < 3.3 - # only sets the property on a shared library build. - cmake_policy(SET CMP0063 NEW) - - # Support new IN_LIST if() operator. - cmake_policy(SET CMP0057 NEW) -endif () +# CMake 3.12 provides for IMPORTED targets for common libraries like zlib, libpng and bzip2 +cmake_minimum_required(VERSION 3.12...3.31.0) include(CheckIncludeFile) include(CMakeDependentOption) @@ -163,8 +158,8 @@ endif () project(freetype C) set(VERSION_MAJOR "2") -set(VERSION_MINOR "13") -set(VERSION_PATCH "3") +set(VERSION_MINOR "14") +set(VERSION_PATCH "1") # Generate LIBRARY_VERSION and LIBRARY_SOVERSION. set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'") @@ -207,6 +202,9 @@ cmake_dependent_option(FT_REQUIRE_PNG option(FT_DISABLE_HARFBUZZ "Disable HarfBuzz (used for improving auto-hinting of OpenType fonts)." OFF) +cmake_dependent_option(FT_DYNAMIC_HARFBUZZ + "Load HarfBuzz library dynamically at runtime, if possible." ON + "NOT FT_DISABLE_HARFBUZZ" OFF) cmake_dependent_option(FT_REQUIRE_HARFBUZZ "Require HarfBuzz for improving auto-hinting of OpenType fonts." OFF "NOT FT_DISABLE_HARFBUZZ" OFF) @@ -249,10 +247,36 @@ endif () # Find dependencies include(FindPkgConfig) +include(CMakePushCheckState) +include(CheckSymbolExists) if (NOT FT_DISABLE_HARFBUZZ) set(HARFBUZZ_MIN_VERSION "2.0.0") - if (FT_REQUIRE_HARFBUZZ) + + if (FT_DYNAMIC_HARFBUZZ) + if (WIN32) # Windows uses its own LoadLibrary() + set(FT_DYNAMIC_HARFBUZZ_ENABLED TRUE) + else() + cmake_push_check_state(RESET) + check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN_IN_LIBC) + if (NOT HAVE_DLOPEN_IN_LIBC) + set(CMAKE_REQUIRED_LIBRARIES dl) + check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN_IN_LIBDL) + endif() + cmake_pop_check_state() + + if (HAVE_DLOPEN_IN_LIBC OR HAVE_DLOPEN_IN_LIBDL) + set(FT_DYNAMIC_HARFBUZZ_ENABLED TRUE) + if (HAVE_DLOPEN_IN_LIBDL) + set(FT_NEED_LIBDL TRUE) + endif() + endif() + endif() + endif() + + if (FT_DYNAMIC_HARFBUZZ_ENABLED) + message(STATUS "Enabled dynamic loading of HarfBuzz library at runtime.") + elseif (FT_REQUIRE_HARFBUZZ) find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED) else () find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION}) @@ -349,10 +373,15 @@ if (PNG_FOUND) "/\\* +(#define +FT_CONFIG_OPTION_USE_PNG) +\\*/" "\\1" FTOPTION_H "${FTOPTION_H}") endif () -if (HARFBUZZ_FOUND) +if (HARFBUZZ_FOUND OR FT_DYNAMIC_HARFBUZZ_ENABLED) string(REGEX REPLACE "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1" FTOPTION_H "${FTOPTION_H}") + if (FT_DYNAMIC_HARFBUZZ_ENABLED) + string(REGEX REPLACE + "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC) +\\*/" "\\1" + FTOPTION_H "${FTOPTION_H}") + endif () endif () if (BROTLIDEC_FOUND) string(REGEX REPLACE @@ -460,10 +489,6 @@ add_library(freetype ${BASE_SRCS} ) -set_target_properties( - freetype PROPERTIES - C_VISIBILITY_PRESET hidden) - target_compile_definitions( freetype PRIVATE FT2_BUILD_LIBRARY) @@ -474,6 +499,10 @@ if (WIN32) target_compile_definitions( freetype PRIVATE DLL_EXPORT) endif () +else () + # Windows handles exports with DLL_EXPORT defined above. + set_target_properties(freetype PROPERTIES + C_VISIBILITY_PRESET hidden) endif () if (BUILD_SHARED_LIBS) @@ -524,13 +553,11 @@ set(PKGCONFIG_LIBS "-L\${libdir} -lfreetype") set(PKGCONFIG_LIBS_PRIVATE "") if (ZLIB_FOUND) - target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES}) - target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ZLIB::ZLIB) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "zlib") endif () if (BZIP2_FOUND) - target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES}) - target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS + target_link_libraries(freetype PRIVATE BZip2::BZip2) if (PC_BZIP2_FOUND) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "bzip2") else () @@ -538,14 +565,15 @@ if (BZIP2_FOUND) endif () endif () if (PNG_FOUND) - target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES}) - target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS}) - target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE PNG::PNG) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libpng") endif () -if (HarfBuzz_FOUND) - target_link_libraries(freetype PRIVATE ${HarfBuzz_LIBRARY}) - target_include_directories(freetype PRIVATE ${HarfBuzz_INCLUDE_DIRS}) +if (FT_DYNAMIC_HARFBUZZ_ENABLED AND FT_NEED_LIBDL) + target_link_libraries(freetype PRIVATE dl) + list(APPEND PKGCONFIG_LIBS_PRIVATE " -ldl") +endif () +if (HarfBuzz_FOUND AND (NOT FT_DYNAMIC_HARFBUZZ_ENABLED)) + target_link_libraries(freetype PRIVATE HarfBuzz::HarfBuzz) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}") endif () if (BROTLIDEC_FOUND) diff --git a/modules/freetype2/ChangeLog b/modules/freetype2/ChangeLog @@ -1,3 +1,3079 @@ +2025-09-11 Werner Lemberg <wl@gnu.org> + + * Version 2.14.1 released. + ========================== + + Tag sources with `VER-2-14-1'. + + * docs/VERSION.TXT: Add entry for version 2.14.1. + * docs/CHANGES: Updated. + * docs/release, docs/README, builds/macs/README: Updated. + + * README, src/base/ftver.rc, builds/windows/vc2010/index.html, + builds/windows/visualc/index.html, builds/windows/visualce/index.html, + builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html, + docs/freetype-config.1: s/2.14.0/2.14.1/, s/2140/2141/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 26:4:20. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + +2025-09-10 Behdad Esfahbod <behdad@behdad.org> + + [base] Fix return values of two Font Variation functions. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_Var_Blend_Coordinates): Do it. + + Fixes issue #1355. + +2025-09-10 Werner Lemberg <wl@gnu.org> + + * src/autofit/afgsub.c (af_map_lookup): Fix handling of lookup type 7. + + Fixes issue #1356. + +2025-09-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (TT_Run_Context): Fix IUP tracking bits. + + Correctly fixes #1353 and #1349. + +2025-09-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + Typo! + +2025-09-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (TT_Run_Context): Reset IUP tracking bits. + + Fixes #1353. + +2025-09-08 Behdad Esfahbod <behdad@behdad.org> + + [autofit] Fix HarfBuzz calling. + + * src/autofit/afadjust.c (af_reverse_character_map_new) + [FT_CONFIG_OPTION_USE_HARFBUZZ]: Use `ft_hb_enabled`. + + Fixes issue #1354. + +2025-09-08 Werner Lemberg <wl@gnu.org> + + * docs/release: Use `sshpass` for SourceForge.net password. + +2025-09-08 Werner Lemberg <wl@gnu.org> + + * docs/release: Fix `scp` usage with OpenSSH version >= 9.0. + + Starting with this version, OpenSSH uses `scp` with the SFTP protocol as the + default. However, SFTP is disabled on savannah.gnu.org since January 2025. + +2025-09-06 Werner Lemberg <wl@gnu.org> + + * Version 2.14.0 released. + ========================== + + Tag sources with `VER-2-14-0'. + + * docs/VERSION.TXT: Add entry for version 2.14.0. + * docs/CHANGES: Updated. + * docs/release, docs/README, builds/macs/README: Updated. + + * README, src/base/ftver.rc, builds/windows/vc2010/index.html, + builds/windows/visualc/index.html, builds/windows/visualce/index.html, + builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html, + docs/freetype-config.1: s/2.13.3/2.14.0/, s/2133/2140/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 14. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 26:3:20. + * CMakeLists.txt (VERSION_MINOR): Set to 14. + (VERSION_PATCH): Set to 0. + +2025-09-06 Werner Lemberg <wl@gnu.org> + + * builds/toplevel.mk (do-dist): Download shallow clone of `config.git`. + + No need for any other commit than the current one. + +2025-09-06 Werner Lemberg <wl@gnu.org> + + Update all copyright notices. + +2025-09-05 Werner Lemberg <wl@gnu.org> + + src/sfnt/ttload.c (tt_face_load_any): Correctly handle font containers. + + Reported as + + https://issues.oss-fuzz.com/issues/424613326 + +2025-09-05 Jouk Jansen <joukj@hrem.nano.tudelft.nl> + + Clean up OpenVMS support. + + This avoids cluttering the source code with VMS-specific changes. + + * include/freetype/internal/ftcalc.h [__VMS], src/base/ftcalc.c + [vms_auto64_source]: Remove. + + * builds/vms/patch_ftcalc.sed: New file. + + * vms_make.com: Change macro definitions while this script is running; we + use `GNU sed` to inject the necessary preprocessor code on the fly. + +2025-09-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/psaux/psauxmod.h (psaux_driver_class): Removed declaration. + +2025-08-29 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Use const FT_Module_Class. + + This is intended to warn against modifying any fields in the class, + at compile-time and avoid crashes at run-time. + + * include/freetype/internal/ftobjs.h (FT_ModuleRec): Do it. + * src/base/ftobjs.c (Destroy_Module, FT_Add_Module): Updated. + +2025-08-27 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftobjs.c (FT_Load_Glyph): Reduces scope of 'ttface'. + +2025-08-25 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c: Fix some builds. + +2025-08-23 Werner Lemberg <wl@gnu.org> + + * subprojects/*.wrap: Updated. + +2025-08-23 Werner Lemberg <wl@gnu.org> + + Updating `CHANGES` file; minor fixes elsewhere (mostly formatting). + +2025-08-20 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Fix compilation without bytecode. + + Fixes #1351 and various warnings about unused variables. + + * src/truetype/ttinterp.c: Put the entire body under #ifdef. + * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Relocate + some declarations. + * src/truetype/ttinterp.h: Remove some #ifdef conditions. + * src/truetype/ttobjs.c (tt_size_done): Modified. + +2025-08-14 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Small fix in the incremental interface (again). + + Fixes #1299, last [-Wdangling-pointer=] warning. + + * src/truetype/ttgload.c (load_truetype_glyph): Restore original stream + on exit unconditionally. + +2025-08-14 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Small fix in the incremental interface. + + Fixes #1299, last [-Wdangling-pointer=] warning. + + * src/truetype/ttgload.c (load_truetype_glyph): Restore original stream + on exit. + +2025-08-14 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/autofit/afgsub.c: Fix a warning. + + Fixes [-Wunused-function] warning without HarfBuzz. + +2025-08-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + * */ftoption.h: Update C99 wording. + +2025-08-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + * */ftoption.h: Note C99 compliance. + +2025-08-08 Behdad Esfahbod <behdad@behdad.org> + + [ttgxvar] Fix caching of scalars when there are intermediate tuples. + + For example, with `GoogleSansFlex-Regular.ttf` at ROND=100, the 'Q' glyph + was misrendering. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reset `tupleScalars` + earlier. + +2025-08-05 Jouk Jansen <joukj@hrem.nano.tudelft.nl> + + Improvements to OpenVMS support. + + * include/freetype/internal/ftcalc.h [__VMS]: Undefine `FT_MulFix`. + + * src/base/ftcalc.c [vms_auto64_source]: Define `FT_MulFix`. + + * vms_make.com: Also create 32bit version of the FreeType library. + +2025-08-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + * docs/CHANGES: Mention 'ftmulti' improvements. + +2025-08-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + [type1/MM] Correctly reset the default instance. + + Call T1_Set_MM_WeightVector, which actually sets default weights, + instead of TT_Set_MM_Blend, which just centers the axes. + + * src/type1/t1load.c (T1_Reset_MM_Blend): Do it. + +2025-08-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype/v40] Fix ROUND_XY_TO_GRID handling. + + Fixes #1346. + + * src/truetype/ttgload.c (TT_Process_Composite_Component): Round + the x-position unless in backward_compatibility mode. + +2025-07-30 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (Ins_MDRP,MIRP): Small tweak. + +2025-07-30 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Tweak size management. + + * include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func): + Update typedef, do not return error. + * src/truetype/ttobjs.c (tt_size_reset_height): Move the PPem error + handling from here... + (tt_size_reset): ... to here to improve readability. + src/truetype/ttobjs.h (tt_size_reset_height): Update prototype. + +2025-07-30 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Relocate color compensation (cont'd). + + * src/truetype/ttinterp.c (Inc_MDAR,MIAP,MDRP,MIRP): Fix forgotten + rounding. + +2025-07-29 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Fix EVEN and ODD instructions. + + It is possible to have a fractional part after rounding when rounding + to half-grid or super-rounding. The specs call to ignore the fractional + part in that case. + + ^ src/truetype/ttinterp.c (Ins_EVEN, Ins_ODD): Fix mask. + +2025-07-28 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c: Fix comments. + +2025-07-28 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.h (TT_Round_Func): Fix argument. + + Fixes #1347: function type mismatch. + +2025-07-27 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Clean up size validation. + + Rely on non-zero ppem to validate the size object. + + * src/truetype/ttobjs.h (TT_Size_Merics): Remove the `valid` flag. + * src/truetype/ttobjs.c (tt_size_init,done,reset,reset_height): Updated. + * src/truetype/ttgload.c (TT_Load_Glyph): Check for non-zero ppem. + +2025-07-27 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Relocate color compensation. + + The rounding color compensation, which is not used by FreeType, belongs + to GS. This is a more logical place for it, next to round_state. + + * src/truetype/ttobjs.h (TT_GraphicsState): Move compensations here... + (TT_Size_Metrics): ... from here. + * src/truetype/ttobjs.c (tt_size_init_bytecode): Updated. + * src/truetype/ttinterp.c (tt_default_graphics_state): Updated. + (Ins_ROUND,NROUND,EVEN,ODD): Updated. + (Round_*): Updated. + +2025-07-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + [smooth] Remove usage of setjmp and longjmp. + + To support WASM targets with slow or unsupported setjmp and longjmp, + we eliminate these calls in favor of an error propagation model. + When gray_set_cell is out of cells, it raises an exception which is + later handled in gray_convert_glyph_inner. + This is a less invasive alternative to !385. + + * src/smooth/ftgrays.c (gray_set_cell): Raise the overflow exception + and redirect all work to `cell_null`. + (gray_move,line,conic,cubic_to): Return the exception. + (gray_convert_glyph, gray_convert_glyph_inner): Handle the exception. + +2025-07-05 Werner Lemberg <wl@gnu.org> + + [sfnt] Rewrite GPOS kerning support. (2/2) + + The previous code had a fundamental flaw: it didn't validate the necessary + parts of the 'GPOS' table before accessing it, causing crashes with + malformed data (since `TT_CONFIG_OPTION_GPOS_KERNING` is off by default, + standard fuzzers don't catch these problems). Additionally, it did a lot of + parsing while accessing kerning data, making it rather slow. + + The new implementation fixes this. After validation, offsets to the 'GPOS' + lookup subtables used in the 'kern' feature that correspond to 'simple' + kerning (i.e., similar to 'kern' table kerning) are stored in `TT_Face`; + this greatly simplifies and accelerates access to the kerning data. + + Testing with font `SF-Pro.ttf` version '1.00', the validation time for the + 'GPOS' table increases the start-up time of `FT_New_Face` by less than 1%, + while calls to `FT_Get_Kerning` become about 3.5 times faster. + + * include/freetype/internal (gpos_kerning_available): Replace with... + (gpos_lookups_kerning, num_gpos_lookups_kerning): ... these new fields. + Update callers. + + * src/ttgpos.c [TT_CONFIG_OPTION_GPOS_KERNING]: A new implementation. + +2025-07-05 Werner Lemberg <wl@gnu.org> + + [sfnt] Rewrite GPOS kerning support. (1/2) + + This commit removes the previous implementation. + +2025-07-05 Werner Lemberg <wl@gnu.org> + + [cff] Support GPOS kerning. + + * src/cff/cffdrivr.c (cff_get_kerning) [TT_CONFIG_OPTION_GPOS_KERNING]: Add + code similar to the one in `tt_get_kerning`. + +2025-07-05 Werner Lemberg <wl@gnu.org> + + * src/sfnt/ttkern.h (TT_FACE_HAS_KERNING): Remove macro. + + Given that we also support (limited) 'GPOS' table kerning if + `TT_CONFIG_OPTION_GPOS_KERNING` is defined, the name of this macro is + misleading since it only is true for 'kern' table kerning. + + * src/sfnt/sfobjs.c (sfn_load_face): Replace `TT_FACE_HAS_KERNING` with + plain code. + +2025-07-05 Werner Lemberg <wl@gnu.org> + + [autofit] Remove `globals->gsub_length`. + + We completely validate the accessed data from the 'GSUB' table, making this + field unnecessary. + + * src/autofit/afglobal.h (AF_FaceGlobalsRec): Remove `gsub_length` field. + + * src/autofit/afglobal.c (af_face_globals_new), src/autofit/afgsub.c + (af_parse_gsub): Updated. + +2025-07-01 Werner Lemberg <wl@gnu.org> + + * src/truetype/ttobjs.c (tt_size_init_bytecode): Correct previous fix. + + `FT_NEW_ARRAY` expects a signed value, not an unsigned one. + +2025-07-01 Werner Lemberg <wl@gnu.org> + + * src/autofit/afgsub.c: Include `tttables.h` and `afgsub.h`. + + This fixes 'make multi' compilation with clang. + + Reported as + + https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984610 + +2025-07-01 Werner Lemberg <wl@gnu.org> + + Various minor fixes. + + As reported by clang 19. + + * src/autofit/afadjust.c (adjustment_database): Make it static. + + * src/base/ftdbgmem.c (FT_MEM_SIZE_MIN): Remove unused macro. + + * src/psaux/psobjs.c (skip_procedure), src/truetype/ttinterp.c (Ins_IF, + Ins_ELSE, Ins_FDEF, Ins_IDEF): Add `default` clause. + +2025-07-01 Werner Lemberg <wl@gnu.org> + + More signedness fixes. + + As reported by clang 19. + + * src/autofit/afadjust.c (add_substitute): Make first argument unsigned. + Update all callers. + Other minor signedness fixes. + (af_reverse_character_map_new): Minor signedness fixes. + + * src/autofit/afgsub.c (af_hash_insert): Minor signedness fixes. + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Make third + argument unsigned. + Update all callers. + Other minor signedness fixes. + (af_latin_hints_apply): Minor signedness fixes. + + * src/bdf/bdflib.c (bdf_parse_bitmap_): Minor signedness fix. + + * src/truetype/ttobjs.c (tt_size_init_bytecode): Minor signedness fix. + +2025-07-01 Werner Lemberg <wl@gnu.org> + + */*: Fix trivial signedness issues with format strings in trace messages. + + As reported with clang 19's `-Wformat` option. + +2025-07-01 Werner Lemberg <wl@gnu.org> + + Fix `make multi`. + + Reported as + + https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984253 + + * src/base/fthash.c: Include `ftobjs.h`. + * src/autofit/afgsub.c: Include `afglobal.h`. + +2025-06-30 Alexei Podtelezhnikov <apodtele@gmail.com> + + * MSBuild.sln: Minor. + +2025-06-29 Werner Lemberg <wl@gnu.org> + + [doc] Revise font variation API. + +2025-06-29 Werner Lemberg <wl@gnu.org> + + [doc] Use 'Adobe MM', 'TrueType GX', and 'OpenType Font Variations'. + +2025-06-26 Werner Lemberg <wl@gnu.org> + + Set minimum HarfBuzz version back to 2.0.0. + + Due to the new GSUB parsing we no longer need + `hb_ot_layout_lookup_get_glyph_alternates`. + + This partially reverts commit 5d2fd7608a9. + + * CMakeLists.txt (HARFBUZZ_MIN_VERSION), meson.build (harfbuzz_dep), + builds/unix/configure.raw (harfbuzz_pkg): Set version to 2.0.0. + + * src/autofit/ft-hb-decls.h: Remove entry for + `hb_ot_layout_lookup_get_glyph_alternates`. + +2025-06-26 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up computation of `af_reverse_character_map_new`. (4/4) + + With this commit, the start-up time for creating the reverse character map + gets reduced from more than 300% to about 25% (as tested with `arial.ttf` + version 7.00). + + * src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include + `afgsub.h`. + (add_substitute): New auxiliary function to recursively add elements to + the reverse cmap. + (af_reverse_character_map_new): New code that replaces the old code + removed in the previous commit. + +2025-06-26 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up computation of `af_reverse_character_map_new`. (3/4) + + Rip out some HarfBuzz code of `af_reverse_character_map_new`. The new code + comes immediately in a follow-up commit, making it easier to follow the + changes. + + * src/autofit/afadjust.c (af_get_glyph_alternates_helper, + af_get_glyph_alternates): Remove. + (af_reverse_character_map_new): Remove code to create the `*map` hash. + +2025-06-26 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up computation of `af_reverse_character_map_new`. (2/4) + + Create an array of GSUB lookup indices for `SingleSubst` and + `AlternateSubst` lookup types to exit early if we have different types. + + Also improve tracing. + + * src/autofit/afglobal.h (AF_FaceGlobals) [FT_CONFIG_OPTION_USE_HARFBUZZ]: + New fields `gsub_length`, `gsub`, and `gsub_lookups_single_alternate`. + + * src/autofit/afglobal.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include + `afgsub.h`. + (af_face_globals_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call + `af_parse_gsub` to fill `gsub_lookups_single_alternate`. + (af_face_globals_free): Updated. + + * src/autofit/afadjust.c (af_get_glyph_alternates_helper): Exit early if we + possible. + (af_reverse_character_map_new): Trace GSUB lookup indices to be checked. + +2025-06-26 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up computation of `af_reverse_character_map_new`. (1/4) + + Using HarfBuzz's API functions to construct the reverse map is too slow; we + have to call `hb_ot_layout_lookup_get_glyph_alternates` far too often + because it can only handle a single glyph at a time. For this reason we are + going to parse the GSUB table by ourselves. + + The new non-local functions are `af_parse_gsub` and `af_map_lookup`. + + * src/autofit/afgsub.c, src/autofit/afgsub.h: New files for parsing, + validating, and mapping the `SingleSubst` and `AlternateSubst` subtable + types of a GSUB table. + + * src/autofit/autofit.c, src/autofit/rules.mk (AUTOF_DRV_SRC): Updated. + +2025-06-26 Werner Lemberg <wl@gnu.org> + + [base] Add no-overwrite hash insert functions. + + * src/base/fthash.c (ft_hash_num_insert_no_overwrite, + ft_hash_str_insert_no_overwrite): New functions. + * include/freetype/internal/fthash.h: Updated. + +2025-06-26 Werner Lemberg <wl@gnu.org> + + [base] Add iterators for `FT_Hash`. + + * src/base/fthash.c (ft_hash_num_iterator, ft_hash_str_iterator): New + functions. + * include/freetype/internal/fthash.h: Updated. + +2025-06-24 Werner Lemberg <wl@gnu.org> + + [truetype] Add comment to explain heuristic limit for twilight points. + +2025-06-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Restore non-persistent CVT and storage. + + According to specifications, CVT and storage area may or may not be + persistent after modifications by a glyf program. FreeType had always + reset them, which was broken by the last commit. + + * src/truetype/ttinterp.c (TT_Load_Context): Set CVT and storage here. + * src/truetype.ttobjs.c (tt_size_run_prep): Prioritize TT_Load_Context. + (tt_size_init_bytecode): Allocate but not set CVT and storage area. + +2025-06-22 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Deduplicate 'codeRangeTable'. + + * src/truetype/ttinterp.c (TT_Load_Context, TT_Save_Context): Do not + copy 'codeRangeTable'. + * src/truetype/ttobjs.h (TT_Size): Remove 'codeRangeTable'. + (TT_CodeRange_Tag, TT_CodeRange, TT_DefArray): Moved to... + * src/truetype/ttinterp.h: ... this header.1 + +2025-06-22 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Simplify bytecode allocations. + + To avoid repeated synchronization, some TT_Size allocations are moved + TT_ExecContext for good. The memory blocks are also consolidated. + + * src/truetype/ttinterp.c (TT_{Load,Save,Done}_Context): Remove + synchronization and stack management. + * src/truetype/ttobjs.c (tt_size_{init,done}_bytecode): Manage allocations + and assign them to the execution context. + (tt_size_run_prep): Updated. + +2025-06-22 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Rework handling of rendering mode in bytecode. + + This replaces a large number of confusing boolean constructs that + describe the target rendering mode in the execution context with + the straight mode variable. It might fix some hidden bugs when + FT_LOAD_TARGET_XXX were used as flags, which they are not. + + The condition that triggers the CV program re-execution is simplified. + These events due the rendering mode change are rather rare and unexpected + and, therefore, should not be over-analyzed. In v40, all mode changes + now trigger the CV program. In v35, only switches to/from mono do. + + * src/truetype/ttinterp.h (TT_ExecContext): Replace 'grayscale', + 'grayscale_cleartype', 'subpixel_hinting_lean', and 'vertical_lcd_lean' + with the rendering 'mode'. + * src/truetype/ttinterp.c (Ins_GETINFO): Updated. + * src/truetype/ttgload.c (tt_loader_init): Replace 'prep' re-execution + trigger and update 'backward_compatibility' condition. + (tt_loader_set_pp): Updated. + +2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/{ttinterp.c,ttobjs.c}: Minor. + +2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Clean up bytecode execution triggers. + + This avoids executing the CV program twice and cleans up the use of + 'fpgm' and 'prep' triggers + + * src/truetype/ttgload.c (tt_loader_init): Call 'tt_size_init_bytecode' + and 'tt_size_run_prep' explicitly and avoid the call repetition. + * src/truetype/ttobjs.c (tt_size_ready_bytecode): Removed as unused. + (tt_size_init, tt_size_init_bytecode, tt_size_done_bytecode): Remove some + 'fpgm' and 'prep' triggers and update. + (tt_size_run_fpgm, tt_size_run_prep): Do not set the pedantic flag here. + * src/truetype/ttobjs.h: Update signatures. + +2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttgload.c (tt_loader_init, load_sbit_image): Clean up. + +2025-06-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Simplify twilight zone management. + + * include/freetype/internal/tttypes.h (TT_GlyphZone): Remove 'memory'. + * src/truetype/ttobjs.c (tt_glyphzone_done): Use 'memory' as argument. + (tt_glyphzone_new, tt_glyphzone_done): Allocate/free as a single block. + (tt_size_init_bytecode, tt_size_done_bytecode): Updated. + * src/truetype/ttobjs.h (tt_glyphzone_done): Updated signature. + +2025-06-19 Behdad Esfahbod <behdad@behdad.org> + + [autofit] Really fix handling of `RTLD_DEFAULT`. + + This commit actually implements what commit 43ec023e1a7 describes. + + * src/autofit/ft-hb.c (FT_RTLD_FLAGS): New macro for `dlopen`; it uses + `RTLD_GLOBAL` only if `RTLD_DEFAULT` is available. + +2025-06-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Revise twilight zone initiation. + + This assures that twilight zone is reset before each CV program + execution, including after the rendering mode switch. Fixes #1344. + + * src/truetype/ttobjs.c (tt_size_ready_bytecode): Relocate the GS + the twilight zone initiation from here... + (tt_size_run_prep): ... to this function, sho that it is always + done prior to the CV program execution. + * src/truetype/ttobjs.c (TT_Run_Context): Set twilight zone here... + (TT_Load_Context): ... rather than here, as it used to be. + +2025-06-13 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove check. + + The highest (sign) attribute bit is reserved and should be zero. + It is harmless to omit this check however. Fixes #1342. + +2025-06-12 Werner Lemberg <wl@gnu.org> + + [autofit] Ignore virtual glyph indices from GSUB lookups. + + Reported as + + https://issues.chromium.org/issues/420401651 + + * src/autofit/afadjust.c (af_reverse_character_map_new): Implement it. + +2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Clean up TT_GlyphZone. + + * include/freetype/internal/tttypes.h (TT_GlyphZone): Delete fields. + * src/truetype/ttobjs.c (tt_glyphzone_new, tt_glyphzone_done, + tt_size_init_bytecode): Updated. + +2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Use FT_ARRAY_ZERO. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Updated. + * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids, + tt_size_ready_bytecode): Updated. + +2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Rearrange bytecode run. + + This is a minor change with large code rearrangements. + + * src/truetype/ttinterp.c (TT_RunIns): Just loop through instructions + and move all setup to... + (TT_Run_Context): ... here; relocated. + (Compute_Round): Replaced by simple assignment, removed. + +2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Relocate the interpreter pointer. + + This reduces dereferencing when calling the interpreter. + + * include/freetype/internal/tttypes.h (TT_Face): Move it from here... + * src/truetype/ttinterp.h (TT_ExecContext): ... to here. + * src/truetype/ttobjs.c (tt_size_init_bytecode): Move its initialization + * src/truetype/ttinterp.c (TT_New_Context): ... to here. + (TT_Run_Context): Updated. + +2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Clean up the loader initiation. + + * include/freetype/internal/tttypes.h (TT_LoaderRec): Remove unused field. + * src/truetype/ttgload.c (tt_loader_init): Refactor. + +2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Modify bytecode initiation. + + This reduces the number of function calls and data copying events. + + * src/truetype/ttinterp.c (TT_Goto_CodeRange): Merge into... + (TT_Set_CodeRange): ... this function. + (TT_Load_Context): Do not set up any zones, copy GS, or prepare the + execution... + (TT_Run_Context): ... do this here instead.. + * src/truetype/ttinterp.c (TT_Set_CodeRange): Update signature. + * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Call + TT_Run_Context. + * src/truetype/ttgload.c (TT_Hint_Glyph, tt_loader_init): Updated. + +2025-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Modify the graphics state management. + + Instead of restoring persistent GS variables, we only save modifications + permitted by the CVT program. This reduces the context manipulations. + + * src/truetype/ttobjs.h (TT_GraphicsState): Reorder fields. + * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): + Do not alter the context. + + * src/truetype/ttgload.c (TT_Hint_Glyph): Do not reset GS. + (tt_loader_init): Fix potential issue in 'instruct_control' handling. + * src/truetype/ttinterp.c (TT_Run_Context): Fully reset GS. + (TT_Load_Conext): Rearrange and remove the 'size' check, already + performed in FT_Load_Glyph. + (TT_Save_Context): Save only modifiable GS parts. + (tt_default_graphics_state): Updated. + * src/truetype/ttinterp.h (TT_Run_Context): Update signature. + +2025-06-10 Werner Lemberg <wl@gnu.org> + + [gxvar] Really fix setting of named-instance to Regular. + + This fixes an ommission in commit cf06661c51. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize `error`. + +2025-06-10 Werner Lemberg <wl@gnu.org> + + Two more link fixes. + +2025-06-10 Werner Lemberg <wl@gnu.org> + + Update links. + + Found with `linkchecker --check-extern index.html` running locally in the + 'freetype-web' repository. + +2025-06-07 Behdad Esfahbod <behdad@behdad.org> + + Fix setting of named-instance to Regular + + Fixes https://gitlab.freedesktop.org/freetype/freetype/-/issues/1341 + + And more elaborate avoidance of loading face->blend if all coords + are zero. + +2025-06-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/type42/t42objs.c (T42_Size_Init): Fix uninitialized use. + + Found by Ozkan Sezer. + +2025-06-04 Ozkan Sezer <sezeroz@gmail.com> + + [autofit] Fix `-Wunused-but-set-variable` warning in Windows builds. + + With this commit, the following warning gets removed. + + ``` + In file included from src/autofit/autofit.c:21:0: + src/autofit/ft-hb.c: In function 'ft_hb_funcs_init': + src/autofit/ft-hb.c:75:35: warning: + variable 'version_atleast' set but not used [-Wunused-but-set-variable] + ft_hb_version_atleast_func_t version_atleast = NULL; + ^~~~~~~~~~~~~~~ + ``` + + * src/autofit/ft-hb.c (ft_hb_funcs_init): Move `NULL` check of + `version_atleast` out of ifdefs. + +2025-06-04 Ozkan Sezer <sezeroz@gmail.com> + + [build] Revise visibility attributes usage in autotools and CMake. + + * CMakeLists.txt: Set `C_VISIBILITY_PRESET` to hidden for non-Windows only. + Windows handles exports with `DLL_EXPORT` defined, and old MinGW + toolchains emit a lot of warnings about visibility attributes not being + supported in this configuration. + + * build/unix/configure.raw: Revise visibility attributes checks by compiling a + better test program with `-Werror` in `CFLAGS` so that warnings correctly + indicate unsupported configurations. + +2025-06-04 Ozkan Sezer <sezeroz@gmail.com> + + * CMakeLists.txt: Add support for `FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC`. + + This commit introduces a new CMake option `FT_DYNAMIC_HARFBUZZ`. + +2025-06-03 Ozkan Sezer <sezeroz@gmail.com> + + * src/autofit/ft-hb.c: Fix definition of `_GNU_SOURCE`. + + Commit 43ec023e1a730f defined the macro too late. + +2025-06-03 Werner Lemberg <wl@gnu.org> + + Replace 'www.freetype.org' with 'freetype.org'. + +2025-06-03 Ozkan Sezer <sezeroz@gmail.com> + + * builds/unix/configure.raw: Fix HarfBuzz library detection for MinGW. + + Set `have_harfbuzz*` variables explicitly to dynamic for MinGW, since + Windows uses its own `LoadLibrary` call. + + This fixes a MinGW configuration error: + + ``` + checking for HARFBUZZ... no + checking for dlopen in -lc... no + checking for dlopen in -ldl... no + configure: error: harfbuzz support requested but library not found + ``` + +2025-06-03 Ozkan Sezer <sezeroz@gmail.com> + + * builds/unix/configure.raw: Improve check for `dlopen`. + + Look for `dlopen` first in 'libc', then in 'libdl'. + +2025-06-03 Behdad Esfahbod <behdad@behdad.org> + + * src/autofit/ft-hb.c: Fix usage of `RTLD_DEFAULT`. + + Using `RTLD_DEFAULT` we see whether the process already has HarfBuzz linked + in, and reuse it. If this symbol is not defined it is tempting to use + `RTLD_GLOBAL` instead, which would make the library available to the whole + process. However, without `RTLD_DEFAULT`, we would risk loading a second + HarfBuzz library, and if the linker mixes them up, probably giving symbols + from the new library to other clients, we might get into trouble. For this + reason, we do not pass `RTLD_GLOBAL` to `dlopen`; the default is + `RTLD_LOCAL`, and the rest of the process won't see the loaded HarfBuzz and + hopefully all be happy. + +2025-05-28 Werner Lemberg <wl@gnu.org> + + [sfnt] `FT_Load_Sfnt_Table` can now also load a font's table directory. + + Closes issue #1263. + + * src/sfnt/ttload.c (tt_face_load_any): Implement it. + +2025-05-28 Werner Lemberg <wl@gnu.org> + + [gzip] Update sources to zlib 1.13.1. + + Fixes issue #1294. + +2025-05-27 Vítor Ramos <vitor.ramos@ufrn.br> + + * src/base/ftobjs.c (FT_Load_Glyph): Loosen auto-hinting constraints. + + Fixes issue #1320. + +2025-05-27 Werner Lemberg <wl@gnu.org> + + Update `CHANGES` file. + +2025-05-27 Behdad Esfahbod <behdad@behdad.org> + + [gxvar] Optimize out more bounds checking. + + Big win, ~20% in measured mega-var font, HarfBuzz's `benchmark-font` + 'glyph_h_advances' benchmark. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Implement it in + loops. + +2025-05-27 Behdad Esfahbod <behdad@behdad.org> + + * src/truetype/ttgload.c (load_truetype_glyph): Use `IS_DEFAULT_INSTANCE`. + +2025-05-27 Behdad Esfahbod <behdad@behdad.org> + + [gxvar] Set `doblend` to `FALSE` if at default location. + + * src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Get_Var_Design): Do it. + +2025-05-27 Behdad Esfahbod <behdad@behdad.org> + + [mm/gxvar] Always detect default instance and use optimized codepath. + + Even if it was explicitly set by either design or normalized APIs. + + Also update documentation. + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): Use value -2 + of `error` to indicate that we have a non-default instance. + (TT_Set_Named_Instance): Updated. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_Var_Blend_Coordinates): Updated. + +2025-05-27 Alexei Podtelezhnikov <apodtele@gmail.com> + + Typo. + +2025-05-27 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (TT_Load_Context): Clean up. + +2025-05-26 Werner Lemberg <wl@gnu.org> + + [autofit] Fix integer overflow. + + Reported as + + https://issues.oss-fuzz.com/issues/420401635 + + * src/autofit/aflatin.c (af_latin_stretch_top_tilde, + af_latin_stretch_bottom_tilde): Use `SUB_LONG`. + +2025-05-26 Werner Lemberg <wl@gnu.org> + + [gxvar] Speed up handling of deltas in `ItemVariationStore`. (3/3) + + * src/base/ftcalc.c (FT_MulAddFix): Removed, no longer needed. + * include/freetype/internal/ftcalc.h: Updated. + +2025-05-26 Behdad Esfahbod <behdad@behdad.org> + + [gxvar] Speed up handling of deltas in `ItemVariationStore`. (2/3) + + Do all math in fixed integer and do a single divide at the end. + + Also don't use an array to read deltas; just read them as we go, and skip + (branch-free) when scalar is 0. + + 30% speedup in measured mega-var font, HarfBuzz's `benchmark-font` + 'glyph_h_advances' benchmark. + +2025-05-26 Behdad Esfahbod <behdad@behdad.org> + + [gxvar] Speed up handling of deltas in `ItemVariationStore`. (1/3) + + * src/truetype/ttgxvar.c (ft_mul_add_delta_scalar, ft_round_and_shift16): + New functions, reusing code from `ftcalc.c`. + +2025-05-26 Behdad Esfahbod <behdad@behdad.org> + + Lift `FT_Int64` type to global (internal) FreeType use. + + * src/base/ftcalc.c (FT_Int64) [!FT_INT64]: Move declaration to... + * include/freetype/config/integer-types.h: ... this file. + (FT_UInt64) [!FT_INT64]: New structure. + (FT_INT64_ZERO): New macro. + +2025-05-26 Behdad Esfahbod <behdad@behdad.org> + + [gxvar] Move scalar computation into its own function. + + * src/truetype/ttgxvar.c (tt_var_get_item_delta): Split off affected code + into... + (tt_calculate_scalar): ...this new function. + +2025-05-26 Werner Lemberg <wl@gnu.org> + + [autofit] Make the accent database work for more glyphs (again). + + See the added comment for an explanation. + + This partially undoes commit f68733d4a8. + + * src/autofit/afadjust.c (af_reverse_character_map_new): Always loop over all + elements of the adjustment database. + (in_range): Removed, no longer needed. + +2025-05-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + [trueetype] Remove useless assignments. + + * src/truetype/ttobjs.c (tt_size_run_fpgm): Remove assignment that + is ignored and overridden later in 'Compute_Funcs'. + * src/truetype/ttinterp.c (TT_RunIns): Ditto. + (Ins_MIAP): Formatting. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Minor code cleanup. + + * src/autofit/afadjust.c (af_reverse_character_map_new): Rename `result_set` + to `glyph_alternates` and move its clearing to... + (af_get_glyph_alternates): ...this function. + (af_get_glyph_alternates_helper): s/result/helper_result/. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up construction of reverse character map. (4/4) + + * src/autofit/afadjust.c (af_get_glyph_alternates): Move creation and + deletion of the `helper_result` set to... + (af_reverse_character_map_new): ...this function. + Gain for `arial.ttf` version 7.00: approx. 1%. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up construction of reverse character map. (3/4) + + * src/autofit/afadjust.c (af_reverse_character_map_new): Fold two loops into + one. + Gain for `arial.ttf` version 7.00: approx. 1%. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up construction of reverse character map. (2/4) + + This commit, together with the previous one, makes the startup of the + auto-hinter much faster. + + Note, though, that the startup time for handling the diacritic database is + still rather large. For example, loading `arial.ttf` version 7.00 followed + by auto-hinting a first Latin glyph is still approx. three times slower + than before the introduction of the database (this is because function + `hb_ot_layout_lookup_get_glyph_alternates` is called very often). + + * src/autofit/afshaper.c (scripts): Rename this array to... + (af_hb_scripts): ...this and export it. + (af_shaper_get_coverage_hb): Updated. + * src/autofit/afshaper.h: Updated. + + * src/autofit/afadjust.c (af_reverse_character_map_new): Pass the current + script to `hb_ot_layout_collect_lookups` to make HarfBuzz check less + lookups while searching for glyph alternates. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up construction of reverse character map. (1/4) + + Build reverse cmap for characters of the current script style only. + + * src/autofit/afadjust.c (in_range): New function. + (af_reverse_character_map_new): Pass `AF_StyleMetrics` instead of + `AF_FaceGlobals` so that we can access the current script style. + Use `in_range` to limit tested code points. + * src/autofit/afadjust.h: Updated. + * src/autofit/aflatin.c (af_latin_metrics_init): Updated. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Avoid variable shadowing. + + * src/autofit/afadjust.c (af_reverse_character_map_new): Do it. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Minor speedup of reverse charmap creation. + + * src/autofit/afglobal.h (AF_HAS_CMAP_ENTRY): New flag. + (AF_STYLE_MASK): Update value. + * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Set + `AF_HAS_CMAP_ENTRY`. + + * src/autofit/afadjust.c (af_reverse_character_map_new): For the creation of + the reverse map, change code to handle glyphs with cmap entries before + glyphs without cmap entries. Doing so avoids some code redundancy and + reduces the number of hash lookups. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Whitespace. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Use `FT_Offset`. + + * src/autofit/afadjust.c (af_adjustment_database_lookup, + af_reverse_character_map_new): Do it. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Simplify return value of `af_adjustment_database_lookup`. + + * src/autofit/adfadjust.h (af_adjustment_database_lookup): Return integer. + (AF_AdjustmentDatabaseEntry): Move structure to... + * src/autofit/afadjust.c: ...this file. + (af_adjustment_database_lookup, af_reverse_character_map_new): Updated. + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Updated. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Remove no longer used functions and structures. + + This is the clean-up from the previous commit. + + * src/autofit/afadjust.c (af_reverse_character_map_entry_compare, + af_reverse_character_map_lookup, af_reverse_character_map_expand): + Removed. + * src/autofit/afadjust.h: Updated. + * src/autofit/aftypes.h (AF_ReverseMapEntry, AF_ReverseCharacterMap): + Removed. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Use a hash for handling vertical accent adjustments. + + This greatly simplifies the code. + + * src/autofit/afadjust.c (af_reverse_character_map_new): Implement it. + (af_reverse_character_map_done): Updated. + * src/autofit/afadjust.h: Updated. + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Updated. + + * src/autofit/aftypes.h: Include `fthash.h`. + (AF_StyleMetrics): Change type of `reverse_charmap` to `FT_Hash`. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + * src/autofit/aflatin.c (af_latin_hints_apply): Improve code legibility. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Use `FT_LONG_MIN` and `FT_LONG_MAX` for `FT_Pos` variables. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues, + af_compute_vertical_extrema, af_find_highest_contour, + af_find_second_highest_contour, af_find_lowest_contour, + af_find_second_lowest_contour, af_check_contour_horizontal_overlap): + Updated. + +2025-05-25 Werner Lemberg <wl@gnu.org> + + [autofit] Fix uninitialized variables. + + * src/autofit/aflatin.c (af_latin_stretch_top_tilde, + af_latin_stretch_bottom_tilde): Initialize `min_measurement`. + +2025-05-23 Behdad Esfahbod <behdad@behdad.org> + + [ttmtx] Fix check for being non-default variation position. + + If user explicitly sets variations to `NULL` after it being set to something + else, `face->blend` will still be non-`NULL`. The intention here however is + correctly captured by `FT_IS_VARIATION`. + + * src/sfnt/ttmtx.c (tt_face_get_metrics): Use `FT_IS_VARIATION`. + +2025-05-23 Behdad Esfahbod <behdad@behdad.org> + + [gxvar] Optimize loading of 'gvar' table. + + * src/truetype/ttgxvar.c (tt_var_load_item_variation_store, + tt_var_load_delta_set_index_mapping, ft_var_load_gvar): Use frames to + reduce bounds checking. + (TT_Vary_Apply_Glyph_Deltas): Better macro usage. + +2025-05-22 Behdad Esfahbod <behdad@behdad.org> + + [mm] Short-circuit setting face to default instance if already is so. + + I found that in hb-ft I need to sometime reset the face to the default + instance. However, calling `FT_Set_Var_Design_Coordinates` with no coords + was still slowing down at least the glyph-advance code by processing + variations. + + Perhaps there's a better fix, but this handles the easy cases. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates): Implement it. + +2025-05-22 Behdad Esfahbod <behdad@behdad.org> + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix allocation. + + Bug was introduced in commit 582de1a4b6f. + +2025-05-21 Werner Lemberg <wl@gnu.org> + + * src/truetype/ttgxvar.c (ft_var_apply_tuple): Remove redundant test. + + This was erroneously added in commit e6e9110a8. + +2025-05-21 ColdPaleLight <coldpalelight@gmail.com> + + [sdf] Skip neighbor comparison for pixels near edges. + + If the distance of the current pixel to the edge is less than or equal + to 0.5, skip further neighbor comparisons to avoid unnecessary + calculations. When the `USE_SQUARED_DISTANCES` macro is defined, + compare to 0.25 instead. + + * src/sdf/ftbsdf.c (compare_neighbor): Add early return for pixels + close to edges to avoid unnecessary neighbor checks. + +2025-05-21 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [gxvar] Cache shared-tuple scalar values. + + GoogleSansFlex HB benchmark-font draw results: + + Before: 2.13ms + After: 1.65ms + Speedup: 22% + + * src/truetype/ttgxvar.h (GX_BlendRec): Add `tuplescalars` field. + + * src/truetype/ttgxvar.c (ft_var_load_gvar): Allocate `tuplescalars` array. + (tt_set_mm_blend): Set its values. + (TT_Vary_Apply_Glyph_Deltas): Use it. + (tt_done_blend): Deallocate it. + +2025-05-21 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [gxvar] Reduce number of mallocs. + + 8% speed up in drawing GoogleSansFlex variable in HB benchmark-font. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Use an allocation + pool instead of individual allocations. + +2025-05-21 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [gxvar] Another optimization in computing scalar. + + Another ~6% speedup in GoogleSansFlex var drawing. + + * src/truetype/ttgxvar.c (ft_var_apply_tuple): Test `ncv` for being zero. + +2025-05-21 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [gxvar] Remove stale comment. + + The code *does* check against start/end! + +2025-05-21 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + * src/truetype/ttgxvar.c (ft_var_apply_tuple): Micro-optimize. + +2025-05-21 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [gxvar] Inline two USHORT reads. + + Speeds up GoogleSansFlex variable glyph drawing by ~13%. + + Before: 2.95ms + After: 2.57ms + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Do it. + +2025-05-21 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [gxvar] Micro-optimize loop end condition. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Do it. + +2025-05-21 Behdad Esfahbod <behdad@behdad.org> + + [truetype] Don't process `mvar` metrics if default instance. + + GoogleSansFlex default-instance HarfBuzz benchmark-font draw: + + Before: 0.610ms + After: 0.435ms + Speedup: 28% + + * src/truetype/ttobjs.c (tt_face_init) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: + Check `instance_index`. + +2025-05-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (Ins_MIRP,DELTAP,DELTAC): Minor. + +2025-05-20 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Update bytecode error handling. + + * src/truetype/ttinterp.c (Ins_SHP,SHPIX,ALIGNRP): Return appropriate + error in case of stack underflow. + (Ins_IP): Ditto and remove redundant check. + +2025-05-19 Werner Lemberg <wl@gnu.org> + + * src/aflatin.c (af_latin_hint_edges): Refine fix for serif handling. + + Commit 11432424 (from 2025-May-12) was too aggressive; it is now restricted + to edges that are not too far away. + +2025-05-19 Werner Lemberg <wl@gnu.org> + + * src/afadjust.c (adjustment_database): Make it complete up to U+FFFF. + + Also fix two entries. + + This is for Unicode 17.0. + +2025-05-19 Werner Lemberg <wl@gnu.org> + + [autofit] Fix vertical adjustment of (mainly) double diacritics. + + The series of commits that introduced this adjustment support had some + flaws. + + - If there were two diacritics on top of a base glyph, and the upper + diacritic was a tilde, the vertical centering correction was incorrectly + applied to the lower, non-tilde glyph instead of the tilde. + + - The maximum value allowed to shift a glyph was too strict (and also not + handling rounding issues), causing some diacritics and combinations of + diacritics to be not shifted at all. + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Correctly handle + vertical centering correction. + +2025-05-19 Werner Lemberg <wl@gnu.org> + + [autofit] Code hygiene. + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Use more flag + variables and improve trace messages. + +2025-05-19 Werner Lemberg <wl@gnu.org> + + * src/autofit/aflatin.c (af_latin_hint_edges): Fix handling of serifs. + + This has been discovered while inspecting the auto-hinting results of + character 'Ễ' in font `arial.ttf` (version 7.00) at 13ppem. + +2025-05-19 Werner Lemberg <wl@gnu.org> + + [autofit] Minor. + + * src/autofit/aflatin.c (af_latin_hint_edges): Rename `has_serifs` to + `has_non_stem_edges` and make it of type `FT_Bool`. + +2025-05-19 Werner Lemberg <wl@gnu.org> + + [autofit] New algorithm for preventing hinting of tilde glyphs. + + The old algorithm removed segments from edges to make the auto-hinter ignore + a tilde. However, the implementation had two flaws. + + - Edge array elements were moved around without reordering them afterwards. + - The linking between edges and segments wasn't correctly updated for moved + edges, which could cause endless loops. + + Correcting both problems are non-trivial; additionally, a fix would make + the auto-hinter slower. + + For these reasons, a new, simpler approach is taken: A new flag allows + points to be tagged as being ignored, and if such a point is enountered, it + doesn't get added to a segment. + + Fixes issue #1333. + + * src/autofit/afhints.h (AF_FLAG_IGNORE): New macro. + + * src/autofit/aflatin.c (af_latin_hints_compute_segments, af_touch_contour): + Use it. + (af_remove_segments_containing_point, af_remove_top_points_from_edges, + af_remove_bottom_points_from_edges): Removed. + (af_latin_stretch_top_tilde): Call `af_touch_top_contours` and + `af_touch_bottom_contours` unconditionally. + (af_latin_hints_apply): Updated. + +2025-05-16 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN. + +2025-05-16 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (Ins_DELTAP): Flip if-else. + +2025-05-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Optimize DELTAP and DELTAC. + + * src/truetype/ttinterp.c (Ins_DELTAP,DELTAC): Perform PPEM range- + checking and manipulations outside the loop. + +2025-05-14 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (Compute_Funcs): Replace shifts. + +2025-05-14 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Tighten code overflow checks. + + Fixes #1336. + + * src/truetype/ttinterp.c (Ins_NPUSHB,NPUSHW,PUSHB, PUSHW): + Tighten conditions. + +2025-05-14 Chris Liddell <chris.liddell@artifex.com> + + [type1] Fix memory leak on CharString error. + + In the event that a CharString retrieved via the incremental interface + caused an error, the memory for that CharString was not being freed. + + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Free charstring. + +2025-05-14 Werner Lemberg <wl@gnu.org> + + Whitespace, formatting, minor spelling fix. + +2025-05-14 Werner Lemberg <wl@gnu.org> + + Adminstrativa. + +2025-05-13 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Finalize bytecode changes. + + * src/truetype/ttinterp.c: Formatting, minor. + (TT_Goto_CodeRange): Initialize 'iniRange' here... + (TT_RunIns): ... instead of here. + * docs/CHANGES: Updated. + +2025-05-13 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Streamline backward compatibility. + + The 'backward_compatibility' is only set in v40: no need to check + the interpreter version again and again. In addition, we now track + IUP in its lower bits. After both IUPx and IUPy have been called, + 'backward_compatibility' becomes equal to 0x7. + + * src/truetype/ttinterp.h (TT_ExecContextRec): Wrap 'iup?_called' + into 'backward_compatibility'. + * src/truetype/ttinterp.c (Ins_INSTCTRL): Sync 'backward_compatibility'. + (Direct_Move, Direct_Move_X/Y, Move_Zp2_Point, + Ins_FLIPPT,FLIPRGON,FLIPRGOFF,SHPIX,DELTAP): Updated. + (TT_RunIns): Do not mess with IUP flags. + * src/truetype/ttgload.c (tt_loader_init): Set 'backward_compatibility'. + (TT_Hint_Glyph): Updated. + +2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Optimize bytecode movements. + + Replacing FT_MulDiv with FT_MulFix gives large performance gains. + + * src/truetype/ttinterp.h (TT_ExecContextRec): Store "projected" + freedom vector. + * src/truetype/ttinterp.c (Compute_Funcs): Compute "projected" + freedom vector. + (Direct_Move, Direct_Move_Orig, Compute_Point_displacement): Use it. + +2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Simplify stack access. + + * src/truetype/ttinterp.c (Ins_MINDEX,CINDEX): Use local stack pointers. + (Ins_DELTAP,DELTAC): Ditto; limit the number of pairs before looping. + +2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Tweak bytecode looping. + + * src/truetype/ttinterp.c (Ins_FLIPPT,SHP,SHPIX,IP,ALIGNRP): Handle + counters and stack locally. + (TT_RunIns): Updated. + +2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Tweak bytecode initiation. + + * src/truetype/ttinterp.c (TT_Load_Context): Init stack tops. + * src/truetype/ttinterp.h (TT_ExecContextRec): Document it and clean. + * src/truetype/ttobjs.c (tt_size_run_prep,fpgm): Updated. + * src/truetype/ttgload.c (tt_loader_init): Minor. + +2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Modify stack handling. + + * src/truetype/ttinterp.c (Ins_GETVARIATION): Increment stack. + (Ins_NPUSHB,NPUSHW,PUSHB,PUSHW): Handle the code stack here, ... + (TT_RunIns): ... instead of here. Consolidate error handling. + (SkipCode): Remove preemptive check. + +2025-05-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Modify bytecode steps. + + * src/truetype/ttinterp.h (TT_Exec_ContextRec): Remove 'step_ins'. + * src/truetype/ttinterp.c (TT_RunIns, Ins_Goto_CodeRange, + Ins_JMPR,ENDF,PUSHW,NPUSHW): Set and use zero increment 'length' instead. + (Ins_CALL,LOOPCALL,UNKNOWN): Updated. + +2025-05-10 Werner Lemberg <wl@gnu.org> + + [autofit] Add safety check for accent adjustments. + + This commit does two things. + + - Ignore accents that have too large heights. This situation can happen if + an accent outline is unexpectedly not the highest (or lowest) contour. + - Add a new adjustment flag `AF_ADJUST_NO_HEIGHT_CHECK` to override the + height check. + + * src/autofit/afadjust.h (AF_ADJUST_NO_HEIGHT_CHECK): New macro. + + * src/autofit/afadjust.c (adjustment_database): Updated. + + * src/autofit/aflatin.c (af_latin_hints_apply): Handle new flag. + (af_glyph_hints_apply_vertical_separation_adjustments): Check limit. + +2025-05-10 Werner Lemberg <wl@gnu.org> + + [autofit] Better handling of characters with attached diacritics. (3/3) + + Fixes issue #136. + + * src/autofit/afadjust.c (adjustment_database): Updated. + +2025-05-10 Werner Lemberg <wl@gnu.org> + + [autofit] Better handling of characters with attached diacritics. (2/3) + + * src/autofit/afadjust.h (AF_IGNORE_CAPITAL_TOP, AF_IGNORE_CAPITAL_BOTTOM, + AF_IGNORE_SMALL_TOP, AF_IGNORE_SMALL_BOTTOM): New macros. + + * src/autofit/afadjust.c (af_reverse_character_map_new) + [FT_DEBUG_LEVEL_TRACE]: Updated. + Also fix debugging strings of other flags. + + * src/autofit/afhints.h (AF_EDGE_NO_BLUE): New edge flag to make the + auto-hinter ignore the edge while assigning blue zones. + + * src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Use it. + (af_prevent_top_blue_alignment, af_prevent_bottom_blue_alignment, + af_latin_get_base_glyph_blues, af_latin_ignore_top, + af_latin_ignore_bottom): New functions. + (af_latin_hints_apply): Updated. + +2025-05-10 Werner Lemberg <wl@gnu.org> + + [autofit] Better handling of characters with attached diacritics. (1/3) + + Introduce blue zone properties that will be used to make the auto-hinter + ignore diacritics attached on the top or the bottom of a base character. + + * src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM, + AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM): New properties. + * src/autofit/afblue.dat: Use them. + + * src/autofit/afblue.c, src/autofit/afblue.h: Rengenerated. + + * src/autofit/aflatin.h (AF_LATIN_IS_CAPITAL_BOTTOM_BLUE, + AF_LATIN_IS_SMALL_BOTTOM_BLUE, AF_LATIN_BLUE_BOTTOM, + AF_LATIN_BLUE_BOTTOM_SMALL): New macros. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues)[FT_DEBUG_LEVEL_TRACE]: + Updated. + +2025-05-09 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/raster/ftraster.c (Line_Up): Use 64-bit calculations. + + Attempt to fix #1332. + +2025-05-09 Werner Lemberg <wl@gnu.org> + + [sfnt] Avoid allocation bomb in compressed SVG documents. + + Reported as + + https://issues.oss-fuzz.com/issues/416538625 + + * src/sfnt/ttsvg.c (MAX_SVG_SIZE): New macro. + (tt_face_load_svg_doc): Reject too large buffer. + +2025-05-08 Werner Lemberg <wl@gnu.org> + + * include/freetype/ttnameid.h (TT_UCR_*): Define with unsigned long. + (TT_UCR_PHAGSPA): Fix definition. + + Fixes issue #1300. + +2025-05-08 Werner Lemberg <wl@gnu.org> + + [doc] Mention that there is no rendering support for 'COLR' v1 tables. + + Handles issue #1319. + +2025-05-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN. + +2025-05-07 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/cff/cffgload.c (cff_slot_load): Fix autohinter scaling. + + Fixes #1330. + +2025-05-05 Werner Lemberg <wl@gnu.org> + + [autofit] Avoid division by zero. + + Fixes issue #1331. + + * src/autofit/aflatin.c (af_latin_stretch_bottom_tilde): Don't divide by + zero. + +2025-05-04 Carlo Bramini <carlo.bramix@libero.it> + + Fix Cygwin visibility attributes. + + Reported as compilation warnings in #1329. + + * include/freetype/config/public-macros.h: Check __CYGWIN__. + * include/freetype/internal/compiler-macros.h: Ditto. + +2025-05-03 KatekovAnton <void0main@gmail.com> + + * CMakeLists.txt: Fix cmake 4 error by specifying the policy version. + +2025-04-29 Werner Lemberg <wl@gnu.org> + + * docs/CHANGES: Updated. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + Provide configuration option to dynamically load the HarfBuzz library. + + We now request HarfBuzz version 2.6.8 (published in June 2020) or newer to + simplify the setup; this version introduced function + `hb_ot_layout_lookup_get_glyph_alternates`, which we need for the adjustment + database of the auto-hinter. + + No CMake support yet for dynamic loading. + + * include/freetype/config/ftoption.h, devel/ftoption.h + (FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC): New configuration macro. + + * builds/unix/configure.raw: Implement `--with-harfbuzz=dynamic`. + This gets tested automatically if we can't link with `libharfbuzz`. + (ft_option_set, ft_option_unset): Refine. + Require at least HarfBuzz version 2.6.8. + + * meson.build: Do the same as `configure.raw`. + * meson_options.txt: Updated. + + * CMakeLists.txt: Require at least HarfBuzz version 2.6.8. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [autofit] Enable dynamic loading of HarfBuzz. (2/2) + + Handle the case where loading HarfBuzz dynamically fails. + + * src/autofit/ft-hb.c, src/autofit/ft-hb.h (ft_hb_enabled): New function. + + * src/autofit/afglobal.c (af_face_globals_new, af_face_globals_free): + Guard HarfBuzz functions with `ft_hb_enabled`. + + * src/autofit/aflatin.c (af_latin_metrics_init_widths, + af_latin_metrics_init_blues, af_latin_metrics_check_digits): Simplify + setup of `shaper_buf`. + Guard calls of `af_shaper_buf_create` with `ft_hb_enabled`. + + * src/autofit/afcjk.c (af_cjk_metrics_init_widths, + af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Dito. + + * src/autofit/afshaper.c: Guard all HarfBuzz function calls with + `ft_hb_enabled`. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [autofit] Enable dynamic loading of HarfBuzz. (1/2) + + This commit activates the mini-HarfBuzz header files and provides the + necessary infrastructure for dynamically loading HarfBuzz if + `FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC` is defined (this macro gets set up + in a follow-up commit). + + * src/autofit/ft-hb.c: New file, providing `ft_hb_funcs_init` and + `ft_hb_funcs_done` for loading HarfBuzz dynamically. The name of the + library is hold in the macro `FT_LIBHARFBUZZ`, which can be overridden. + + * src/autofit/ft-hb.h: Don't include `hb.h` but `ft-hb-types.h`. + (hb): Modified to handle both standard linking and dynamically + loading of HarfBuzz. + (HB_EXTERN): New macro to load `ft-hb-decls.h`. + + * src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: For the sake of + dynamically loading the HarfBuzz library, replace the compile-time macro + `HB_VERSION_ATLEAST` with a call to the run-time function + `hb_version_atleast` where necessary – a follow-up commit will set the + minimum version of HarfBuzz to 2.6.8, which provides all necessary + functions needed by FreeType. + + * src/autofit/afmodule.h: Include `ft-hb.h`. + (AF_ModuleRec) [FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Add `hb_funcs` + structure to hold pointers to the dynamically loaded HarfBuzz functions. + + * src/autofit/afmodule.c (af_autofitter_init, af_autofitter_done) + [FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Call `ft_hb_funcs_init` and + `ft_hb_funcs_done`. + + * src/autofit/afshaper.h: Updated. + * src/autofit/autofit.c: Include `ft-hb.c`. + + * src/autofit/rules.mk (AUTOF_DRV_SRC, AUTOF_DRV_H): Updated. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [autofit] Some preparations for loading HarfBuzz dynamically. (4/4) + + Add 'mini' HarfBuzz declarations to make FreeType independent on HarfBuzz + header files. + + The files get activated in a follow-up commit. + + * src/autofit/ft-hb-decls.h, src/autofit/ft-hb-types.h: New files, holding + verbatim (or slightly massaged) entries from public HarfBuzz header files. + + * src/autofit/hb-script: New file. + A verbatim copy of a public HarfBuzz header file. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [autofit] Some preparations for loading HarfBuzz dynamically. (3/4) + + * src/autofit/afshaper.c: Move around code so that the non-HarfBuzz code is + present even if `FT_CONFIG_OPTION_USE_HARFBUZZ` is not defined. This is a + preliminary step to allow deactivation of HarfBuzz at run-time. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [autofit] Some preparations for loading HarfBuzz dynamically. (2/4) + + Pass `AF_FaceGlobals` to many functions, or provide it, tagged with + `FT_UNUSED`. We need this later on to access a dynamically linked HarfBuzz + library. + + * src/autofit/ft-hb-ft.h (ft_hb_ft_font_create): Use `globals` argument. + Drop unused `destroy` argument. + * src/autofit/ft-hb-ft.c (ft_hb_ft_face_create, ft_hb_ft_font_create): Use + `globals` argument. + Drop unused `destroy` argument. + (ft_hb_ft_face_create, ft_hb_ft_reference_table): Cast `user_data` to + `AF_FaceGlobals`. + + * src/autofit/afadjust.c (af_get_glyph_alternates_helper, + af_get_glyph_alternates): Add `globals` argument. + Update callers. + + * src/autofit/afshaper.c, src/autofit/afshaper.h (af_shaper_buf_create, + af_shaper_buf_destroy): Use `globals` argument. + + * src/autofit/afglobal.c (af_face_globals_new): Updated. + + * src/autofit/afcjk.c (af_cjk_metrics_init_widths, + af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated. + * src/autofit/aflatin.c (af_latin_metrics_init_widths, + af_latin_metrics_init_blues, af_latin_metrics_check_digits): Updated. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [autofit] Some preparations for loading HarfBuzz dynamically. (1/4) + + * src/autofit/ft-hb.h: New file, defining the `hb` macro. Later on, we + provide a different definition of this macro depending on a yet-to-come + configuration option to support dynamic loading of HarfBuzz functions. + + * src/autofit/afadjust.c, src/autofit/afglobal.c, src/autofit/afshaper.c, + stc/ft-hb-ft.c: Use it. + +2025-04-29 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + [autofit] Rename 'ft-hb' to 'ft-hb-ft'. + + Since it's a (shrinked) copy of 'hb-ft'. + + * src/autofit/afglobal.c (af_face_globals_new), src/autofit/afshaper.h, + src/autofit/autofit.c: Updated. + + * src/autofit/ft-hb.c, src/autofit/ft-hb.h: Renamed to... + * src/autofit/ft-hb-ft.c, src/autofit/ft-hb-ft.h: ...this; updated. + + * src/autofit/rules.mk (AUTOF_DRV_SRC): Updated. + +2025-04-29 Werner Lemberg <wl@gnu.org> + + * src/autofit/aflatin.c (af_latin_stretch_top_tilde): Don't divide by zero. + + Reported as + + https://issues.oss-fuzz.com/issues/414320186 + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Extend adjustment database with characters up to U+1FFF. + + This adds many pre-combined Latin glyphs, Cyrillic, Greek, and some + characters from other scripts (or rather, Unicode blocks). + + Fixes issues #112 and #471. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Support diacritics with special vertical minima. + + This code catches situations like U+1F90 ('á¾'), where some fonts have + exactly the same vertical minimum for the lower accent as for the base + glyph. + + * src/autofit/aflatin.c (af_find_highest_contour, af_find_lowest_contour): + Handle it. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] More tilde stretch support. (3/3) + + The auto-hinter now supports up to four tilde glyphs (two above and two + below a base character). + + Note that diacritics above (or below) a tilde are now also ignored by the + auto-hinter. + + * src/autofit/afadjust.h (AF_ADJUST_TILDE_TOP2, AF_ADJUST_TILDE_BOTTOM2): + New macros. + * src/autofit/afadjust.c (af_reverse_character_map_new): Updated. + + * src/autofit/aflatin.c (af_remove_top_points_from_edges, + af_remove_bottom_points_from_edges): Make functions also handle all + contours higher (or lower) of the given one in the argument. + (af_touch_top_contours, af_touch_bottom_contours): New functions. + (af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde): Use it to + also handle all contours higher (or lower) than the tilde contour. + + * (af_latin_hints_apply): Handle more tilde glyphs. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] More tilde stretch support. (2/3) + + * src/autofit/aflatin.c (af_latin_stretch_top_tilde, + af_latin_stretch_bottom_tilde): Return vertical size difference between + stretched and original contour. + (af_latin_align_top_tilde, af_latin_align_bottom_tilde): Return applied + delta. + (af_latin_hints_apply): Updated; the return values are not used yet. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] More tilde stretch support. (1/3) + + Move some existing code that we soon need elsewhere into separate functions. + + * src/autofit/aflatin.c (af_move_contours_up, af_move_contours, down): New + functions. + (af_glyph_hints_apply_vertical_separation_adjustments): Use them. + (af_touch_contour): New function. + (af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde): Use it. + + (af_latin_remove_top_tilde_points_from_edges, + af_latin_remove_bottom_tilde_points_from_edges): Renamed to... + (af_remove_top_points_from_edges, af_remove_bottom_points_from_edges): + ...this. + Update callers. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Support two below/above accents for vertical adjustment. (2/2) + + * src/autofit/afadjust.h (AF_ADJUST_UP2, AF_ADJUST_DOWN2): New macros. + * src/autofit/afadjust.c (af_reverse_character_map_new): Updated. + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Implement it. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Support two below/above accents for vertical adjustment. (1/2) + + Some variable renamings. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Routines for finding the second highest/lowest contour. + + * src/autofit/aflatin.c (af_find_second_highest_contour, + af_find_second_lowest_contour): New functions. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Use more functions to reduce code. + + * src/autofit/aflatin.c (af_find_highest_contour, af_find_lowest_contour): + Updated. + (af_glyph_hints_apply_vertical_separation_adjustments): Use + `af_compute_vertical_extrema`, `af_find_highest_contour`, and + `af_find_lowest_contour`. + (af_latin_hints_apply): Use `af_compute_vertical_extrema`, + +2025-04-28 Werner Lemberg <wl@gnu.org> + + * src/autofit/aflatin.c (af_compute_vertical_extrema): New function. + + To be used in a follow-up commit. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + * src/autofit/aflatin.c: Some variable renaming. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Avoid recomputation of highest and lowest contour. + + * src/autofit/aflatin.c (af_latin_hints_apply): Compute highest and lowest + contour in this function. + (af_latin_remove_top_tilde_points_from_edges, + af_latin_remove_bottom_tilde_points_from_edges, + af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde, + af_latin_align_top_tilde, af_latin_align_bottom_tilde): Updated. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + * src/aflatin.c (af_latin_trace_height): Remove. + Update caller. + + The algorithm works fine. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Support vertical stretching of tilde below base glyph. (2/2) + + * src/autofit/afadjust.h (AF_ADJUST_TILDE_BOTTOM): New macro. + * src/autofit/afadjust.c (af_reverse_character_map_new): Updated. + + * src/autofit/aflatin.c (af_find_lowest_contour, + af_latin_remove_bottom_tilde_points_from_edges, + af_latin_stretch_bottom_tilde, af_latin_align_bottom_tilde): New functions + in analogy to the top tilde versions. + (af_glyph_hints_apply_vertical_separation_adjustments): Add support in + analogy to the top tilde code. + (af_latin_hints_apply): Updated. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Support vertical stretching of tilde below base glyph. (1/2) + + * src/autofit/aflatin.c (af_latin_remove_tilde_points_from_edges, + af_latin_stretch_tilde, af_latin_align_tilde): Rename to... + (af_latin_remove_top_tilde_points_from_edges, af_latin_stretch_top_tilde, + af_latin_align_top_tilde): ...this. + Update all callers. + (af_latin_hints_apply): Rename `is_tilde` to `is_top_tilde`. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Allow vertical adjustment at the top and bottom simultaneously. + + This will be used to hint characters like U+1FB7 ('á¾·'). + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Implement it. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + * src/autofit/afadjust.c (af_reverse_character_map_new): Update tracing. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Indicate tilde handling with a flag macro, too. + + * src/autofit/afadjust.h (AF_ADJUST_TILDE_TOP): New macro. + (AF_AdjustmentDatabaseEntry): Remove field `apply_tilde`. + + * src/autofit/afadjust.c (adjustment_database, + af_reverse_character_map_new), src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments, + af_latin_hints_apply): Updated. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [aflatin] Convert adjustment database enum to macros. + + We are going to add more values, and we want to use combinations of them. + + * src/autofit/afadjust.h (AF_VerticalSeparationAdjustmentType): Replace + with... + (AF_ADJUST_UP, AF_ADJUST_DOWN, AF_ADJUST_NONE): ... new macros. + (AF_AdjustmentDatabaseEntry): Rename field + `vertical_separation_adjustment_type` to `flags`. + + * src/autofit/afadjust.c (af_reverse_character_map_new), + src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Updated. + +2025-04-28 Werner Lemberg <wl@gnu.org> + + [autofit] Shorten adjustment enum names. + + * src/autofit/afadjust.h (AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, + AF_VERTICAL_ADJUSTMENT_BOTTOM_CONTOUR_DOWN, AF_VERTICAL_ADJUSTMENT_NONE): + Renamed to... + (AF_ADJUST_UP, AF_ADJUST_DOWN, AF_ADJUST_NONE): ...this. + + * src/autofit/afadjust.c (adjustment_database, + af_reverse_character_map_expand), src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Updated. + +2025-04-26 Werner Lemberg <wl@gnu.org> + + * src/autofit/afranges.c: Updated to Unicode 17.0. + + But no support for new scripts (volunteers welcomed). + +2025-04-26 Werner Lemberg <wl@gnu.org> + + * src/autofit/afranges.c: Updated to Unicode 16.0. + + But no support for new scripts (volunteers welcomed). + +2025-04-26 Werner Lemberg <wl@gnu.org> + + * src/autofit/afranges.c: Updated to Unicode 15.1. + + But no support for new scripts (volunteers welcomed). + +2025-04-26 Werner Lemberg <wl@gnu.org> + + * src/autofit/afranges.c: Updated to Unicode 14.0. + + But no support for new scripts (volunteers welcomed). + +2025-04-26 Werner Lemberg <wl@gnu.org> + + * src/autofit/afranges.c: Updated to Unicode 13.0. + + But no support for new scripts (volunteers welcomed). + +2025-04-26 Werner Lemberg <wl@gnu.org> + + * src/autofit/afranges.c: Updated to Unicode 12.0. + + But no support for new scripts (volunteers welcomed). + +2025-04-25 Alexei Podtelezhnikov <apodtele@gmail.com> + + * include/freetype/internal/ftcalc.h (FT_MulFix_64): Silence UBSAN. + +2025-04-22 Behdad Esfahbod <behdad@behdad.org> + + * src/autofit/afadjust.c (af_get_glyph_alternates): Fix endless loop. + +2025-04-20 Werner Lemberg <wl@gnu.org> + + * src/afadjust.c: Fix test for newer HarfBuzz version (second try). + +2025-04-20 Werner Lemberg <wl@gnu.org> + + * src/afadjust.c: Fix test for newer HarfBuzz version. + +2025-04-20 Werner Lemberg <wl@gnu.org> + + [autofit] Request at least HarfBuzz 7.2.0 for diacritic support. (3/3) + + This version (from April 2023) added 'SingleSubst' support to + `hb_ot_layout_lookup_get_glyph_alternates`. + +2025-04-20 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up creation of the adjustment database's reverse map. (2/3) + + Remove the old code and activate the new one. + +2025-04-20 Werner Lemberg <wl@gnu.org> + + [autofit] Speed up creation of the adjustment database's reverse map. (1/3) + + As it turns out, the original implementation using + `hb_ot_shape_glyphs_closure` is extremely slow if a font has a rich set of + OpenType features. For example, this function was called 66954 times while + loading font `arial.ttf` version 7.00, increasing FreeType's startup time by + a factor of 10, which is unacceptable. + + The new algorithm uses a completely different, more low-level approach, no + longer working with OpenType features but with OpenType lookups. It relies + on function `hb_ot_layout_lookup_get_glyph_alternates`, also replacing + recursion with a simple loop. In total, this brings the additional startup + time back to an acceptable range of a few percent. + + A side effect of the new approach is that it catches more alternate forms: + the old code didn't properly handle script-specific features. + + To make the change more readable, this commit only adds new code. + +2025-04-18 Werner Lemberg <wl@gnu.org> + + * src/autofit/afadjust.c (af_reverse_character_map_new): Check `map` limit. + + Reported as + + https://issues.chromium.org/issues/410925355 + +2025-04-18 Alexei Podtelezhnikov <apodtele@gmail.com> + + * include/freetype/internal/ftcalc.h: Fix fringe compilation. + +2025-04-18 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftcalc.c (ft_corner_orientation) [!FT_INT32]: Fix up. + +2025-04-17 Werner Lemberg <wl@gnu.org> + + [autofit] Don't access uninitialized memory. + + Reported as + + https://bugs.ghostscript.com/show_bug.cgi?id=708295 + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Initialize all + array elements of `contour_y_minima` and `contour_y_maxima`. + +2025-04-17 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (TT_MulFix14,TT_DotFix14)[!FT_INT64]: Sync. + +2025-04-17 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN. + +2025-04-17 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftcalc.c: Miscellaneous cleanups. + +2025-04-16 Werner Lemberg <wl@gnu.org> + + [autofit] Avoid crash. + + Reported as + + https://issues.oss-fuzz.com/issues/410811029 + + * src/autofit/aflatin.c (af_remove_segments_containing_point): Check + `edge->last`. + +2025-04-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base, truetype] Silence UBSAN (cont'd). + + * src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14): Use MUL_INT64. + * include/freetype/internal/ftcalc.c (FT_MulFix): Ditto. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Avoid unnecessary recomputation of HarfBuzz data. + + Call the functions once per font instead of once per glyph. + + * src/autofit/afadjust.c (af_all_glyph_variants): Move code to compute the + `feature_tags` and `type_3_lookup_indices` sets to... + (af_reverse_character_map_new): ...this function. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Fix creation of the adjustment database's reverse map. + + Due to the way the reverse map array gets constructed with HarfBuzz, there + might be multiple, identical glyph index entries with different character + values in the array. As an example, an OpenType feature like 'unic' might + map lowercase glyph 'ae' to uppercase glyph 'AE', in addition to the already + present cmap entry for 'AE'. + + In most cases, this incorrect mapping is harmless (but still wrong). + However, there exist some lowercase/uppercase character pairs where the + diacritic for the uppercase character is on the other vertical side of the + base character as for the lowercase character. An example is U+0122 (LATIN + CAPITAL LETTER G WITH CEDILLA) and U+0123 (LATIN SMALL LETTER G WITH + CEDILLA): the former has the cedilla below, the latter above. A wrong + mapping would thus shift the base glyph 'G' up by a pixel instead of + shifting the cedilla down. + + We fix this by always giving precedence to cmap entries. + + * src/autofit/afadjust.c (af_reverse_character_map_entry_compare): Do a + secondary sort on the character code. + + (af_reverse_character_map_lookup): Adjust binary search to return the + first occurrence of an entry (i.e., the one with the lowest array index). + + (af_reverse_character_map_new)[FT_CONFIG_OPTION_USE_HARFBUZZ]: Implement + cmap priority. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Reduce adjustment database lookups. + + This is also in preparation for a follow-up commit. + + * src/autofit/afadjust.h (af_lookup_vertical_separation_type, + af_lookup_tilde_correction_type): Replaced with... + (af_adjustment_database_lookup, af_reverse_character_map_lookup): + ... this. + + * src/autofit/afadjust.c (af_adjustment_database_lookup, + af_adjustment_database_lookup): Updated. + (af_lookup_vertical_separation_type, af_lookup_tilde_correction_type): + Removed. + (af_reverse_character_map_new)[FT_DEBUG_LEVEL_TRACE]: Updated. + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments, + af_latin_hints_apply): Updated. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + * src/afadjust.c (adjustment_database): Make it complete up to U+017F. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + * src/autofit/afadjust.c (af_reverse_character_map_new): Add tracing code. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + * src/afadjust.c: Minor fixes. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Better vertical separation adjustment support. (2/2) + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Handle diacritics + with more than a single contour. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Better vertical separation adjustment support. (1/2) + + Test vertical maxima instead of vertical minima to identify the highest + contour (and vice versa to identify the lowest contour). Doing so will + allow support of diacritics that consist of more than a single outline. + + This works because of the topological constraints ensured by the adjustment + database. + + * src/autofit/aflatin.c (af_find_highest_contour, + af_glyph_hints_apply_vertical_separation_adjustments): Implement it. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Use new y extrema arrays. + + * src/autofit/aflatin.c + (af_glyph_hints_apply_vertical_separation_adjustments): Implement it. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Provide infrastructure for storing y extrema of contours. + + We need this for better positioning support of diacritics. + + * src/autofit/afhints.h (AF_GlyphHintsRec): New fields `contour_y_minima` + and `contour_y_maxima`, together with its embedded variants. + + * src/autofit/afhints.c (af_glyph_hints_done, af_glyph_hints_reload): Handle + new arrays. + +2025-04-15 Werner Lemberg <wl@gnu.org> + + [autofit] Avoid crash. + + Reported as + + https://issues.oss-fuzz.com/issues/410609442 + + * src/autofit/aflatin.c (af_remove_segments_containing_point): Check `edge`. + +2025-04-14 Werner Lemberg <wl@gnu.org> + + [autofit] Fix just introduced heap buffer overflow + + Reported as + + https://issues.oss-fuzz.com/issues/410393975 + + * src/autofit/afadjust.c [!FT_CONFIG_OPTION_USE_HARFBUZZ]: Synchronize with + HarfBuzz code. + +2025-04-14 Werner Lemberg <wl@gnu.org> + + * docs/CHANGES: Mention Craig's GSoC 2023 project. + +2025-04-14 Craig White <gerzytet@gmail.com> + + [autofit] Add GSUB table handling to reverse character map generation. + + If HarfBuzz is enabled, the reverse character map generation now considers + GSUB entries when looking for glyphs that correspond to a code point. + + * src/autofit/afadjust.c (af_all_glyph_variants_helper, + af_all_glyph_variants) [FT_CONFIG_OPTION_USE_HARFBUZZ]: New functions. + + (af_reverse_character_map_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call new + code. + +2025-04-14 Craig White <gerzytet@gmail.com> + + [autofit] Add tilde-unflattening algorithm. + + * src/autofit/aflatin.c (af_find_highest_contour, + af_remove_segments_containing_point, + af_latin_remove_tilde_points_from_edges, af_latin_stretch_tilde, + af_latin_align_tilde): New functions. + (af_latin_hints_apply): Call tilde-unflatting code if necessary. + +2025-04-14 Craig White <gerzytet@gmail.com> + + [autofit] Implement vertical separation adjustment. + + * src/autofit/aflatin.c: Include `afadjust.h`. + (af_latin_metrics_init): Call `af_reverse_character_map_new`. + (af_latin_metrics_done): New function. + + (af_move_contour_vertically, af_check_contour_horizontal_overlap, + af_glyph_hints_apply_vertical_separation_adjustments): New functions. + + (af_latin_hints_apply): Call + `af_glyph_hints_apply_vertical_separation_adjustments`. + + (af_latin_writing_system_class): Updated. + + * src/autofit/aftypes.h (AF_StyleMetricsRec): Add `reverse_charmap` field. + +2025-04-14 Craig White <gerzytet@gmail.com> + + [autofit] Add code for reverse charmaps and adjustment database lookup. + + * src/autofit/aftypes.h (AF_ReverseMapEntry, AF_ReverseCharacterMap): New + structures. + + * src/autofit/afadjust.c (af_adjustment_database_lookup, + af_reverse_character_map_entry_compare, af_reverse_character_map_lookup, + af_lookup_vertical_separation_type, af_lookup_tilde_correction_type, + af_reverse_character_map_expand, af_reverse_character_map_new, + af_reverse_character_map_done): New functions. + + * src/autofit/afadjust.c: Updated. + +2025-04-14 Craig White <gerzytet@gmail.com> + + [autofit] Add adjustment database. + + * src/autofit/afadjust.c, src/autofit/afadjust.h: New files. + + * include/freetype/internal/fttrace.h: Add 'afadjust' component. + + * src/autofit/autofit.c: Include `afadjust.c`. + + * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afadjust.c`. + +2025-04-14 Craig White <gerzytet@gmail.com> + + [base] Make `find_unicode_charmap` a base function. + + This is needed for forthcoming changes in the auto-hinter. + + * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: Updated. + +2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (hdigits): Removed. + + Fixes #1325. + +2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * include/freetype/internal/ftcalc.h (FT_MSB) [__CC_ARM]: Added. + +2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + Typos in macros. + + * include/freetype/internal/ftcalc.h: s/_M_X86/_M_IX86/. + * src/truetype/ttinterp.c: s/_M_X86/_M_IX86/. + +2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * docs/CHANGES: Updated. + +2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base, truetype] Silence UBSAN. + + * src/truetype/ttinterp.c (TT_MulFix14_64): Use unsigned multiplication. + * include/freetype/internal/ftcalc.h (FT_MulFix_64): Ditto. + +2025-04-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base, truetype] Synchronize MulFix assembly. + + * include/freetype/internal/ftcalc.h (FT_MulFix_*), + src/truetype/ttinterp.c (TT_MulFix14_*): Synchronize routines. + +2025-04-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Modernize bytecode projections. + + With 64-bit platforms widely available, it is more efficient to use + 64-bit variables readily. It results in noticeable 10% improvement + in glyph loading speed. + + * src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14) [FT_INT64]: + Prioritize available implementation with arguments adjusted based on + the use cases. + +2025-04-09 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Update FT_MulFix inlining. + + Resolves inconsistencies in 64-bit multiplication discussed in !355. + Importantly, FT_MulFix arguments and return value is FT_Long, + whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or + 4 bytes on Windows. + + * include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed. + (FT_MulFix_64): Generalize and prioritize the inline implementation + for all 64-bit platforms ifdef FT_INT64. + * src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'. + * src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers + to enable its inlining. + +2025-04-09 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Update FT_MulFix inlining. + Resolves inconsistencies in 64-bit multiplication discussed in !355. Importantly, FT_MulFix arguments and return value is FT_Long, whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or 4 bytes on Windows. * include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed. (FT_MulFix_64): Generalize and prioritize the inline implementation + for all 64-bit platforms ifdef FT_INT64. * src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'. * src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers to enable its inlining. + +2025-04-05 Graham Asher <graham.asher@cartotype.com> + + Missing header wrappers. + + * include/freetype/config/integer-types.h, src/smooth/ftgrays.h: + Add missing FT_BEGIN_HEADER and FT_END_HEADER. + * src/smooth/ftgrays.c: Cosmetics. + +2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Clarify callback flow. + + * src/bdf/bdflib.c (bdf_line_func_t_): Modify callback prototype. + (bdf_parse_*_): Updated. + (bdf_load_font, bdf_readstream_): Delay callback initiation. + +2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_readstream_): Relocate. + +2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_is_atom_): Do not check tabs. + +2025-03-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (_bdf_strncmp): Macro removed, callers updated. + +2025-02-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + .gitlab-ci.yml: Minor. + +2025-02-26 Tim-Philipp Müller <tim@centricular.com> + + * .gitlab-ci.yml: Switch to arm64 runners for macOS CI. + +2025-02-25 Behdad Esfahbod <behdad@behdad.org> + + [sfnt/CPAL] Return early if user requested currently-set palette + + Before, we were loading a palette (again and again) even if the + same was requested. Even if the font only had one palette... + + For a font like NotoColorEmoji that has over 5000 colors in its + palette, this was dominating the COLRv1 loading times for HarfBuzz + (and I believe all other clients) because they have to set the + palette to get access to the colors. + + * src/base/ftcolor.c (FT_Palette_Select): Check the current palette. + +2025-01-29 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_start_): Move setup of properties. + +2025-01-25 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Treat all comments uniformly. + + * src/bdf/bdflib.c (bdf_parse_start_): Reject fonts with initial + COMMENTs. + (bdf_parse_properties_): Skip COMMENTs so that... + (bdf_add_property_): Do not make exception for COMMENT. + (bdf_parse_glyphs_, bdf_add_comments): Updated. + +2025-01-25 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (BDF_SWIDTH_ADJ_): Remove clashing flag and update. + +2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_atous_): Remove unnecessary checks. + +2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_ato{i.ul.s.us}_]): Remove uncecessary checks. + +2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Postpone font default char handling. + + * src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling + of the default char until... + * src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties. + +2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Postpone font spacing handling. + + * src/bdf/bdf.h (bdf_font_t): Remove `monowidth`. + * src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling + of the font spacing until... + * src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties. + +2025-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Postpone font ascent and descent handling. + + * src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling + of the font ascent and descent until... + * src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties. + +2025-01-22 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_start_): Relax the header order. + + We now check that the header is complete in no specific order. + +2025-01-20 Chad Brokaw <cbrokaw@gmail.com> + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Fix all shared values. + + Applying cvar deltas to all shared points was incorrectly omitted. + Fixes #1314. + +2025-01-19 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_glyphs_): Fix tracing. + +2025-01-19 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Tokenize input instead of listing. + + Instead of cumbersome field list mamangement, we will tokenize input + using custom `bdf_strtok_`. + + * src/bdf/bdflib.c (bdf_list_t_, bdf_list_init_, bdf_list_ensure_, + bdf_list_shift_, bdf_list_join_, bdf_list_split_, + bdf_set_default_spacing_): Removed. + (bdf_strtok_): New function which NUL-terminates the first token at + the delimiter position and returns the next token that follows + consequtive delimiters. + (bdf_parse_*_, bdf_load_font): Updated. + + * docs/CHANGES: Claim overall 75% performance improvement. + +2025-01-18 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_start_): Prevent another STARTPROPERTIES. + + Only one STARTPROPERTIES was permitted in the old flow preventing + leaks and overflows. + + See https://issues.oss-fuzz.com/issues/389968131 + https://issues.oss-fuzz.com/issues/390464875 + +2025-01-17 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_start_): Do not overwrite flags. + +2025-01-16 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_readstream_): Skip all control characters. + + This agrees with specifications and makes the code a lot simpler. + +2025-01-16 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_start_): Reserve space for artificial properties. + +2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_add_property_): Add extra protection. + + See https://issues.oss-fuzz.com/issues/389972472 + https://issues.oss-fuzz.com/issues/389968131 + +2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c: Clean up. + +2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Use flags instead of options. + + * src/bdf/bdf.h (bdf_options_t): Removed. + (BDF_KEEP_COMMENTS, BDF_KEEP_UNENCODED, BDF_CORRECT_METRICS): Updated + to avoid collisions with the other parsing flags. + * src/bdf/bdfdrivr.c (BDF_Face_Init): Use default flags explicitly. + * src/bdf/bdflib.c (bdf_load_font): Use flags as an argument to + initialize the parser. + (bdf_set_fedault_spacing_): Default to BDF_PROPORTIONAL explicitly. + (bdf_parse_*_): Updated. + +2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Adjust parsing flow and CHARS handling. + + * src/bdf/bdflib.c (bdf_readstream_): Remove CHARS exception. + (bdf_parse_glyphs_): Move glyphs allocation... + (bdf_parse_properties_): and missing ascent and descent handling... + (bdf_parse_start_): ...to here under CHARS. + +2025-01-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_readstream_): Tweak variables and loop design. + +2025-01-13 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_glyphs_): Free unused glyph_name. + + See https://issues.oss-fuzz.com/issues/389330334. + +2025-01-13 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_glyphs_): Store glyph as soon as possible. + +2025-01-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_glyphs_): Avoid possible leak. + +2025-01-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf] Speed up bitmap parsing. + + A dedicated parser of bitmap data with minimal error checking and + no string comparisons helps to improve performance. + + * src/bdf/bdflib.c (bdf_parse_bitmap_): New dedicated bitmap parser. + (bdf_parse_glyphs_): Pass to `bdf_parse_bitmap_` on BITMAP. + +2025-01-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (a2i): Formatting. + +2025-01-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_*_): Minor improvements. + +2025-01-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdf.h (bdf_font_t): Correct `internal` type. + * src/bdf/bdflib.c (*): Update users. + +2025-01-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + * builds/windows/ftsystem.c: Fix ancient condition. + +2025-01-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/bdf/bdflib.c (bdf_parse_start_): Fix tracing labels. + +2025-01-09 Alexei Podtelezhnikov <apodtele@gmail.com> + + * MSBuild.rsp: Force console color for mintty. + +2025-01-09 Heiko Lewin <hlewin@worldiety.de> + + * CMakeLists.txt: Use modern IMPORTED targets. + + This resolves build problems with newer libPNG versions by switching + to using IMPORTED CMake targets for common libraries where provided. + To do this the required CMake version is raised to version 3.12. + Doing this seems justified as using IMPORTED targets is a cleaner + and more powerful solution that can leverage advanced and CMake-specific + features that may be utilized by the referred dependencies' CMake modules. + + Resolves #1311. + +2025-01-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + [cff] Remove size/slot checks. + + After the previous commit, cff_glyph_load is no longer called + without first checking for valid size and glyph objects in + FT_Glyph_Load and these checks can be removed downstream. + + * src/cff/cffdrivr.c (cff_glyph_load): Remove `size` and `glyph` checks. + * src/cff/cffgload.c (cff_slot_load): Ditto. + +2025-01-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/cff/cffdrivr.c (cff_get_advances): Do only fast advances. + + Otherwise, let TT_Get_Advances fall back on cff_load_glyph to do + slow advances. This avoids unchecked access to cff_load_glyph and + this is how tt_get_advances is implemented. + +2025-01-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttgload.c (TT_Load_Glyph): Consolidate flag setting. + +2025-01-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + Delay FT_GLYPH_FORMAT_OUTLINE assignmets. + + This assignmets used to be done prematurely before errors were checked + and outlines were actually loaded. Delaying the assignment provides + certain protection against careless usage of malformed input that + should now remain FT_GLYPH_FORMAT_NONE. + + * src/cff/cffgload.c (cff_slot_load): Ditto. + * src/cid/cidgload.c (cid_slot_load_glyph): Ditto. + * src/pfr/pfrobjs.c (pfr_slot_load): Ditto. + * src/truetype/ttgload.c (TT_Load_Glyph): Ditto. + * src/type1/t1gload.c (T1_Load_Glyph): Ditto. + +2025-01-03 Alexei Podtelezhnikov <apodtele@gmail.com> + + * builds/compiler/gcc-dev.mk: Silence some warnings. + +2025-01-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + Remove superfluous outline zeroing. + + This is already done by `ft_glyphslot_clear`. + + * src/cff/cffgload.c (cff_slot_load): Do not zero outline fields. + * src/cid/cidgload.c (cid_slot_load_glyph: Ditto. + * src/pfr/pfrobjs.c (pfr_slot_load): Ditto. + * src/truetype/ttgload.c (load_sbit_image): Ditto. + * src/type1/t1gload.c (T1_Load_Glyph): Ditto. + +2025-01-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttobjs.c: Abbreviate tracing. + +2025-01-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Refactor `flip`. + +2025-01-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Consolidate bitmap strike handling. + + * src/truetype/ttgload.c (TT_Load_Glyph): Relocate omitted whitespace + strike handling from here... + (load_sbit_image): ... to here. + +2024-12-31 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Ingnore FT_LOAD_NO_BITMAP in bitmap-only fonts. + + For consistency with other bitmap-only fonts, we should ignore this + flag of the font is not scalable. + + * src/truetype/ttgload.c (TT_Load_Glyph): Check if face is scalable + when checking for FT_LOAD_NO_BITMAP. + + * docs/CHANGES: Start new chapter wtith this change. + +2024-12-16 Ben Wagner <bungeman@chromium.org> + + [ftstroke] Fix invalid pointer assignement to `arc` + + In `FT_Stroker_ConicTo` and `FT_Stroker_CubicTo` there is a `bez_stack`. + `arc` is initialized with `arc = bez_stack` and is never set to point + into any different object. The main loop looks like `while ( arc >= + bez_stack )` which is depending on a later `arc -= 2` (or `arc -= 3`) to + make `arc` point to before `bez_stack`. However, using pointer + subtraction to make `arc` point outside the array is undefined behavior, + and attempting to use the value in the loop predicate is "very" + undefined behavior. (C99 "Additive operators" 6.5.6.8.) + + This particular undefined behavior was discovered as either hangs or + MemorySantizer issues after "[InstCombine] Infer nuw for gep inbounds + from base of object" [0]. With this change, clang can infer that `arc` + must always point into the `bez_stack` object and therefore cannot be at + a "negative index" so the predicate is always true. + + [0] https://github.com/llvm/llvm-project/commit/e21ab4d16b555c28ded307571d138f594f33e325 + + * src/base/ftstroke.c (FT_Stroker_ConicTo, FT_Stroker_CubicTo): test + loop exit condition (there are no more arcs to process) before + decrementing `arc` + + Fixes: #1307 + +2024-12-04 Ben Wagner <bungeman@chromium.org> + + [cff] Fix leak of cmap data + + When `sfnt->load_face` succeeds it has already loaded any (optional) + cmap data. As a result, a subsequent call to `sfnt->load_cmap` will + overwrite the cmap data pointer with a new copy of the data but not free + the old, leading to a leak. + + This is a fix for "* src/cff/cffobjs.c (cff_face_init): Better handling + of Type0 fonts.". This still allows the cmap to be missing but avoids + the leak by only calling `sfnt->load_cmap` when there is no `head` + table (the font data is not being loaded as OpenType/CFF). + + * src/cff/cffobjs.c (cff_face_init): Fix leak + + Fixes: #1306 + +2024-11-06 Honnesh Ramachandra <hramachandra@adobe.com> + + * src/cff/cffobjs.c (cff_face_init): Better handling of Type0 fonts. + + This issue relates to the PDF specification and its usage of CFF-based + embedded Type0 fonts. For Type0 fonts containing CID-keyed descendant + CFF-based fonts, the glyph index is the CID present in the content stream. + As a result, there is no requirement for a 'cmap' table to be present in the + font since the glyph indices are derived directly from the CIDs. FreeType + throws an error when it doesn’t find a 'cmap' table for such an Open Type + font containing CFF outlines. This commit relaxes this requirement for a + 'cmap' table for such fonts. + +2024-10-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + Download the latest gnu-config files in `make dist`. + + * builds/toplevel.mk: In `make dist`, checkout gnu-config + git repository at savannah, copy the latest versions of + `config.guess` and `config.sub` to builds/unix/. Also + the latest version of `gitlog-to-changelog` is used to + generate `ChangeLog`. + +2024-10-16 Behdad Esfahbod <behdad@behdad.org> + + Move generic destroy to later in the face and size destruction. + + * src/base/ftobjs.c (destroy_size, destroy_face): This is such that the + generic destroy can be used to call `FT_Done_Library`. For that to work, + it needs to call it *after* having removed the face from the respective + module. + +2024-10-14 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttgload.c (load_truetype_glyph): Rearrange. + +2024-10-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + * autogen.sh: Fix for Solaris 10. + + o Replace `test -e` by `test -d` (directory) and `-h` + (symlink), because pre-POSIX /bin/sh of Solaris 10 + does not support `test -e`. + o Replace the combination of `head` and `sed ...` by + single sed command `sed -n 1...p`. GNU libtoolize + with Solaris 10 /bin/sh complains "Broken Pipe" for + the closure of stdout by `head`. Let `sed` receive + all stdout and discard. + +2024-10-13 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/smooth/ftgrays.c (gray_convert_glyph): Clear stack pointers. + + Fixes a dangling pointer warning, see #1299. + +2024-10-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + apinames: Fix a buffer overrun for VMS platform. + + Some output formats may rewrite symbol names during the output, + like the concatenation of "64__" suffix on VMS. To estimate + sufficient size to store symbol name, pass the output format + info to `names_add`. For VMS, `names_add` allocates longer + buffer to append "64__". + + * apinames.c (SUFFIX_VMS_64ADDR): New macro of "64__". + (main): Pass the format info to `read_header_file`. + (read_header_file): Pass the format info to `names_add`. + (names_add): Receive the format info, and reserve the symbol + name buffer 4 byte longer in the case of VMS, to append the + suffix in `names_dump`. + +2024-10-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + apinames: Fix out-of-scope reference of a static array. + + * apinames.c (names_dump): For WATCOM_LBC format, the + DLL name with no suffix is constructed on a static + array temp[], but the scope is closed before use it. + The declaration of temp[] is moved to the wider + scope for the dumping part to refer it. + +2024-10-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * vms_make.com: Format rules. + + Use tabs in rules only à la Makefile. + +2024-10-12 Marian Klymov <nekto1989@gmail.com> + + * meson.build: Define DLL_EXPORT for shared library only. + + Fixes #1298. + +2024-10-12 Benoit Pierre <benoit.pierre+freedesktop@gmail.com> + + * meson.build: Minor improvements. + +2024-10-12 Benoit Pierre <benoit.pierre+freedesktop@gmail.com> + + * meson.build: Fix `bzip2` option handling. + +2024-10-12 Benoit Pierre <benoit.pierre+freedesktop@gmail.com> + + * meson.build: Add support for compiling with error strings. + * meson_options.txt: Document it. + +2024-10-10 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + Fix help message of apinames. + + * src/tools/apinames.c: The first header file must be + given after the options. All arguments after the + first header file are dealt as header files to be + parsed, regardless with their leading "-". + + For example, + "apinames include/freetype/freetype.h -dFREETYPE.DLL" + warns "unable to open -dFREETYPE.DLL". + + Thus, the "header1" must be given after the arguments + to be parsed as the options. + +2024-09-21 Jouk Jansen <joukj@hrem.nano.tudelft.nl> + + Minor fixes for OpenVMS. + + * vms_name.com: Suppress a warning with the latest Clang compiler. + + * builds/vms/apinames_vms.bash: Use absolute path to avoid dependency on the + environment. + +2024-09-07 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Respect metrics_only. + + Also fixes recursive flip. + +2024-09-06 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Tweak loop. + +2024-09-06 Andrew Murray <radarhere@users.noreply.github.com> + + [sfnt] Support sbix graphicType 'flip'. + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Currently undocumented by + Apple, this flips the bitmap data horizontally. It is used on macOS in + Apple Color Emoji; 19.4d6e1; 2024-02-05 (file `Apple Color Emoji.ttc`). + + Fixes issue #1282. + +2024-09-05 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + Add `clang` to host compiler candidates in cross building. + + * builds/unix/configure.raw: In cross building, + `clang` is tried if there is no `gcc`, nor `cc`. + +2024-09-05 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + Improve the build rule for `apinames`. + + * builds/unix/configure.raw: copy `CFLAGS` & + `LDFLAGS` values to `CFLAGS_BUILD` & + `LDFLAGS_BUILD`, in a self-hosting case. + + * builds/unix/unix-cc.in: set `CCexe_CFLAGS` & + `CCexe_LDFLAGS` by `CFLAGS_BUILD` & + `LDFLAGS_BUILD`. + + In some confused environments, simple building + like `cc -o apinames apinames.c` is no longer + able to build an executable running on the host. + + The validity of `CC` is tested with consideration + of `CFLAGS` and `LDFLAGS`, thus, duplicating + `CFLAGS` & `LDFLAGS` to `CCexe_CFLAGS` & + `CCexe_LDFLAGS` (via XXX_BUILD) would be slightly + safer in a self-hosting build. + + Fixes the issue #1296. + +2024-08-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/ttcmap.c (tt_cmap*_get_info): Remove casting. + +2024-08-25 Alexei Podtelezhnikov <apodtele@gmail.com> + + * include/freetype/ftimage.h (FT_Bitmap): Describe empty bitmap. + +2024-08-14 luz paz <luzpaz@github.com> + + Fix various typos. + +2024-08-13 Alexei Podtelezhnikov <apodtele@gmail.com> + + * messon.build: Install `include/freetype/ftlogging.h`. + + Fixes #1292. + 2024-08-12 Werner Lemberg <wl@gnu.org> * Version 2.13.3 released. diff --git a/modules/freetype2/LICENSE.TXT b/modules/freetype2/LICENSE.TXT @@ -35,9 +35,10 @@ in earlier FreeType versions. The gzip module uses the zlib license (see `src/gzip/zlib.h`) which too is compatible to the above two licenses. -The files `src/autofit/ft-hb.c` and `src/autofit/ft-hb.h` contain code -taken almost verbatim from the HarfBuzz file `hb-ft.cc`, which uses -the 'Old MIT' license, compatible to the above two licenses. +The files `src/autofit/ft-hb-ft.c`, `src/autofit/ft-hb-decls.h`, +`src/autofit/ft-hb-types.h`, and `src/autofit/hb-script-list.h` +contain code taken (almost) verbatim from the HarfBuzz library, which +uses the 'Old MIT' license compatible to the above two licenses. The MD5 checksum support (only used for debugging in development builds) is in the public domain. diff --git a/modules/freetype2/MSBuild.rsp b/modules/freetype2/MSBuild.rsp @@ -1,2 +1,4 @@ +# MSBuild.rsp with default command-line switches +/clp:ForceConsoleColor +/p:Configuration=Release #/p:WindowsTargetPlatformVersion=10.0.16299.0 -/p:Configuration="Release" diff --git a/modules/freetype2/MSBuild.sln b/modules/freetype2/MSBuild.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio Express 2012 for Windows Desktop +# Visual Studio 2010 or later # # You can build FreeType with MSBuild as follows # diff --git a/modules/freetype2/Makefile b/modules/freetype2/Makefile @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/README b/modules/freetype2/README @@ -1,7 +1,7 @@ -FreeType 2.13.3 +FreeType 2.14.1 =============== -Homepage: https://www.freetype.org +Homepage: https://freetype.org FreeType is a freely available software library to render fonts. @@ -13,7 +13,7 @@ Please read the `docs/CHANGES` file, it contains IMPORTANT INFORMATION. Read the files `docs/INSTALL*` for installation instructions; see the -file `docs/LICENSE.TXT` for the available licenses. +file `LICENSE.TXT` for the available licenses. For using FreeType's git repository instead of a distribution bundle, please read file `README.git`. Note that you have to actually clone @@ -32,13 +32,13 @@ sites. Go to and download one of the following files. - freetype-doc-2.13.3.tar.xz - freetype-doc-2.13.3.tar.gz - ftdoc2133.zip + freetype-doc-2.14.1.tar.xz + freetype-doc-2.14.1.tar.gz + ftdoc2141.zip To view the documentation online, go to - https://www.freetype.org/freetype2/docs/ + https://freetype.org/freetype2/docs/ Mailing Lists @@ -54,7 +54,7 @@ e-mail lists. The lists are moderated; see - https://www.freetype.org/contact.html + https://freetype.org/contact.html how to subscribe. @@ -85,7 +85,7 @@ FreeType! Details on the process can be found here: - https://www.freetype.org/developer.html#patches + https://freetype.org/developer.html#patches Enjoy! @@ -94,7 +94,7 @@ Enjoy! ---------------------------------------------------------------------- -Copyright (C) 2006-2024 by +Copyright (C) 2006-2025 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/README.git b/modules/freetype2/README.git @@ -89,7 +89,7 @@ address: ---------------------------------------------------------------------- -Copyright (C) 2005-2024 by +Copyright (C) 2005-2025 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/README.moz-patches b/modules/freetype2/README.moz-patches @@ -1,5 +1,5 @@ -This directory contains FreeType v2.13.3 downloaded from +This directory contains FreeType v2.14.1 downloaded from https://download.savannah.gnu.org/releases/freetype/ -No post-2.13.3 commits have been cherry-picked from the upstream FreeType +No post-2.14.1 commits have been cherry-picked from the upstream FreeType repository at this time. diff --git a/modules/freetype2/autogen.sh b/modules/freetype2/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2005-2024 by +# Copyright (C) 2005-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -99,7 +99,7 @@ check_tool_version () if test "$field"x = x; then field=3 # default to 3 for all GNU autotools, after filtering enclosed string fi - version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field` + version=`$1 --version | sed -n '1s/([^)]*)/()/gp' | cut -d ' ' -f $field` version_check=`compare_to_minimum_version $version $4` if test "$version_check"x = 0x; then echo "ERROR: Your version of the \`$2' tool is too old." @@ -182,7 +182,7 @@ copy_submodule_files () cp $DLG_SRC_DIR/* src/dlg } -if test -e ".git"; then +if test -d ".git" -o -h ".git"; then DLG_INC_DIR=subprojects/dlg/include/dlg DLG_SRC_DIR=subprojects/dlg/src/dlg diff --git a/modules/freetype2/builds/amiga/README b/modules/freetype2/builds/amiga/README @@ -1,7 +1,7 @@ README for the builds/amiga subdirectory. -Copyright (C) 2005-2024 by +Copyright (C) 2005-2025 by Werner Lemberg and Detlef Würkner. This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/amiga/include/config/ftconfig.h b/modules/freetype2/builds/amiga/include/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific configuration file (specification only). */ /* */ -/* Copyright (C) 2005-2024 by */ +/* Copyright (C) 2005-2025 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/builds/amiga/include/config/ftmodule.h b/modules/freetype2/builds/amiga/include/config/ftmodule.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType module selection. */ /* */ -/* Copyright (C) 2005-2024 by */ +/* Copyright (C) 2005-2025 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/builds/amiga/makefile b/modules/freetype2/builds/amiga/makefile @@ -5,7 +5,7 @@ # -# Copyright (C) 2005-2024 by +# Copyright (C) 2005-2025 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/amiga/makefile.os4 b/modules/freetype2/builds/amiga/makefile.os4 @@ -4,7 +4,7 @@ # -# Copyright (C) 2005-2024 by +# Copyright (C) 2005-2025 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/amiga/smakefile b/modules/freetype2/builds/amiga/smakefile @@ -3,7 +3,7 @@ # -# Copyright (C) 2005-2024 by +# Copyright (C) 2005-2025 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/amiga/src/base/ftdebug.c b/modules/freetype2/builds/amiga/src/base/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for amiga (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, Werner Lemberg, and Detlef Wuerkner. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/builds/amiga/src/base/ftsystem.c b/modules/freetype2/builds/amiga/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType low-level system interface (body). */ /* */ -/* Copyright (C) 1996-2024 by */ +/* Copyright (C) 1996-2025 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/builds/ansi/ansi-def.mk b/modules/freetype2/builds/ansi/ansi-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/ansi/ansi.mk b/modules/freetype2/builds/ansi/ansi.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/beos/beos-def.mk b/modules/freetype2/builds/beos/beos-def.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/beos/beos.mk b/modules/freetype2/builds/beos/beos.mk @@ -2,7 +2,7 @@ # FreeType 2 configuration rules for a BeOS system # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/beos/detect.mk b/modules/freetype2/builds/beos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/cmake/FindBrotliDec.cmake b/modules/freetype2/builds/cmake/FindBrotliDec.cmake @@ -1,6 +1,6 @@ # FindBrotliDec.cmake # -# Copyright (C) 2019-2024 by +# Copyright (C) 2019-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by Werner Lemberg <wl@gnu.org> diff --git a/modules/freetype2/builds/cmake/FindHarfBuzz.cmake b/modules/freetype2/builds/cmake/FindHarfBuzz.cmake @@ -28,8 +28,8 @@ # Try to find Harfbuzz include and library directories. # # After successful discovery, this will set for inclusion where needed: -# HarfBuzz_INCLUDE_DIRS - containg the HarfBuzz headers -# HarfBuzz_LIBRARIES - containg the HarfBuzz library +# HarfBuzz_INCLUDE_DIRS - containing the HarfBuzz headers +# HarfBuzz_LIBRARIES - containing the HarfBuzz library #[=======================================================================[.rst: FindHarfBuzz diff --git a/modules/freetype2/builds/cmake/iOS.cmake b/modules/freetype2/builds/cmake/iOS.cmake @@ -1,6 +1,6 @@ # iOS.cmake # -# Copyright (C) 2014-2024 by +# Copyright (C) 2014-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by David Wimsey <david@wimsey.us> diff --git a/modules/freetype2/builds/cmake/testbuild.sh b/modules/freetype2/builds/cmake/testbuild.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -# Copyright (C) 2015-2024 by +# Copyright (C) 2015-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/ansi-cc.mk b/modules/freetype2/builds/compiler/ansi-cc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/bcc-dev.mk b/modules/freetype2/builds/compiler/bcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/bcc.mk b/modules/freetype2/builds/compiler/bcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/emx.mk b/modules/freetype2/builds/compiler/emx.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2024 by +# Copyright (C) 2003-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/gcc-dev.mk b/modules/freetype2/builds/compiler/gcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -76,6 +76,7 @@ ifndef CFLAGS -Wpointer-arith \ -Wwrite-strings \ -Wredundant-decls \ + -Wno-format-extra-args \ -Wno-long-long \ $(nested_externs) \ $(strict_prototypes) diff --git a/modules/freetype2/builds/compiler/gcc.mk b/modules/freetype2/builds/compiler/gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/intelc.mk b/modules/freetype2/builds/compiler/intelc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/unix-lcc.mk b/modules/freetype2/builds/compiler/unix-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/visualage.mk b/modules/freetype2/builds/compiler/visualage.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/visualc.mk b/modules/freetype2/builds/compiler/visualc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/watcom.mk b/modules/freetype2/builds/compiler/watcom.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/compiler/win-lcc.mk b/modules/freetype2/builds/compiler/win-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/detect.mk b/modules/freetype2/builds/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/dos/detect.mk b/modules/freetype2/builds/dos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/dos/dos-def.mk b/modules/freetype2/builds/dos/dos-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/dos/dos-emx.mk b/modules/freetype2/builds/dos/dos-emx.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2024 by +# Copyright (C) 2003-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/dos/dos-gcc.mk b/modules/freetype2/builds/dos/dos-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/dos/dos-wat.mk b/modules/freetype2/builds/dos/dos-wat.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2024 by +# Copyright (C) 2003-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/exports.mk b/modules/freetype2/builds/exports.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2005-2024 by +# Copyright (C) 2005-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/freetype.mk b/modules/freetype2/builds/freetype.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/link_dos.mk b/modules/freetype2/builds/link_dos.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/link_std.mk b/modules/freetype2/builds/link_std.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/mac/ftmac.c b/modules/freetype2/builds/mac/ftmac.c @@ -5,7 +5,7 @@ /* Mac FOND support. Written by just@letterror.com. */ /* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */ /* */ -/* Copyright (C) 1996-2024 by */ +/* Copyright (C) 1996-2025 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/modules/freetype2/builds/meson/extract_freetype_version.py b/modules/freetype2/builds/meson/extract_freetype_version.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/meson/extract_libtool_version.py b/modules/freetype2/builds/meson/extract_libtool_version.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/meson/generate_reference_docs.py b/modules/freetype2/builds/meson/generate_reference_docs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/meson/parse_modules_cfg.py b/modules/freetype2/builds/meson/parse_modules_cfg.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/meson/process_ftoption_h.py b/modules/freetype2/builds/meson/process_ftoption_h.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/modules.mk b/modules/freetype2/builds/modules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/os2/detect.mk b/modules/freetype2/builds/os2/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/os2/os2-def.mk b/modules/freetype2/builds/os2/os2-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/os2/os2-dev.mk b/modules/freetype2/builds/os2/os2-dev.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/os2/os2-gcc.mk b/modules/freetype2/builds/os2/os2-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/symbian/bld.inf b/modules/freetype2/builds/symbian/bld.inf @@ -2,7 +2,7 @@ // FreeType 2 project for the symbian platform // -// Copyright (C) 2008-2024 by +// Copyright (C) 2008-2025 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/symbian/freetype.mmp b/modules/freetype2/builds/symbian/freetype.mmp @@ -2,7 +2,7 @@ // FreeType 2 makefile for the symbian platform // -// Copyright (C) 2008-2024 by +// Copyright (C) 2008-2025 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/toplevel.mk b/modules/freetype2/builds/toplevel.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -274,12 +274,16 @@ dist: # GNU `config' git repository), relative to the `tmp' directory used during # `make dist'. # -CONFIG_GUESS = ~/git/config/config.guess -CONFIG_SUB = ~/git/config/config.sub +# GNU_CONFIG_GIT_URL = git://git.savannah.gnu.org/config.git +GNU_CONFIG_GIT_URL = https://git.savannah.gnu.org/git/config.git +GNU_CONFIG_DESTDIR = $(TOP_DIR)/subprojects/gnu-config + +CONFIG_GUESS = $(GNU_CONFIG_DESTDIR)/config.guess +CONFIG_SUB = $(GNU_CONFIG_DESTDIR)/config.sub # We also use this repository to access the gnulib script that converts git # commit messages to a ChangeLog file. -CHANGELOG_SCRIPT = ~/git/config/gitlog-to-changelog +CHANGELOG_SCRIPT = $(GNU_CONFIG_DESTDIR)/gitlog-to-changelog # Don't say `make do-dist'. Always use `make dist' instead. @@ -295,6 +299,8 @@ do-dist: distclean refdoc sh autogen.sh rm -rf $(TOP_DIR)/builds/unix/autom4te.cache + rm -rf $(GNU_CONFIG_DESTDIR) + git clone --depth=1 $(GNU_CONFIG_GIT_URL) $(GNU_CONFIG_DESTDIR) cp $(CONFIG_GUESS) $(TOP_DIR)/builds/unix cp $(CONFIG_SUB) $(TOP_DIR)/builds/unix @@ -312,5 +318,6 @@ do-dist: distclean refdoc @# Remove more stuff related to git. rm -rf $(TOP_DIR)/subprojects/dlg + rm -rf $(TOP_DIR)/subprojects/gnu-config # EOF diff --git a/modules/freetype2/builds/unix/aclocal.m4 b/modules/freetype2/builds/unix/aclocal.m4 @@ -14,7 +14,7 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software +# Copyright (C) 1996-2001, 2003-2019, 2021-2024 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # @@ -23,13 +23,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl -# Copyright (C) 2014 Free Software Foundation, Inc. +# Copyright (C) 2024 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you @@ -46,7 +46,7 @@ m4_define([_LT_COPYING], [dnl # along with this program. If not, see <http://www.gnu.org/licenses/>. ]) -# serial 59 LT_INIT +# serial 63 LT_INIT # LT_PREREQ(VERSION) @@ -74,7 +74,7 @@ esac # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], -[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +[AC_PREREQ([2.64])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl @@ -624,7 +624,7 @@ m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation +# AC_OUTPUT is called), in case it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} @@ -659,9 +659,9 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. -Copyright (C) 2011 Free Software Foundation, Inc. +Copyright (C) 2024 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." +gives unlimited permission to copy, distribute and modify it." while test 0 != $[#] do @@ -738,7 +738,6 @@ _LT_CONFIG_SAVE_COMMANDS([ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. @@ -981,6 +980,7 @@ _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE + # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ @@ -1031,6 +1031,21 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ rm -f conftest.* fi]) + # Feature test to disable chained fixups since it is not + # compatible with '-undefined dynamic_lookup' + AC_CACHE_CHECK([for -no_fixup_chains linker flag], + [lt_cv_support_no_fixup_chains], + [ save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-no_fixup_chains" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([],[])], + lt_cv_support_no_fixup_chains=yes, + lt_cv_support_no_fixup_chains=no + ) + LDFLAGS=$save_LDFLAGS + ] + ) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no @@ -1055,7 +1070,7 @@ _LT_EOF echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF -int main() { return 0;} +int main(void) { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err @@ -1080,13 +1095,32 @@ _LT_EOF 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' + if test yes = "$lt_cv_support_no_fixup_chains"; then + AS_VAR_APPEND([_lt_dar_allow_undefined], [' $wl-no_fixup_chains']) + fi + ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi + _lt_dar_needs_single_mod=no + case $host_os in + rhapsody* | darwin1.*) + _lt_dar_needs_single_mod=yes ;; + darwin*) + # When targeting Mac OS X 10.4 (darwin 8) or later, + # -single_module is the default and -multi_module is unsupported. + # The toolchain on macOS 10.14 (darwin 18) and later cannot + # target any OS version that needs -single_module. + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*-darwin[[567]].*|10.[[0-3]],*-darwin[[5-9]].*|10.[[0-3]],*-darwin1[[0-7]].*) + _lt_dar_needs_single_mod=yes ;; + esac + ;; + esac if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else @@ -1132,7 +1166,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], -[ if test yes != "$lt_cv_apple_cc_single_mod"; then +[ if test yes = "$_lt_dar_needs_single_mod" -a yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi @@ -1262,7 +1296,9 @@ lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` + # Trim trailing / since we'll always append absolute paths and we want + # to avoid //, if only for less confusing output for the user. + lt_sysroot=`$CC --print-sysroot 2>/dev/null | $SED 's:/\+$::'` fi ;; #( /*) @@ -1374,7 +1410,7 @@ mips64*-*linux*) ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) +s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when @@ -1389,7 +1425,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" @@ -1418,7 +1454,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) @@ -1501,7 +1537,7 @@ _LT_DECL([], [AR], [1], [The archiver]) # Use ARFLAGS variable as AR's operation code to sync the variable naming with # Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have -# higher priority because thats what people were doing historically (setting +# higher priority because that's what people were doing historically (setting # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS # variable obsoleted/removed. @@ -1551,7 +1587,7 @@ AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) -AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_REQUIRE([AC_PROG_RANLIB]) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) @@ -1562,15 +1598,8 @@ old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in @@ -1702,14 +1731,14 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. + gnu* | ironclad*) + # Under GNU Hurd and Ironclad, this test is not required because there + # is no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, @@ -1731,7 +1760,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -1891,11 +1920,11 @@ else /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); +int fnord (void) __attribute__((visibility("default"))); #endif -int fnord () { return 42; } -int main () +int fnord (void) { return 42; } +int main (void) { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; @@ -1952,7 +1981,7 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32* | cegcc*) + mingw* | windows* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; @@ -2320,7 +2349,7 @@ if test yes = "$GCC"; then *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + mingw* | windows* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` @@ -2378,7 +2407,7 @@ BEGIN {RS = " "; FS = "/|\n";} { # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + mingw* | windows* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` @@ -2453,7 +2482,7 @@ aix[[4-9]]*) # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # linker flag in LDFLAGS as well, or --enable-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the @@ -2547,7 +2576,7 @@ bsdi[[45]]*) # libtool to hard-code these into programs ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no @@ -2558,15 +2587,29 @@ cygwin* | mingw* | pw32* | cegcc*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' + # If user builds GCC with multilib enabled, + # it should just install on $(libdir) + # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones. + if test xyes = x"$multilib"; then + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + $install_prog $dir/$dlname $destdir/$dlname~ + chmod a+x $destdir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib $destdir/$dlname'\'' || exit \$?; + fi' + else + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + fi postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' @@ -2579,7 +2622,7 @@ cygwin* | mingw* | pw32* | cegcc*) m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; - mingw* | cegcc*) + mingw* | windows* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; @@ -2598,7 +2641,7 @@ m4_if([$1], [],[ library_names_spec='$libname.dll.lib' case $build_os in - mingw*) + mingw* | windows*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' @@ -2705,7 +2748,21 @@ freebsd* | dragonfly* | midnightbsd*) need_version=yes ;; esac - shlibpath_var=LD_LIBRARY_PATH + case $host_cpu in + powerpc64) + # On FreeBSD bi-arch platforms, a different variable is used for 32-bit + # binaries. See <https://man.freebsd.org/cgi/man.cgi?query=ld.so>. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[int test_pointer_size[sizeof (void *) - 5]; + ]])], + [shlibpath_var=LD_LIBRARY_PATH], + [shlibpath_var=LD_32_LIBRARY_PATH]) + ;; + *) + shlibpath_var=LD_LIBRARY_PATH + ;; + esac case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes @@ -2735,8 +2792,9 @@ haiku*) soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes + sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' + sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' + hardcode_into_libs=no ;; hpux9* | hpux10* | hpux11*) @@ -2846,7 +2904,7 @@ linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext' + library_names_spec='$libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH @@ -2858,8 +2916,9 @@ linux*android*) hardcode_into_libs=yes dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + # -rpath works at least for libraries that are not overridden by + # libraries installed in system locations. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; # This must be glibc/ELF. @@ -2893,7 +2952,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # before this can be enabled. hardcode_into_libs=yes - # Ideally, we could use ldconfig to report *all* directores which are + # Ideally, we could use ldconfig to report *all* directories which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, @@ -2913,6 +2972,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -2931,6 +3002,18 @@ netbsd*) hardcode_into_libs=yes ;; +*-mlibc) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='mlibc ld.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' @@ -2950,7 +3033,7 @@ newsos6) dynamic_linker='ldqnx.so' ;; -openbsd* | bitrig*) +openbsd*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no @@ -3010,6 +3093,17 @@ rdos*) dynamic_linker=no ;; +serenity*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + dynamic_linker='SerenityOS LibELF' + ;; + solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -3107,6 +3201,21 @@ uts4*) shlibpath_var=LD_LIBRARY_PATH ;; +emscripten*) + version_type=none + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + dynamic_linker="Emscripten linker" + _LT_COMPILER_PIC($1)='-fPIC' + _LT_TAGVAR(archive_cmds, $1)='$CC -sSIDE_MODULE=2 -shared $libobjs $deplibs $compiler_flags -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -sSIDE_MODULE=2 -shared $libobjs $deplibs $compiler_flags -o $lib -s EXPORTED_FUNCTIONS=@$output_objdir/$soname.expsym' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(no_undefined_flag, $1)= + ;; + *) dynamic_linker=no ;; @@ -3282,7 +3391,7 @@ if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in - *-*-mingw*) + *-*-mingw* | *-*-windows*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) @@ -3391,7 +3500,7 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi @@ -3463,7 +3572,6 @@ lt_cv_deplibs_check_method='unknown' # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure @@ -3490,7 +3598,7 @@ cygwin*) lt_cv_file_magic_cmd='func_win32_libid' ;; -mingw* | pw32*) +mingw* | windows* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. @@ -3499,7 +3607,7 @@ mingw* | pw32*) lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; @@ -3572,7 +3680,11 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +*-mlibc) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -3590,7 +3702,7 @@ newos6*) lt_cv_deplibs_check_method=pass_all ;; -openbsd* | bitrig*) +openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else @@ -3606,6 +3718,10 @@ rdos*) lt_cv_deplibs_check_method=pass_all ;; +serenity*) + lt_cv_deplibs_check_method=pass_all + ;; + solaris*) lt_cv_deplibs_check_method=pass_all ;; @@ -3654,7 +3770,7 @@ file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in - mingw* | pw32*) + mingw* | windows* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else @@ -3706,7 +3822,7 @@ else # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; + mingw* | windows*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in @@ -3797,7 +3913,7 @@ lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in @@ -3829,16 +3945,16 @@ _LT_DECL([], [sharedlib_from_linklib_cmd], [1], m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_manifest_tool], + [lt_cv_path_manifest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes + lt_cv_path_manifest_tool=yes fi rm -f conftest*]) -if test yes != "$lt_cv_path_mainfest_tool"; then +if test yes != "$lt_cv_path_manifest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl @@ -3867,7 +3983,7 @@ AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-mingw* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) @@ -3942,7 +4058,7 @@ case $host_os in aix*) symcode='[[BCDT]]' ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) @@ -3957,7 +4073,7 @@ osf*) symcode='[[BCDEGQRST]]' ;; solaris*) - symcode='[[BDRT]]' + symcode='[[BCDRT]]' ;; sco3.2v5*) symcode='[[DT]]' @@ -4021,7 +4137,7 @@ $lt_c_name_lib_hook\ # Handle CRLF in mingw tool chain opt_cr= case $build_os in -mingw*) +mingw* | windows*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac @@ -4072,13 +4188,14 @@ void nm_test_func(void){} #ifdef __cplusplus } #endif -int main(){nm_test_var='a';nm_test_func();return(0);} +int main(void){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -4248,7 +4365,7 @@ m4_if([$1], [CXX], [ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) + mingw* | windows* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style @@ -4324,7 +4441,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) + mingw* | windows* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], @@ -4450,7 +4567,9 @@ m4_if([$1], [CXX], [ ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) + ;; + *-mlibc) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -4480,6 +4599,8 @@ m4_if([$1], [CXX], [ ;; psos*) ;; + serenity*) + ;; solaris*) case $cc_basename in CC* | sunCC*) @@ -4572,7 +4693,7 @@ m4_if([$1], [CXX], [ # PIC is the default for these OSes. ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style @@ -4676,7 +4797,7 @@ m4_if([$1], [CXX], [ esac ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], @@ -4718,6 +4839,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + *flang* | ftn | f18* | f95*) + # Flang compiler. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -4800,6 +4927,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; + *-mlibc) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. @@ -4816,6 +4949,9 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; + serenity*) + ;; + solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -4951,7 +5087,7 @@ m4_if([$1], [CXX], [ pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) case $cc_basename in cl* | icl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' @@ -5009,7 +5145,7 @@ dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. @@ -5021,9 +5157,6 @@ dnl Note also adjust exclude_expsyms for C++ above. # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; - openbsd* | bitrig*) - with_gnu_ld=no - ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes @@ -5124,7 +5257,7 @@ _LT_EOF fi ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' @@ -5134,6 +5267,7 @@ _LT_EOF _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + _LT_TAGVAR(file_list_spec, $1)='@' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -5153,7 +5287,7 @@ _LT_EOF haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=no ;; os2*) @@ -5180,7 +5314,7 @@ _LT_EOF cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; @@ -5259,6 +5393,7 @@ _LT_EOF case $cc_basename in tcc*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) @@ -5279,7 +5414,12 @@ _LT_EOF fi ;; - netbsd*) + *-mlibc) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -5581,7 +5721,7 @@ _LT_EOF _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is @@ -5598,14 +5738,14 @@ _LT_EOF # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_cmds, $1)='$CC -Fe$output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + $CC -Fe$tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' @@ -5817,11 +5957,15 @@ _LT_EOF # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; esac ;; - netbsd*) + *-mlibc) + ;; + + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -5843,7 +5987,7 @@ _LT_EOF *nto* | *qnx*) ;; - openbsd* | bitrig*) + openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -5886,7 +6030,7 @@ _LT_EOF cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; @@ -5922,6 +6066,9 @@ _LT_EOF _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; + serenity*) + ;; + solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then @@ -6180,7 +6327,7 @@ _LT_TAGDECL([], [hardcode_direct], [0], _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting $shlibpath_var if the + "absolute", i.e. impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR @@ -6238,7 +6385,7 @@ _LT_TAGVAR(objext, $1)=$objext lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' +lt_simple_link_test_code='int main(void){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other @@ -6423,8 +6570,7 @@ if test yes != "$_lt_caught_CXX_error"; then wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= @@ -6444,7 +6590,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " [[-]]L"' else GXX=no @@ -6653,7 +6799,7 @@ if test yes != "$_lt_caught_CXX_error"; then esac ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl* | ,icl* | no,icl*) # Native MSVC or ICC @@ -6706,6 +6852,7 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -6752,7 +6899,7 @@ if test yes != "$_lt_caught_CXX_error"; then cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; @@ -6793,7 +6940,7 @@ if test yes != "$_lt_caught_CXX_error"; then haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=no ;; hpux9*) @@ -6820,7 +6967,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "[[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -6885,7 +7032,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " [[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -7117,6 +7264,10 @@ if test yes != "$_lt_caught_CXX_error"; then esac ;; + *-mlibc) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' @@ -7133,7 +7284,7 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - openbsd* | bitrig*) + openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -7224,7 +7375,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " [[-]]L"' else # FIXME: insert proper C++ library support @@ -7239,6 +7390,9 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(ld_shlibs, $1)=no ;; + serenity*) + ;; + sunos4*) case $cc_basename in CC*) @@ -7308,7 +7462,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " [[-]]L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -7319,7 +7473,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " [[-]]L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' @@ -7557,10 +7711,11 @@ if AC_TRY_EVAL(ac_compile); then case $prev$p in -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. + # Some compilers place space between "-{L,R,l}" and the path. # Remove the space. - if test x-L = "$p" || - test x-R = "$p"; then + if test x-L = x"$p" || + test x-R = x"$p" || + test x-l = x"$p"; then prev=$p continue fi @@ -8210,7 +8365,7 @@ AC_SUBST([DLLTOOL]) # ---------------- # Check for a file(cmd) program that can be used to detect file type and magic m4_defun([_LT_DECL_FILECMD], -[AC_CHECK_TOOL([FILECMD], [file], [:]) +[AC_CHECK_PROG([FILECMD], [file], [file], [:]) _LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types]) ])# _LD_DECL_FILECMD @@ -8226,71 +8381,6 @@ _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f "$lt_ac_sed" && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test 10 -lt "$lt_ac_count" && break - lt_ac_count=`expr $lt_ac_count + 1` - if test "$lt_ac_count" -gt "$lt_ac_max"; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) @@ -8337,7 +8427,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) @@ -8350,7 +8440,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd, ;; *-*-cygwin* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) @@ -8376,9 +8466,9 @@ AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in - *-*-mingw* ) + *-*-mingw* | *-*-windows* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac @@ -8393,7 +8483,7 @@ _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free +# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2024 Free # Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # @@ -8401,7 +8491,7 @@ _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 8 ltoptions.m4 +# serial 10 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -8518,7 +8608,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) @@ -8713,29 +8803,39 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- -# implement the --with-aix-soname flag, and support the `aix-soname=aix' -# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT -# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +# implement the --enable-aix-soname configure option, and support the +# `aix-soname=aix' and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. +# DEFAULT is either `aix', `both', or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) - AC_ARG_WITH([aix-soname], - [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + AC_ARG_ENABLE([aix-soname], + [AS_HELP_STRING([--enable-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], - [case $withval in - aix|svr4|both) - ;; - *) - AC_MSG_ERROR([Unknown argument to --with-aix-soname]) - ;; - esac - lt_cv_with_aix_soname=$with_aix_soname], - [AC_CACHE_VAL([lt_cv_with_aix_soname], - [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) - with_aix_soname=$lt_cv_with_aix_soname]) + [case $enableval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --enable-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$enable_aix_soname], + [_AC_ENABLE_IF([with], [aix-soname], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)]) + enable_aix_soname=$lt_cv_with_aix_soname]) + with_aix_soname=$enable_aix_soname AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member @@ -8766,30 +8866,50 @@ LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- -# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# implement the --enable-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], +[AC_ARG_ENABLE([pic], + [AS_HELP_STRING([--enable-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for lt_pkg in $withval; do - IFS=$lt_save_ifs - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS=$lt_save_ifs - ;; - esac], - [pic_mode=m4_default([$1], [default])]) + case $enableval in + yes|no) pic_mode=$enableval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [dnl Continue to support --with-pic and --without-pic, for backward + dnl compatibility. + _AC_ENABLE_IF([with], [pic], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])])] + ) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC @@ -8825,7 +8945,7 @@ LT_OPTION_DEFINE([LTDL_INIT], [convenience], # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software +# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2024 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # @@ -8950,7 +9070,7 @@ m4_define([lt_dict_filter], # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, +# Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation, # Inc. # Written by Scott James Remnant, 2004 # @@ -8960,22 +9080,22 @@ m4_define([lt_dict_filter], # @configure_input@ -# serial 4245 ltversion.m4 +# serial 4441 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4.7]) -m4_define([LT_PACKAGE_REVISION], [2.4.7]) +m4_define([LT_PACKAGE_VERSION], [2.5.4]) +m4_define([LT_PACKAGE_REVISION], [2.5.4]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.7' -macro_revision='2.4.7' +[macro_version='2.5.4' +macro_revision='2.5.4' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free +# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2024 Free # Software Foundation, Inc. # Written by Scott James Remnant, 2004. # diff --git a/modules/freetype2/builds/unix/config.guess b/modules/freetype2/builds/unix/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2024 Free Software Foundation, Inc. +# Copyright 1992-2025 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2024-07-27' +timestamp='2025-07-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -60,7 +60,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2024 Free Software Foundation, Inc. +Copyright 1992-2025 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -1597,8 +1597,11 @@ EOF *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; - *:Ironclad:*:*) - GUESS=$UNAME_MACHINE-unknown-ironclad + x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*) + GUESS=$UNAME_MACHINE-pc-ironclad-mlibc + ;; + *:[Ii]ronclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad-mlibc ;; esac @@ -1808,8 +1811,8 @@ fi exit 1 # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp nil t) # time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-format: "%Y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/modules/freetype2/builds/unix/config.sub b/modules/freetype2/builds/unix/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2024 Free Software Foundation, Inc. +# Copyright 1992-2025 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale -timestamp='2024-05-27' +timestamp='2025-07-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright 1992-2024 Free Software Foundation, Inc. +Copyright 1992-2025 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -145,6 +145,7 @@ case $1 in | kfreebsd*-gnu* \ | knetbsd*-gnu* \ | kopensolaris*-gnu* \ + | ironclad-* \ | linux-* \ | managarm-* \ | netbsd*-eabi* \ @@ -242,7 +243,6 @@ case $1 in | rombug \ | semi \ | sequent* \ - | siemens \ | sgi* \ | siemens \ | sim \ @@ -261,7 +261,7 @@ case $1 in basic_machine=$field1-$field2 basic_os= ;; - zephyr*) + tock* | zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; @@ -1194,7 +1194,7 @@ case $cpu-$vendor in xscale-* | xscalee[bl]-*) cpu=`echo "$cpu" | sed 's/^xscale/arm/'` ;; - arm64-* | aarch64le-*) + arm64-* | aarch64le-* | arm64_32-*) cpu=aarch64 ;; @@ -1321,6 +1321,7 @@ case $cpu-$vendor in | i960 \ | ia16 \ | ia64 \ + | intelgt \ | ip2k \ | iq2000 \ | javascript \ @@ -1522,6 +1523,10 @@ EOF kernel=nto os=`echo "$basic_os" | sed -e 's|nto|qnx|'` ;; + ironclad*) + kernel=ironclad + os=`echo "$basic_os" | sed -e 's|ironclad|mlibc|'` + ;; linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|linux|gnu|'` @@ -1976,6 +1981,7 @@ case $os in | atheos* \ | auroraux* \ | aux* \ + | banan_os* \ | beos* \ | bitrig* \ | bme* \ @@ -2022,7 +2028,6 @@ case $os in | ios* \ | iris* \ | irix* \ - | ironclad* \ | isc* \ | its* \ | l4re* \ @@ -2118,6 +2123,7 @@ case $os in | sysv* \ | tenex* \ | tirtos* \ + | tock* \ | toppers* \ | tops10* \ | tops20* \ @@ -2214,6 +2220,8 @@ case $kernel-$os-$obj in ;; uclinux-uclibc*- | uclinux-gnu*- ) ;; + ironclad-mlibc*-) + ;; managarm-mlibc*- | managarm-kernel*- ) ;; windows*-msvc*-) @@ -2249,6 +2257,8 @@ case $kernel-$os-$obj in ;; *-eabi*- | *-gnueabi*-) ;; + ios*-simulator- | tvos*-simulator- | watchos*-simulator- ) + ;; none--*) # None (no kernel, i.e. freestanding / bare metal), # can be paired with an machine code file format @@ -2347,8 +2357,8 @@ echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp nil t) # time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-format: "%Y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/modules/freetype2/builds/unix/configure b/modules/freetype2/builds/unix/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for FreeType 2.13.3. +# Generated by GNU Autoconf 2.72 for FreeType 2.14.1. # # Report bugs to <freetype@nongnu.org>. # @@ -614,8 +614,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='FreeType' PACKAGE_TARNAME='freetype' -PACKAGE_VERSION='2.13.3' -PACKAGE_STRING='FreeType 2.13.3' +PACKAGE_VERSION='2.14.1' +PACKAGE_STRING='FreeType 2.14.1' PACKAGE_BUGREPORT='freetype@nongnu.org' PACKAGE_URL='' @@ -701,6 +701,8 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM EXEEXT_BUILD +LDFLAGS_BUILD +CFLAGS_BUILD CC_BUILD RC LT_SYS_LIBRARY_PATH @@ -794,8 +796,10 @@ ac_user_opts=' enable_option_checking enable_shared enable_static +enable_pic with_pic enable_fast_install +enable_aix_soname with_aix_soname with_gnu_ld with_sysroot @@ -1390,7 +1394,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -'configure' configures FreeType 2.13.3 to adapt to many kinds of systems. +'configure' configures FreeType 2.14.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1457,7 +1461,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of FreeType 2.13.3:";; + short | recursive ) echo "Configuration of FreeType 2.14.1:";; esac cat <<\_ACEOF @@ -1467,8 +1471,13 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] + --enable-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] + --enable-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. --disable-libtool-lock avoid locking (might break parallel builds) --enable-freetype-config install freetype-config @@ -1479,11 +1488,6 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use - both] - --with-aix-soname=aix|svr4|both - shared library versioning (aka "SONAME") variant to - provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). @@ -1495,7 +1499,7 @@ Optional Packages: --with-png=[yes|no|auto] support png compressed OpenType embedded bitmaps [default=auto] - --with-harfbuzz=[yes|no|auto] + --with-harfbuzz=[yes|dynamic|no|auto] improve auto-hinting of OpenType fonts [default=auto] --with-brotli=[yes|no|auto] @@ -1619,7 +1623,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -FreeType configure 2.13.3 +FreeType configure 2.14.1 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -1980,7 +1984,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by FreeType $as_me 2.13.3, which was +It was created by FreeType $as_me 2.14.1, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -2760,7 +2764,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Don't forget to update `docs/VERSIONS.TXT'! -version_info='26:2:20' +version_info='26:4:20' ft_version=`echo $version_info | tr : .` @@ -4157,8 +4161,8 @@ esac -macro_version='2.4.7' -macro_revision='2.4.7' +macro_version='2.5.4' +macro_revision='2.5.4' @@ -4592,7 +4596,7 @@ if test yes = "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in - *-*-mingw*) + *-*-mingw* | *-*-windows*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) @@ -4721,7 +4725,7 @@ else # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; + mingw* | windows*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in @@ -4947,14 +4951,14 @@ else case e in #( lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. + gnu* | ironclad*) + # Under GNU Hurd and Ironclad, this test is not required because there + # is no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, @@ -4976,7 +4980,7 @@ else case e in #( lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -5119,7 +5123,7 @@ else case e in #( e) case $host in *-*-mingw* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) @@ -5132,7 +5136,7 @@ else case e in #( ;; *-*-cygwin* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) @@ -5168,9 +5172,9 @@ else case e in #( e) #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in - *-*-mingw* ) + *-*-mingw* | *-*-windows* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac @@ -5206,7 +5210,7 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi @@ -5228,9 +5232,8 @@ esac -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. -set dummy ${ac_tool_prefix}file; ac_word=$2 +# Extract the first word of "file", so it can be a program name with args. +set dummy file; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_FILECMD+y} @@ -5251,7 +5254,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_FILECMD="${ac_tool_prefix}file" + ac_cv_prog_FILECMD="file" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5259,6 +5262,7 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_prog_FILECMD" && ac_cv_prog_FILECMD=":" fi ;; esac fi @@ -5272,66 +5276,6 @@ printf "%s\n" "no" >&6; } fi -fi -if test -z "$ac_cv_prog_FILECMD"; then - ac_ct_FILECMD=$FILECMD - # Extract the first word of "file", so it can be a program name with args. -set dummy file; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_FILECMD+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_FILECMD"; then - ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_FILECMD="file" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD -if test -n "$ac_ct_FILECMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 -printf "%s\n" "$ac_ct_FILECMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_FILECMD" = x; then - FILECMD=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - FILECMD=$ac_ct_FILECMD - fi -else - FILECMD="$ac_cv_prog_FILECMD" -fi - @@ -5463,7 +5407,6 @@ lt_cv_deplibs_check_method='unknown' # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure @@ -5490,7 +5433,7 @@ cygwin*) lt_cv_file_magic_cmd='func_win32_libid' ;; -mingw* | pw32*) +mingw* | windows* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. @@ -5499,7 +5442,7 @@ mingw* | pw32*) lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; @@ -5572,7 +5515,11 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +*-mlibc) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else @@ -5590,7 +5537,7 @@ newos6*) lt_cv_deplibs_check_method=pass_all ;; -openbsd* | bitrig*) +openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else @@ -5606,6 +5553,10 @@ rdos*) lt_cv_deplibs_check_method=pass_all ;; +serenity*) + lt_cv_deplibs_check_method=pass_all + ;; + solaris*) lt_cv_deplibs_check_method=pass_all ;; @@ -5658,7 +5609,7 @@ file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in - mingw* | pw32*) + mingw* | windows* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else @@ -5814,7 +5765,7 @@ else case e in #( e) lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in @@ -5847,6 +5798,110 @@ test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. @@ -5967,7 +6022,7 @@ fi # Use ARFLAGS variable as AR's operation code to sync the variable naming with # Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have -# higher priority because thats what people were doing historically (setting +# higher priority because that's what people were doing historically (setting # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS # variable obsoleted/removed. @@ -6159,17 +6214,63 @@ test -z "$STRIP" && STRIP=: -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RANLIB+y} +if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + e) if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6182,7 +6283,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6193,166 +6294,10 @@ IFS=$as_save_IFS fi ;; esac fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -printf "%s\n" "$RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RANLIB+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -printf "%s\n" "$ac_ct_RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AWK+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -printf "%s\n" "$AWK" >&6; } +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } @@ -6412,7 +6357,7 @@ case $host_os in aix*) symcode='[BCDT]' ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) @@ -6427,7 +6372,7 @@ osf*) symcode='[BCDEGQRST]' ;; solaris*) - symcode='[BDRT]' + symcode='[BCDRT]' ;; sco3.2v5*) symcode='[DT]' @@ -6491,7 +6436,7 @@ $lt_c_name_lib_hook\ # Handle CRLF in mingw tool chain opt_cr= case $build_os in -mingw*) +mingw* | windows*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac @@ -6542,7 +6487,7 @@ void nm_test_func(void){} #ifdef __cplusplus } #endif -int main(){nm_test_var='a';nm_test_func();return(0);} +int main(void){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 @@ -6552,11 +6497,8 @@ _LT_EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -6727,7 +6669,9 @@ lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` + # Trim trailing / since we'll always append absolute paths and we want + # to avoid //, if only for less confusing output for the user. + lt_sysroot=`$CC --print-sysroot 2>/dev/null | $SED 's:/\+$::'` fi ;; #( /*) @@ -6944,7 +6888,7 @@ mips64*-*linux*) ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) +s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when @@ -6963,7 +6907,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" @@ -6992,7 +6936,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) @@ -7213,23 +7157,23 @@ fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if test ${lt_cv_path_mainfest_tool+y} +if test ${lt_cv_path_manifest_tool+y} then : printf %s "(cached) " >&6 else case e in #( - e) lt_cv_path_mainfest_tool=no + e) lt_cv_path_manifest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes + lt_cv_path_manifest_tool=yes fi rm -f conftest* ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } -if test yes != "$lt_cv_path_mainfest_tool"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_manifest_tool" >&5 +printf "%s\n" "$lt_cv_path_manifest_tool" >&6; } +if test yes != "$lt_cv_path_manifest_tool"; then MANIFEST_TOOL=: fi @@ -7824,6 +7768,45 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } + # Feature test to disable chained fixups since it is not + # compatible with '-undefined dynamic_lookup' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -no_fixup_chains linker flag" >&5 +printf %s "checking for -no_fixup_chains linker flag... " >&6; } +if test ${lt_cv_support_no_fixup_chains+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-no_fixup_chains" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_support_no_fixup_chains=yes +else case e in #( + e) lt_cv_support_no_fixup_chains=no + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_support_no_fixup_chains" >&5 +printf "%s\n" "$lt_cv_support_no_fixup_chains" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 printf %s "checking for -exported_symbols_list linker flag... " >&6; } if test ${lt_cv_ld_exported_symbols_list+y} @@ -7878,7 +7861,7 @@ _LT_EOF echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF -int main() { return 0;} +int main(void) { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err @@ -7907,13 +7890,32 @@ printf "%s\n" "$lt_cv_ld_force_load" >&6; } 10.[012],*|,*powerpc*-darwin[5-8]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' + if test yes = "$lt_cv_support_no_fixup_chains"; then + as_fn_append _lt_dar_allow_undefined ' $wl-no_fixup_chains' + fi + ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi + _lt_dar_needs_single_mod=no + case $host_os in + rhapsody* | darwin1.*) + _lt_dar_needs_single_mod=yes ;; + darwin*) + # When targeting Mac OS X 10.4 (darwin 8) or later, + # -single_module is the default and -multi_module is unsupported. + # The toolchain on macOS 10.14 (darwin 18) and later cannot + # target any OS version that needs -single_module. + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*-darwin[567].*|10.[0-3],*-darwin[5-9].*|10.[0-3],*-darwin1[0-7].*) + _lt_dar_needs_single_mod=yes ;; + esac + ;; + esac if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else @@ -8007,7 +8009,7 @@ fi enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 @@ -8413,31 +8415,54 @@ fi - -# Check whether --with-pic was given. + # Check whether --enable-pic was given. +if test ${enable_pic+y} +then : + enableval=$enable_pic; lt_p=${PACKAGE-default} + case $enableval in + yes|no) pic_mode=$enableval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else case e in #( + e) # Check whether --with-pic was given. if test ${with_pic+y} then : withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for lt_pkg in $withval; do - IFS=$lt_save_ifs - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS=$lt_save_ifs - ;; - esac + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac else case e in #( e) pic_mode=default ;; esac fi + ;; +esac +fi + @@ -8482,18 +8507,29 @@ case $host,$enable_shared in power*-*-aix[5-9]*,yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 printf %s "checking which variant of shared library versioning to provide... " >&6; } - -# Check whether --with-aix-soname was given. + # Check whether --enable-aix-soname was given. +if test ${enable_aix_soname+y} +then : + enableval=$enable_aix_soname; case $enableval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --enable-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$enable_aix_soname +else case e in #( + e) # Check whether --with-aix-soname was given. if test ${with_aix_soname+y} then : withval=$with_aix_soname; case $withval in - aix|svr4|both) - ;; - *) - as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 - ;; - esac - lt_cv_with_aix_soname=$with_aix_soname + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname else case e in #( e) if test ${lt_cv_with_aix_soname+y} then : @@ -8502,11 +8538,15 @@ else case e in #( e) lt_cv_with_aix_soname=aix ;; esac fi + ;; +esac +fi - with_aix_soname=$lt_cv_with_aix_soname ;; + enable_aix_soname=$lt_cv_with_aix_soname ;; esac fi + with_aix_soname=$enable_aix_soname { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then @@ -8822,7 +8862,7 @@ objext=$objext lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' +lt_simple_link_test_code='int main(void){return(0);}' @@ -8960,7 +9000,7 @@ lt_prog_compiler_static= # PIC is the default for these OSes. ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style @@ -9063,7 +9103,7 @@ lt_prog_compiler_static= esac ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' @@ -9104,6 +9144,12 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; + *flang* | ftn | f18* | f95*) + # Flang compiler. + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -9186,6 +9232,12 @@ lt_prog_compiler_static= lt_prog_compiler_static='-Bstatic' ;; + *-mlibc) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. @@ -9202,6 +9254,9 @@ lt_prog_compiler_static= lt_prog_compiler_static='-non_shared' ;; + serenity*) + ;; + solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' @@ -9575,7 +9630,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries extract_expsyms_cmds= case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. @@ -9587,9 +9642,6 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; - openbsd* | bitrig*) - with_gnu_ld=no - ;; esac ld_shlibs=yes @@ -9690,7 +9742,7 @@ _LT_EOF fi ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' @@ -9700,6 +9752,7 @@ _LT_EOF enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + file_list_spec='@' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -9719,7 +9772,7 @@ _LT_EOF haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - link_all_deplibs=yes + link_all_deplibs=no ;; os2*) @@ -9746,7 +9799,7 @@ _LT_EOF cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; @@ -9825,6 +9878,7 @@ _LT_EOF case $cc_basename in tcc*) + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) @@ -9845,7 +9899,12 @@ _LT_EOF fi ;; - netbsd*) + *-mlibc) + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -10237,7 +10296,7 @@ fi export_dynamic_flag_spec=-rdynamic ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is @@ -10254,14 +10313,14 @@ fi # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_cmds='$CC -Fe$output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + $CC -Fe$tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' @@ -10544,11 +10603,15 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' ;; esac ;; - netbsd*) + *-mlibc) + ;; + + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -10570,7 +10633,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } *nto* | *qnx*) ;; - openbsd* | bitrig*) + openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no @@ -10613,7 +10676,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; @@ -10649,6 +10712,9 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } hardcode_libdir_separator=: ;; + serenity*) + ;; + solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then @@ -11055,7 +11121,7 @@ if test yes = "$GCC"; then *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + mingw* | windows* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` @@ -11113,7 +11179,7 @@ BEGIN {RS = " "; FS = "/|\n";} { # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + mingw* | windows* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` @@ -11187,7 +11253,7 @@ aix[4-9]*) # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # linker flag in LDFLAGS as well, or --enable-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the @@ -11281,7 +11347,7 @@ bsdi[45]*) # libtool to hard-code these into programs ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no @@ -11292,15 +11358,29 @@ cygwin* | mingw* | pw32* | cegcc*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' + # If user builds GCC with multilib enabled, + # it should just install on $(libdir) + # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones. + if test xyes = x"$multilib"; then + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + $install_prog $dir/$dlname $destdir/$dlname~ + chmod a+x $destdir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib $destdir/$dlname'\'' || exit \$?; + fi' + else + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + fi postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' @@ -11313,7 +11393,7 @@ cygwin* | mingw* | pw32* | cegcc*) sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; - mingw* | cegcc*) + mingw* | windows* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; @@ -11332,7 +11412,7 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='$libname.dll.lib' case $build_os in - mingw*) + mingw* | windows*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' @@ -11439,7 +11519,28 @@ freebsd* | dragonfly* | midnightbsd*) need_version=yes ;; esac + case $host_cpu in + powerpc64) + # On FreeBSD bi-arch platforms, a different variable is used for 32-bit + # binaries. See <https://man.freebsd.org/cgi/man.cgi?query=ld.so>. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int test_pointer_size[sizeof (void *) - 5]; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : shlibpath_var=LD_LIBRARY_PATH +else case e in #( + e) shlibpath_var=LD_32_LIBRARY_PATH ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + *) + shlibpath_var=LD_LIBRARY_PATH + ;; + esac case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes @@ -11469,8 +11570,9 @@ haiku*) soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes + sys_lib_search_path_spec='/boot/system/non-packaged/develop/lib /boot/system/develop/lib' + sys_lib_dlsearch_path_spec='/boot/home/config/non-packaged/lib /boot/home/config/lib /boot/system/non-packaged/lib /boot/system/lib' + hardcode_into_libs=no ;; hpux9* | hpux10* | hpux11*) @@ -11580,7 +11682,7 @@ linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext' + library_names_spec='$libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH @@ -11592,8 +11694,9 @@ linux*android*) hardcode_into_libs=yes dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - hardcode_libdir_flag_spec='-L$libdir' + # -rpath works at least for libraries that are not overridden by + # libraries installed in system locations. + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' ;; # This must be glibc/ELF. @@ -11650,7 +11753,7 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Ideally, we could use ldconfig to report *all* directores which are + # Ideally, we could use ldconfig to report *all* directories which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, @@ -11670,6 +11773,18 @@ fi dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -11688,7 +11803,19 @@ netbsd*) hardcode_into_libs=yes ;; -newsos6) +*-mlibc) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='mlibc ld.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH @@ -11707,7 +11834,7 @@ newsos6) dynamic_linker='ldqnx.so' ;; -openbsd* | bitrig*) +openbsd*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no @@ -11767,6 +11894,17 @@ rdos*) dynamic_linker=no ;; +serenity*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + dynamic_linker='SerenityOS LibELF' + ;; + solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -11815,53 +11953,543 @@ sysv4 | sysv4.3*) esac ;; -sysv4*MP*) - if test -d /usr/nec; then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +emscripten*) + version_type=none + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + dynamic_linker="Emscripten linker" + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + *flang* | ftn | f18* | f95*) + # Flang compiler. + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *-mlibc) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + serenity*) + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) lt_cv_prog_compiler_pic=$lt_prog_compiler_pic ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works"; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; +fi -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) lt_cv_prog_compiler_static_works=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works"; then + : +else + lt_prog_compiler_static= +fi + + + +='-fPIC' + archive_cmds='$CC -sSIDE_MODULE=2 -shared $libobjs $deplibs $compiler_flags -o $lib' + archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -sSIDE_MODULE=2 -shared $libobjs $deplibs $compiler_flags -o $lib -s EXPORTED_FUNCTIONS=@$output_objdir/$soname.expsym' + archive_cmds_need_lc=no + no_undefined_flag= ;; *) @@ -12048,7 +12676,7 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32* | cegcc*) + mingw* | windows* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; @@ -12421,11 +13049,11 @@ else /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); +int fnord (void) __attribute__((visibility("default"))); #endif -int fnord () { return 42; } -int main () +int fnord (void) { return 42; } +int main (void) { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; @@ -12529,11 +13157,11 @@ else /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); +int fnord (void) __attribute__((visibility("default"))); #endif -int fnord () { return 42; } -int main () +int fnord (void) { return 42; } +int main (void) { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; @@ -13077,6 +13705,49 @@ printf "%s\n" "no" >&6; } fi + test -z "${CC_BUILD}" && # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC_BUILD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC_BUILD"; then + ac_cv_prog_CC_BUILD="$CC_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC_BUILD="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC_BUILD=$ac_cv_prog_CC_BUILD +if test -n "$CC_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_BUILD" >&5 +printf "%s\n" "$CC_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + test -z "${CC_BUILD}" && as_fn_error $? "cannot find native C compiler" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of native executables" >&5 @@ -13095,8 +13766,12 @@ printf %s "checking for suffix of native executables... " >&6; } rm -f a.* b.* a_out.exe conftest.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $EXEEXT_BUILD" >&5 printf "%s\n" "$EXEEXT_BUILD" >&6; } + CFLAGS_BUILD= + LDFLAGS_BUILD= else CC_BUILD=${CC} + CFLAGS_BUILD=${CFLAGS} + LDFLAGS_BUILD=${LDFLAGS} EXEEXT_BUILD=${EXEEXT} fi @@ -13104,6 +13779,8 @@ fi + + # Since these files will be eventually called from another directory (namely # from the top level) we make the path of the scripts absolute. # @@ -14018,10 +14695,19 @@ found_visibility_flag=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -fvisibility=hidden compiler flag" >&5 printf %s "checking for -fvisibility=hidden compiler flag... " >&6; } orig_CFLAGS="${CFLAGS}" -CFLAGS="${CFLAGS} -fvisibility=hidden" +CFLAGS="${CFLAGS} -fvisibility=hidden -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + + +__attribute__(( visibility( "default" ) )) int foo( void ); +__attribute__(( visibility( "hidden" ) )) int bar( void ); + +int foo( void ) { return 0; } +int bar( void ) { return 1; } + + int main (void) { @@ -14030,19 +14716,20 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : found_visibility_flag=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + CFLAGS="${orig_CFLAGS} -fvisibility=hidden" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } + else case e in #( e) CFLAGS="${orig_CFLAGS}" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "${found_visibility_flag}" = "no"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -xldscope=hidden compiler flag" >&5 @@ -14752,10 +15439,133 @@ fi fi fi -if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then - as_fn_error $? "harfbuzz support requested but library not found" "$LINENO" 5 +have_harfbuzz_dynamic=no +if test x"$have_harfbuzz" = xno; then + if test x"$with_harfbuzz" = xdynamic -o x"$with_harfbuzz" = xauto; then + case "$host" in + *-*-mingw*) + # Windows uses its own LoadLibrary(), set variables to dynamic. + have_harfbuzz_dynamic=yes + have_harfbuzz="yes (dynamic)" + ;; + *) + # Check for libdl + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lc" >&5 +printf %s "checking for dlopen in -lc... " >&6; } +if test ${ac_cv_lib_c_dlopen+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (void); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_c_dlopen=yes +else case e in #( + e) ac_cv_lib_c_dlopen=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_c_dlopen" >&6; } +if test "x$ac_cv_lib_c_dlopen" = xyes +then : + have_harfbuzz_dynamic=yes +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (void); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else case e in #( + e) ac_cv_lib_dl_dlopen=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + have_harfbuzz_dynamic=yes + need_libdl=yes +fi + ;; +esac +fi + + if test x"$have_harfbuzz_dynamic" = xyes; then + have_harfbuzz="yes (dynamic)" + HARFBUZZ_CFLAGS= + if test x"$need_libdl" = xyes; then + HARFBUZZ_LIBS="-ldl" + fi + fi + ;; + esac + fi fi +if test x"$have_harfbuzz" = xno; then + if test x"$with_harfbuzz" != xno -a "$with_harfbuzz" != xauto; then + as_fn_error $? "harfbuzz support requested but library not found" "$LINENO" 5 + fi +fi # check for system libbrotlidec @@ -16845,13 +17655,13 @@ fi ftoption_set() { - regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" + regexp="-e \\\"s|.*#.*def.*$1\>.*|#define $1|\\\"" FTOPTION_H_SED="$FTOPTION_H_SED $regexp" } ftoption_unset() { - regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" + regexp="-e \\\"s|.*#.*def.*$1\>.*|/* #undef $1 */|\\\"" FTOPTION_H_SED="$FTOPTION_H_SED $regexp" } @@ -16883,6 +17693,11 @@ if test "$have_harfbuzz" != no; then else ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ fi +if test "$have_harfbuzz_dynamic" != no; then + ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC +else + ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC +fi if test "$have_brotli" != no; then CFLAGS="$CFLAGS $BROTLI_CFLAGS" LDFLAGS="$LDFLAGS $BROTLI_LIBS" @@ -17426,7 +18241,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by FreeType $as_me 2.13.3, which was +This file was extended by FreeType $as_me 2.14.1, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17494,7 +18309,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -FreeType config.status 2.13.3 +FreeType config.status 2.14.1 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" @@ -18565,19 +19380,18 @@ printf "%s\n" "$as_me: executing $ac_file commands" >&6;} cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 -# Copyright (C) 2014 Free Software Foundation, Inc. +# Copyright (C) 2024 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you @@ -18961,7 +19775,7 @@ hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# "absolute",i.e. impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute @@ -19190,7 +20004,7 @@ hardcode_direct=$hardcode_direct_RC # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# "absolute",i.e. impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_RC diff --git a/modules/freetype2/builds/unix/configure.ac b/modules/freetype2/builds/unix/configure.ac @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright (C) 2001-2024 by +# Copyright (C) 2001-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -11,13 +11,13 @@ # indicate that you have read the license and understand and accept it # fully. -AC_INIT([FreeType], [2.13.3], [freetype@nongnu.org], [freetype]) +AC_INIT([FreeType], [2.14.1], [freetype@nongnu.org], [freetype]) AC_CONFIG_SRCDIR([ftconfig.h.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='26:2:20' +version_info='26:4:20' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -46,6 +46,7 @@ if test ${cross_compiling} = yes; then AC_CHECK_PROG(CC_BUILD, ${build}-gcc, ${build}-gcc) test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, gcc, gcc) test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, cc, cc, , , /usr/ucb/cc) + test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, clang, clang) test -z "${CC_BUILD}" && AC_MSG_ERROR([cannot find native C compiler]) AC_MSG_CHECKING([for suffix of native executables]) @@ -62,12 +63,18 @@ if test ${cross_compiling} = yes; then fi rm -f a.* b.* a_out.exe conftest.* AC_MSG_RESULT($EXEEXT_BUILD) + CFLAGS_BUILD= + LDFLAGS_BUILD= else CC_BUILD=${CC} + CFLAGS_BUILD=${CFLAGS} + LDFLAGS_BUILD=${LDFLAGS} EXEEXT_BUILD=${EXEEXT} fi AC_SUBST(CC_BUILD) +AC_SUBST(CFLAGS_BUILD) +AC_SUBST(LDFLAGS_BUILD) AC_SUBST(EXEEXT_BUILD) @@ -232,12 +239,24 @@ AC_SUBST([XX_ANSIFLAGS]) found_visibility_flag=no AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) orig_CFLAGS="${CFLAGS}" -CFLAGS="${CFLAGS} -fvisibility=hidden" -AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [found_visibility_flag=yes - AC_MSG_RESULT(yes)], - [CFLAGS="${orig_CFLAGS}" - AC_MSG_RESULT(no)]) +CFLAGS="${CFLAGS} -fvisibility=hidden -Werror" +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ + +__attribute__(( visibility( "default" ) )) int foo( void ); +__attribute__(( visibility( "hidden" ) )) int bar( void ); + +int foo( void ) { return 0; } +int bar( void ) { return 1; } + + ], + [])], + [found_visibility_flag=yes + CFLAGS="${orig_CFLAGS} -fvisibility=hidden" + AC_MSG_RESULT(yes) + ], + [CFLAGS="${orig_CFLAGS}" + AC_MSG_RESULT(no)]) if test "${found_visibility_flag}" = "no"; then AC_MSG_CHECKING([for -xldscope=hidden compiler flag]) @@ -422,7 +441,7 @@ fi # check for system libharfbuzz AC_ARG_WITH([harfbuzz], - [AS_HELP_STRING([--with-harfbuzz=@<:@yes|no|auto@:>@], + [AS_HELP_STRING([--with-harfbuzz=@<:@yes|dynamic|no|auto@:>@], [improve auto-hinting of OpenType fonts @<:@default=auto@:>@])], [], [with_harfbuzz=auto]) @@ -458,10 +477,41 @@ if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then fi fi -if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then - AC_MSG_ERROR([harfbuzz support requested but library not found]) +have_harfbuzz_dynamic=no +if test x"$have_harfbuzz" = xno; then + if test x"$with_harfbuzz" = xdynamic -o x"$with_harfbuzz" = xauto; then + case "$host" in + *-*-mingw*) + # Windows uses its own LoadLibrary(), set variables to dynamic. + have_harfbuzz_dynamic=yes + have_harfbuzz="yes (dynamic)" + ;; + *) + # Check for libdl + AC_CHECK_LIB([c], + [dlopen], + [have_harfbuzz_dynamic=yes], + AC_CHECK_LIB([dl], + [dlopen], + [have_harfbuzz_dynamic=yes + need_libdl=yes])) + if test x"$have_harfbuzz_dynamic" = xyes; then + have_harfbuzz="yes (dynamic)" + HARFBUZZ_CFLAGS= + if test x"$need_libdl" = xyes; then + HARFBUZZ_LIBS="-ldl" + fi + fi + ;; + esac + fi fi +if test x"$have_harfbuzz" = xno; then + if test x"$with_harfbuzz" != xno -a "$with_harfbuzz" != xauto; then + AC_MSG_ERROR([harfbuzz support requested but library not found]) + fi +fi # check for system libbrotlidec @@ -1067,13 +1117,13 @@ AC_SUBST([build_libtool_libs]) ftoption_set() { - regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" + regexp="-e \\\"s|.*#.*def.*$1\>.*|#define $1|\\\"" FTOPTION_H_SED="$FTOPTION_H_SED $regexp" } ftoption_unset() { - regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" + regexp="-e \\\"s|.*#.*def.*$1\>.*|/* #undef $1 */|\\\"" FTOPTION_H_SED="$FTOPTION_H_SED $regexp" } @@ -1105,6 +1155,11 @@ if test "$have_harfbuzz" != no; then else ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ fi +if test "$have_harfbuzz_dynamic" != no; then + ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC +else + ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC +fi if test "$have_brotli" != no; then CFLAGS="$CFLAGS $BROTLI_CFLAGS" LDFLAGS="$LDFLAGS $BROTLI_LIBS" diff --git a/modules/freetype2/builds/unix/configure.raw b/modules/freetype2/builds/unix/configure.raw @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright (C) 2001-2024 by +# Copyright (C) 2001-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.h.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='26:2:20' +version_info='26:4:20' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -46,6 +46,7 @@ if test ${cross_compiling} = yes; then AC_CHECK_PROG(CC_BUILD, ${build}-gcc, ${build}-gcc) test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, gcc, gcc) test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, cc, cc, , , /usr/ucb/cc) + test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, clang, clang) test -z "${CC_BUILD}" && AC_MSG_ERROR([cannot find native C compiler]) AC_MSG_CHECKING([for suffix of native executables]) @@ -62,12 +63,18 @@ if test ${cross_compiling} = yes; then fi rm -f a.* b.* a_out.exe conftest.* AC_MSG_RESULT($EXEEXT_BUILD) + CFLAGS_BUILD= + LDFLAGS_BUILD= else CC_BUILD=${CC} + CFLAGS_BUILD=${CFLAGS} + LDFLAGS_BUILD=${LDFLAGS} EXEEXT_BUILD=${EXEEXT} fi AC_SUBST(CC_BUILD) +AC_SUBST(CFLAGS_BUILD) +AC_SUBST(LDFLAGS_BUILD) AC_SUBST(EXEEXT_BUILD) @@ -232,12 +239,24 @@ AC_SUBST([XX_ANSIFLAGS]) found_visibility_flag=no AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) orig_CFLAGS="${CFLAGS}" -CFLAGS="${CFLAGS} -fvisibility=hidden" -AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [found_visibility_flag=yes - AC_MSG_RESULT(yes)], - [CFLAGS="${orig_CFLAGS}" - AC_MSG_RESULT(no)]) +CFLAGS="${CFLAGS} -fvisibility=hidden -Werror" +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ + +__attribute__(( visibility( "default" ) )) int foo( void ); +__attribute__(( visibility( "hidden" ) )) int bar( void ); + +int foo( void ) { return 0; } +int bar( void ) { return 1; } + + ], + [])], + [found_visibility_flag=yes + CFLAGS="${orig_CFLAGS} -fvisibility=hidden" + AC_MSG_RESULT(yes) + ], + [CFLAGS="${orig_CFLAGS}" + AC_MSG_RESULT(no)]) if test "${found_visibility_flag}" = "no"; then AC_MSG_CHECKING([for -xldscope=hidden compiler flag]) @@ -422,7 +441,7 @@ fi # check for system libharfbuzz AC_ARG_WITH([harfbuzz], - [AS_HELP_STRING([--with-harfbuzz=@<:@yes|no|auto@:>@], + [AS_HELP_STRING([--with-harfbuzz=@<:@yes|dynamic|no|auto@:>@], [improve auto-hinting of OpenType fonts @<:@default=auto@:>@])], [], [with_harfbuzz=auto]) @@ -458,10 +477,41 @@ if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then fi fi -if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then - AC_MSG_ERROR([harfbuzz support requested but library not found]) +have_harfbuzz_dynamic=no +if test x"$have_harfbuzz" = xno; then + if test x"$with_harfbuzz" = xdynamic -o x"$with_harfbuzz" = xauto; then + case "$host" in + *-*-mingw*) + # Windows uses its own LoadLibrary(), set variables to dynamic. + have_harfbuzz_dynamic=yes + have_harfbuzz="yes (dynamic)" + ;; + *) + # Check for libdl + AC_CHECK_LIB([c], + [dlopen], + [have_harfbuzz_dynamic=yes], + AC_CHECK_LIB([dl], + [dlopen], + [have_harfbuzz_dynamic=yes + need_libdl=yes])) + if test x"$have_harfbuzz_dynamic" = xyes; then + have_harfbuzz="yes (dynamic)" + HARFBUZZ_CFLAGS= + if test x"$need_libdl" = xyes; then + HARFBUZZ_LIBS="-ldl" + fi + fi + ;; + esac + fi fi +if test x"$have_harfbuzz" = xno; then + if test x"$with_harfbuzz" != xno -a "$with_harfbuzz" != xauto; then + AC_MSG_ERROR([harfbuzz support requested but library not found]) + fi +fi # check for system libbrotlidec @@ -1067,13 +1117,13 @@ AC_SUBST([build_libtool_libs]) ftoption_set() { - regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" + regexp="-e \\\"s|.*#.*def.*$1\>.*|#define $1|\\\"" FTOPTION_H_SED="$FTOPTION_H_SED $regexp" } ftoption_unset() { - regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" + regexp="-e \\\"s|.*#.*def.*$1\>.*|/* #undef $1 */|\\\"" FTOPTION_H_SED="$FTOPTION_H_SED $regexp" } @@ -1105,6 +1155,11 @@ if test "$have_harfbuzz" != no; then else ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ fi +if test "$have_harfbuzz_dynamic" != no; then + ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC +else + ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC +fi if test "$have_brotli" != no; then CFLAGS="$CFLAGS $BROTLI_CFLAGS" LDFLAGS="$LDFLAGS $BROTLI_LIBS" diff --git a/modules/freetype2/builds/unix/detect.mk b/modules/freetype2/builds/unix/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/freetype-config.in b/modules/freetype2/builds/unix/freetype-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2000-2024 by +# Copyright (C) 2000-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/freetype2.m4 b/modules/freetype2/builds/unix/freetype2.m4 @@ -1,7 +1,7 @@ # Configure paths for FreeType2 # Marcelo Magallon 2001-10-26, based on `gtk.m4` by Owen Taylor # -# Copyright (C) 2001-2024 by +# Copyright (C) 2001-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/ft-munmap.m4 b/modules/freetype2/builds/unix/ft-munmap.m4 @@ -1,6 +1,6 @@ ## FreeType specific autoconf tests # -# Copyright (C) 2002-2024 by +# Copyright (C) 2002-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/ftconfig.h.in b/modules/freetype2/builds/unix/ftconfig.h.in @@ -4,7 +4,7 @@ * * UNIX-specific configuration file (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/builds/unix/ftsystem.c b/modules/freetype2/builds/unix/ftsystem.c @@ -4,7 +4,7 @@ * * Unix-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/builds/unix/install-sh b/modules/freetype2/builds/unix/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2020-11-14.01; # UTC +scriptversion=2024-06-19.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -124,9 +124,9 @@ it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. -Email bug reports to bug-automake@gnu.org. -Automake home page: https://www.gnu.org/software/automake/ -" +Report bugs to <bug-automake@gnu.org>. +GNU Automake home page: <https://www.gnu.org/software/automake/>. +General help using GNU software: <https://www.gnu.org/gethelp/>." while test $# -ne 0; do case $1 in @@ -170,7 +170,7 @@ while test $# -ne 0; do -T) is_target_a_directory=never;; - --version) echo "$0 $scriptversion"; exit $?;; + --version) echo "$0 (GNU Automake) $scriptversion"; exit $?;; --) shift break;; @@ -345,7 +345,7 @@ do ' 0 # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directly in world-writable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && @@ -353,7 +353,7 @@ do exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. + # Check for POSIX incompatibility with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. diff --git a/modules/freetype2/builds/unix/install.mk b/modules/freetype2/builds/unix/install.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/ltmain.sh b/modules/freetype2/builds/unix/ltmain.sh @@ -2,11 +2,11 @@ ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2019-02-19.15 -# libtool (GNU libtool) 2.4.7 +# libtool (GNU libtool) 2.5.4 # Provide generalized library-building support services. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. +# Copyright (C) 1996-2019, 2021-2024 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -31,8 +31,8 @@ PROGRAM=libtool PACKAGE=libtool -VERSION=2.4.7 -package_revision=2.4.7 +VERSION=2.5.4 +package_revision=2.5.4 ## ------ ## @@ -72,11 +72,11 @@ scriptversion=2019-02-19.15; # UTC # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Copyright (C) 2004-2019, 2021 Bootstrap Authors +# Copyright (C) 2004-2019, 2021, 2023-2024 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license -# <https://opensource.org/license/MIT>, and GPL version 2 or later -# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of +# <https://opensource.org/licenses/MIT>, and GPL version 2 or later +# <https://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. @@ -143,7 +143,7 @@ nl=' ' IFS="$sp $nl" -# There are apparently some retarded systems that use ';' as a PATH separator! +# There are apparently some systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { @@ -589,7 +589,7 @@ func_require_term_colors () # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is - # useable or anything else if it does not work. + # usable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes @@ -739,7 +739,7 @@ eval 'func_dirname () # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. -# value retuned in "$func_basename_result" +# value returned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () @@ -897,7 +897,7 @@ func_mkdir_p () # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. + # list in case some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done @@ -1536,11 +1536,11 @@ func_lt_ver () # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Copyright (C) 2010-2019, 2021 Bootstrap Authors +# Copyright (C) 2010-2019, 2021, 2023-2024 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license -# <https://opensource.org/license/MIT>, and GPL version 2 or later -# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of +# <https://opensource.org/licenses/MIT>, and GPL version 2 or later +# <https://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. @@ -2215,7 +2215,30 @@ func_version () # End: # Set a version string. -scriptversion='(GNU libtool) 2.4.7' +scriptversion='(GNU libtool) 2.5.4' + +# func_version +# ------------ +# Echo version message to standard output and exit. +func_version () +{ + $debug_cmd + + year=`date +%Y` + + cat <<EOF +$progname $scriptversion +Copyright (C) $year Free Software Foundation, Inc. +License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html> +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + +Originally written by Gordon Matzigkeit, 1996 +(See AUTHORS for complete contributor listing) +EOF + + exit $? +} # func_echo ARG... @@ -2238,18 +2261,6 @@ func_echo () } -# func_warning ARG... -# ------------------- -# Libtool warnings are not categorized, so override funclib.sh -# func_warning with this simpler definition. -func_warning () -{ - $debug_cmd - - $warning_func ${1+"$@"} -} - - ## ---------------- ## ## Options parsing. ## ## ---------------- ## @@ -2261,19 +2272,23 @@ usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: - --config show all configuration variables - --debug enable verbose shell tracing - -n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --mode=MODE use operation mode MODE - --no-warnings equivalent to '-Wnone' - --preserve-dup-deps don't remove duplicate dependency libraries - --quiet, --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - -v, --verbose print more informational messages than default - --version print version information - -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] - -h, --help, --help-all print short, long, or detailed help message + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information + --finish use operation '--mode=finish' + --mode=MODE use operation mode MODE + --no-finish don't update shared library cache + --no-quiet, --no-silent print default informational messages + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --reorder-cache=DIRS reorder shared library cache for preferred DIRS + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. @@ -2306,13 +2321,13 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.7 + version: $progname $scriptversion automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to <bug-libtool@gnu.org>. -GNU libtool home page: <http://www.gnu.org/software/libtool/>. -General help using GNU software: <http://www.gnu.org/gethelp/>." +GNU libtool home page: <https://www.gnu.org/software/libtool/>. +General help using GNU software: <https://www.gnu.org/gethelp/>." exit 0 } @@ -2502,8 +2517,11 @@ libtool_options_prep () opt_dry_run=false opt_help=false opt_mode= + opt_reorder_cache=false opt_preserve_dup_deps=false opt_quiet=false + opt_finishing=true + opt_warning= nonopt= preserve_args= @@ -2593,14 +2611,18 @@ libtool_parse_options () clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error - *) func_error "invalid argument for $_G_opt" + *) func_error "invalid argument '$1' for $_G_opt" exit_cmd=exit - break ;; esac shift ;; + --no-finish) + opt_finishing=false + func_append preserve_args " $_G_opt" + ;; + --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" @@ -2616,6 +2638,24 @@ libtool_parse_options () func_append preserve_args " $_G_opt" ;; + --reorder-cache) + opt_reorder_cache=true + shared_lib_dirs=$1 + if test -n "$shared_lib_dirs"; then + case $1 in + # Must begin with /: + /*) ;; + + # Catch anything else as an error (relative paths) + *) func_error "invalid argument '$1' for $_G_opt" + func_error "absolute paths are required for $_G_opt" + exit_cmd=exit + ;; + esac + fi + shift + ;; + --silent|--quiet) opt_quiet=: opt_verbose=false @@ -2652,6 +2692,18 @@ libtool_parse_options () func_add_hook func_parse_options libtool_parse_options +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + if $opt_warning; then + $debug_cmd + $warning_func ${1+"$@"} + fi +} + # libtool_validate_options [ARG]... # --------------------------------- @@ -2668,10 +2720,10 @@ libtool_validate_options () # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" - case $host in + case $host_os in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 - *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + cygwin* | mingw* | windows* | pw32* | cegcc* | solaris2* | os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; @@ -3003,7 +3055,7 @@ EOF # func_convert_core_file_wine_to_w32 ARG # Helper function used by file name conversion functions when $build is *nix, -# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# and $host is mingw, windows, cygwin, or some other w32 environment. Relies on a # correctly configured wine environment available, with the winepath program # in $build's $PATH. # @@ -3035,9 +3087,10 @@ func_convert_core_file_wine_to_w32 () # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. +# $host is mingw, windows, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. Assumes ARG has no leading or trailing path separator +# characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. @@ -3180,6 +3233,15 @@ func_convert_path_front_back_pathsep () # end func_convert_path_front_back_pathsep +# func_convert_delimited_path PATH ORIG_DELIMITER NEW_DELIMITER +# Replaces a delimiter for a given path. +func_convert_delimited_path () +{ + converted_path=`$ECHO "$1" | $SED "s#$2#$3#g"` +} +# end func_convert_delimited_path + + ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## @@ -3514,6 +3576,65 @@ func_dll_def_p () } +# func_reorder_shared_lib_cache DIRS +# Reorder the shared library cache by unconfiguring previous shared library cache +# and configuring preferred search directories before previous search directories. +# Previous shared library cache: /usr/lib /usr/local/lib +# Preferred search directories: /tmp/testing +# Reordered shared library cache: /tmp/testing /usr/lib /usr/local/lib +func_reorder_shared_lib_cache () +{ + $debug_cmd + + case $host_os in + openbsd*) + get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"` + func_convert_delimited_path "$get_search_directories" ':' '\ ' + save_search_directories=$converted_path + func_convert_delimited_path "$1" ':' '\ ' + + # Ensure directories exist + for dir in $converted_path; do + # Ensure each directory is an absolute path + case $dir in + /*) ;; + *) func_error "Directory '$dir' is not an absolute path" + exit $EXIT_FAILURE ;; + esac + # Ensure no trailing slashes + func_stripname '' '/' "$dir" + dir=$func_stripname_result + if test -d "$dir"; then + if test -n "$preferred_search_directories"; then + preferred_search_directories="$preferred_search_directories $dir" + else + preferred_search_directories=$dir + fi + else + func_error "Directory '$dir' does not exist" + exit $EXIT_FAILURE + fi + done + + PATH="$PATH:/sbin" ldconfig -U $save_search_directories + PATH="$PATH:/sbin" ldconfig -m $preferred_search_directories $save_search_directories + get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"` + func_convert_delimited_path "$get_search_directories" ':' '\ ' + reordered_search_directories=$converted_path + + $ECHO "Original: $save_search_directories" + $ECHO "Reordered: $reordered_search_directories" + exit $EXIT_SUCCESS + ;; + *) + func_error "--reorder-cache is not supported for host_os=$host_os." + exit $EXIT_FAILURE + ;; + esac +} +# end func_reorder_shared_lib_cache + + # func_mode_compile arg... func_mode_compile () { @@ -3692,7 +3813,7 @@ func_mode_compile () # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) + cygwin* | mingw* | windows* | pw32* | os2* | cegcc*) pic_mode=default ;; esac @@ -4086,6 +4207,12 @@ if $opt_help; then fi +# If option '--reorder-cache', reorder the shared library cache and exit. +if $opt_reorder_cache; then + func_reorder_shared_lib_cache $shared_lib_dirs +fi + + # func_mode_execute arg... func_mode_execute () { @@ -4270,7 +4397,7 @@ func_mode_finish () fi fi - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs" && $opt_finishing; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. @@ -4295,6 +4422,12 @@ func_mode_finish () for libdir in $libdirs; do $ECHO " $libdir" done + if test "false" = "$opt_finishing"; then + echo + echo "NOTE: finish_cmds were not executed during testing, so you must" + echo "manually run ldconfig to add a given test directory, LIBDIR, to" + echo "the search path for generated executables." + fi echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" @@ -4531,8 +4664,15 @@ func_mode_install () func_append dir "$objdir" if test -n "$relink_command"; then + # Strip any trailing slash from the destination. + func_stripname '' '/' "$libdir" + destlibdir=$func_stripname_result + + func_stripname '' '/' "$destdir" + s_destdir=$func_stripname_result + # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that @@ -4569,7 +4709,7 @@ func_mode_install () 'exit $?' tstripme=$stripme case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= @@ -4682,7 +4822,7 @@ func_mode_install () # Do a test to see if this is really a libtool program. case $host in - *cygwin* | *mingw*) + *cygwin* | *mingw* | *windows*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result @@ -4910,7 +5050,7 @@ extern \"C\" { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; @@ -4922,7 +5062,7 @@ extern \"C\" { eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; @@ -4936,7 +5076,7 @@ extern \"C\" { func_basename "$dlprefile" name=$func_basename_result case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" @@ -4962,8 +5102,16 @@ extern \"C\" { eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + case $host in + i[3456]86-*-mingw32*) + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + ;; + *) + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/__nm_//' >> '$nlist'" + ;; + esac } else # not an import lib $opt_dry_run || { @@ -5111,7 +5259,7 @@ static const void *lt_preloaded_setup() { # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` @@ -5187,7 +5335,7 @@ func_win32_libid () *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || @@ -5454,7 +5602,7 @@ func_extract_archives () # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw +# incorporate the script contents within a cygwin/mingw/windows # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. @@ -5462,7 +5610,7 @@ func_extract_archives () # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is -# the $objdir directory. This is a cygwin/mingw-specific +# the $objdir directory. This is a cygwin/mingw/windows-specific # behavior. func_emit_wrapper () { @@ -5587,7 +5735,7 @@ func_exec_program_core () " case $host in # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) + *-*-mingw* | *-*-windows* | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 @@ -5655,7 +5803,7 @@ func_exec_program () file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done - # Usually 'no', except on cygwin/mingw when embedded into + # Usually 'no', except on cygwin/mingw/windows when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then @@ -5787,7 +5935,7 @@ EOF #endif #include <stdio.h> #include <stdlib.h> -#ifdef _MSC_VER +#if defined _WIN32 && !defined __GNUC__ # include <direct.h> # include <process.h> # include <io.h> @@ -5812,7 +5960,7 @@ EOF /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ -int _putenv (const char *); +_CRTIMP int __cdecl _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ @@ -6010,7 +6158,7 @@ main (int argc, char *argv[]) { EOF case $host in - *mingw* | *cygwin* ) + *mingw* | *windows* | *cygwin* ) # make stdout use "unix" line endings echo " setmode(1,_O_BINARY);" ;; @@ -6029,7 +6177,7 @@ EOF { /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX namespace, but it is not one of the ones we know about and - have already dealt with, above (inluding dump-script), then + have already dealt with, above (including dump-script), then report an error. Otherwise, targets might begin to believe they are allowed to use options in the LTWRAPPER_OPTION_PREFIX namespace. The first time any user complains about this, we'll @@ -6113,7 +6261,7 @@ EOF EOF case $host_os in - mingw*) + mingw* | windows*) cat <<"EOF" { char* p; @@ -6155,7 +6303,7 @@ EOF EOF case $host_os in - mingw*) + mingw* | windows*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ newargz = prepare_spawn (newargz); @@ -6574,7 +6722,7 @@ lt_update_lib_path (const char *name, const char *value) EOF case $host_os in - mingw*) + mingw* | windows*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). @@ -6749,7 +6897,7 @@ func_mode_link () $debug_cmd case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra @@ -6773,6 +6921,7 @@ func_mode_link () finalize_command=$nonopt compile_rpath= + compile_rpath_tail= finalize_rpath= compile_shlibpath= finalize_shlibpath= @@ -6813,10 +6962,12 @@ func_mode_link () xrpath= perm_rpath= temp_rpath= + temp_rpath_tail= thread_safe=no vinfo= vinfo_number=no weak_libs= + rpath_arg= single_module=$wl-single_module func_infer_tag $base_compile @@ -7079,7 +7230,7 @@ func_mode_link () case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) - func_fatal_error "only absolute run-paths are allowed" + func_fatal_error "argument to -rpath is not absolute: $arg" ;; esac if test rpath = "$prev"; then @@ -7255,7 +7406,7 @@ func_mode_link () ;; esac case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; @@ -7275,7 +7426,7 @@ func_mode_link () -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; @@ -7283,7 +7434,7 @@ func_mode_link () # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; @@ -7303,7 +7454,7 @@ func_mode_link () esac elif test X-lc_r = "X$arg"; then case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -7326,7 +7477,8 @@ func_mode_link () # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) + # -q <option> for IBM XL C/C++ compiler. + -model|-arch|-isysroot|--sysroot|-q) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" @@ -7347,7 +7499,7 @@ func_mode_link () continue ;; -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" @@ -7370,7 +7522,7 @@ func_mode_link () -no-install) case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" @@ -7430,7 +7582,7 @@ func_mode_link () dir=$lt_sysroot$func_stripname_result ;; *) - func_fatal_error "only absolute run-paths are allowed" + func_fatal_error "argument ($arg) to '-R' is not an absolute path: $dir" ;; esac case "$xrpath " in @@ -7555,13 +7707,29 @@ func_mode_link () # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang + # -fdiagnostics-color* simply affects output + # -frecord-gcc-switches used to verify flags were respected # -fsanitize=* Clang/GCC memory and address sanitizer + # -fno-sanitize* Clang/GCC memory and address sanitizer + # -shared-libsan Link with shared sanitizer runtimes (Clang) + # -static-libsan Link with static sanitizer runtimes (Clang) + # -no-canonical-prefixes Do not expand any symbolic links # -fuse-ld=* Linker select flags for GCC + # -static-* direct GCC to link specific libraries statically + # -fcilkplus Cilk Plus language extension features for C/C++ + # -rtlib=* select c runtime lib with clang + # --unwindlib=* select unwinder library with clang + # -f{file|debug|macro|profile}-prefix-map=* needed for lto linking # -Wa,* Pass flags directly to the assembler + # -Werror, -Werror=* Report (specified) warnings as errors -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*) + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-no-canonical-prefixes| \ + -stdlib=*|-rtlib=*|--unwindlib=*| \ + -specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \ + -ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \ + -fdiagnostics-color*|-frecord-gcc-switches| \ + -fuse-ld=*|-static-*|-fcilkplus|-Wa,*|-Werror|-Werror=*) func_quote_arg pretty "$arg" arg=$func_quote_arg_result func_append compile_command " $arg" @@ -7719,8 +7887,20 @@ func_mode_link () # Now actually substitute the argument into the commands. if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" + if test -n "$rpath_arg"; then + func_append finalize_rpath " ${arg##*,}" + unset rpath_arg + else + case $arg in + -Wl,-rpath,*) + func_append finalize_rpath " ${arg##*,}";; + -Wl,-rpath) + rpath_arg=1;; + *) + func_append compile_command " $arg" + func_append finalize_command " $arg" + esac + fi fi done # argument parsing loop @@ -7891,7 +8071,7 @@ func_mode_link () found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" @@ -8068,18 +8248,15 @@ func_mode_link () ;; esac if $valid_a_lib; then - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" + func_warning "Linking the shared library $output against the static library $deplib is not portable!" deplibs="$deplib $deplibs" else - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." + func_warning "Trying to link with static lib archive $deplib." + func_warning "I have the capability to make that library automatically link in when" + func_warning "you link to this library. But I can only do this if you have a" + func_warning "shared version of the library, which you do not appear to have" + func_warning "because the file extensions .$libext of this argument makes me believe" + func_warning "that it is just a static archive that I should not use here." fi ;; esac @@ -8274,7 +8451,7 @@ func_mode_link () fi case $host in # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present @@ -8374,7 +8551,10 @@ func_mode_link () # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; + *) case $absdir in + "$progdir/"*) func_append temp_rpath "$absdir:" ;; + *) func_append temp_rpath_tail "$absdir:" ;; + esac esac fi @@ -8384,9 +8564,12 @@ func_mode_link () case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) - case "$compile_rpath " in + case "$compile_rpath$compile_rpath_tail " in *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; + *) case $absdir in + "$progdir/"*) func_append compile_rpath " $absdir" ;; + *) func_append compile_rpath_tail " $absdir" ;; + esac esac ;; esac @@ -8417,8 +8600,8 @@ func_mode_link () fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc* | *os2*) + case $host_os in + cygwin* | mingw* | windows* | cegcc* | os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no @@ -8444,11 +8627,11 @@ func_mode_link () if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" + func_warning "Linking the executable $output against the loadable module" else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" + func_warning "Linking the shared library $output against the loadable module" fi - $ECHO "*** $linklib is not portable!" + func_warning "$linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then @@ -8458,9 +8641,12 @@ func_mode_link () case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) - case "$compile_rpath " in + case "$compile_rpath$compile_rpath_tail " in *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; + *) case $absdir in + "$progdir/"*) func_append compile_rpath " $absdir" ;; + *) func_append compile_rpath_tail " $absdir" ;; + esac esac ;; esac @@ -8487,8 +8673,8 @@ func_mode_link () soname=$dlname elif test -n "$soname_spec"; then # bleh windows - case $host in - *cygwin* | mingw* | *cegcc* | *os2*) + case $host_os in + cygwin* | mingw* | windows* | cegcc* | os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major @@ -8535,6 +8721,7 @@ func_mode_link () case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-emscripten*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) @@ -8543,11 +8730,10 @@ func_mode_link () if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" + func_warning "lib $linklib is a module, not a shared library" if test -z "$old_library"; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" + func_warning "And there doesn't seem to be a static archive available" + func_warning "The link will probably fail, sorry" else add=$dir/$old_library fi @@ -8630,7 +8816,7 @@ func_mode_link () test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then - add_dir=-L$libdir + add_dir=-L$lt_sysroot$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in @@ -8647,7 +8833,7 @@ func_mode_link () fi else # We cannot seem to hardcode it, guess we'll fake it. - add_dir=-L$libdir + add_dir=-L$lt_sysroot$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in @@ -8687,21 +8873,19 @@ func_mode_link () # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system cannot link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + func_warning "This system cannot link to static lib archive $lib." + func_warning "I have the capability to make that library automatically link in when" + func_warning "you link to this library. But I can only do this if you have a" + func_warning "shared version of the library, which you do not appear to have." if test yes = "$module"; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + func_warning "But as you try to build a module library, libtool will still create " + func_warning "a static module, that should work as long as the dlopening application" + func_warning "is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using 'nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** 'nm' from GNU binutils and a full rebuild may help." + func_warning "However, this would only work if libtool was able to extract symbol" + func_warning "lists from a program, using 'nm' or equivalent, but libtool could" + func_warning "not find such a program. So, this module is probably useless." + func_warning "'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module @@ -8824,6 +9008,10 @@ func_mode_link () fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs + + func_append temp_rpath "$temp_rpath_tail" + func_append compile_rpath "$compile_rpath_tail" + if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" @@ -8861,42 +9049,46 @@ func_mode_link () # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: new_libs="$deplib $new_libs" for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; + if $opt_preserve_dup_deps; then + new_libs="$deplib $new_libs" + else + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. And if not possible for portability + # reasons, then --preserve-dup-deps should be used. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; esac - ;; - esac + fi done tmp_libs= for deplib in $new_libs; do @@ -9028,9 +9220,7 @@ func_mode_link () if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" + func_warning "Linking the shared library $output against the non-libtool objects $objs is not portable!" func_append libobjs " $objs" fi fi @@ -9091,13 +9281,13 @@ func_mode_link () # case $version_type in # correct linux to gnu/linux during the next big refactor - darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) + darwin|freebsd-elf|linux|midnightbsd-elf|osf|qnx|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; - freebsd-aout|qnx|sunos) + freebsd-aout|sco|sunos) current=$number_major revision=$number_minor age=0 @@ -9109,6 +9299,9 @@ func_mode_link () revision=$number_minor lt_irix_increment=no ;; + *) + func_fatal_configuration "$modename: unknown library version type '$version_type'" + ;; esac ;; no) @@ -9244,8 +9437,9 @@ func_mode_link () ;; qnx) - major=.$current - versuffix=.$current + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision ;; sco) @@ -9398,7 +9592,7 @@ func_mode_link () if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) @@ -9449,108 +9643,6 @@ func_mode_link () # implementing what was already the behavior. newdeplibs=$deplibs ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c <<EOF - int main() { return 0; } -EOF - $opt_dry_run || $RM conftest - if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then - ldd_output=`ldd conftest` - for i in $deplibs; do - case $i in - -l*) - func_stripname -l '' "$i" - name=$func_stripname_result - if test yes = "$allow_libtool_libs_with_static_runtimes"; then - case " $predeps $postdeps " in - *" $i "*) - func_append newdeplibs " $i" - i= - ;; - esac - fi - if test -n "$i"; then - libname=`eval "\\$ECHO \"$libname_spec\""` - deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` - set dummy $deplib_matches; shift - deplib_match=$1 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then - func_append newdeplibs " $i" - else - droppeddeps=yes - echo - $ECHO "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which I believe you do not have" - echo "*** because a test_compile did reveal that the linker did not use it for" - echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - ;; - *) - func_append newdeplibs " $i" - ;; - esac - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - case $i in - -l*) - func_stripname -l '' "$i" - name=$func_stripname_result - $opt_dry_run || $RM conftest - if $LTCC $LTCFLAGS -o conftest conftest.c $i; then - ldd_output=`ldd conftest` - if test yes = "$allow_libtool_libs_with_static_runtimes"; then - case " $predeps $postdeps " in - *" $i "*) - func_append newdeplibs " $i" - i= - ;; - esac - fi - if test -n "$i"; then - libname=`eval "\\$ECHO \"$libname_spec\""` - deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` - set dummy $deplib_matches; shift - deplib_match=$1 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then - func_append newdeplibs " $i" - else - droppeddeps=yes - echo - $ECHO "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because a test_compile did reveal that the linker did not use this one" - echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi - fi - else - droppeddeps=yes - echo - $ECHO "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." - fi - ;; - *) - func_append newdeplibs " $i" - ;; - esac - done - fi - ;; file_magic*) set dummy $deplibs_check_method; shift file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` @@ -9614,17 +9706,16 @@ EOF fi if test -n "$a_deplib"; then droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + func_warning "Linker path does not have real file for library $a_deplib." + func_warning "I have the capability to make that library automatically link in when" + func_warning "you link to this library. But I can only do this if you have a" + func_warning "shared version of the library, which you do not appear to have" + func_warning "because I did check the linker path looking for a file starting" if test -z "$potlib"; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + func_warning "with $libname but no candidates were found. (...for file magic test)" else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" + func_warning "with $libname and none of the candidates passed a file format test" + func_warning "using a file magic. Last file checked: $potlib" fi fi ;; @@ -9668,17 +9759,16 @@ EOF fi if test -n "$a_deplib"; then droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + func_warning "Linker path does not have real file for library $a_deplib." + func_warning "I have the capability to make that library automatically link in when" + func_warning "you link to this library. But I can only do this if you have a" + func_warning "shared version of the library, which you do not appear to have" + func_warning "because I did check the linker path looking for a file starting" if test -z "$potlib"; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + func_warning "with $libname but no candidates were found. (...for regex pattern test)" else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" + func_warning "with $libname and none of the candidates passed a file format test" + func_warning "using a regex pattern. Last file checked: $potlib" fi fi ;; @@ -9702,11 +9792,11 @@ EOF *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." + func_warning "Inter-library dependencies are not supported in this platform." else - echo "*** Warning: inter-library dependencies are not known to be supported." + func_warning "Inter-library dependencies are not known to be supported." fi - echo "*** All declared inter-library dependencies are being dropped." + func_warning "All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac @@ -9727,17 +9817,15 @@ EOF if test yes = "$droppeddeps"; then if test yes = "$module"; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." + func_warning "libtool could not satisfy all declared inter-library" + func_warning "dependencies of module $libname. Therefore, libtool will create" + func_warning "a static module, that should work as long as the dlopening" + func_warning "application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using 'nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** 'nm' from GNU binutils and a full rebuild may help." + func_warning "However, this would only work if libtool was able to extract symbol" + func_warning "lists from a program, using 'nm' or equivalent, but libtool could" + func_warning "not find such a program. So, this module is probably useless." + func_warning "'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext @@ -9912,7 +10000,7 @@ EOF orig_export_symbols= case $host_os in - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { @@ -10110,20 +10198,7 @@ EOF last_robj= k=1 - if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then - output=$output_objdir/$output_la.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output @@ -10142,6 +10217,19 @@ EOF func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." @@ -10582,7 +10670,7 @@ EOF esac fi case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; @@ -10660,7 +10748,7 @@ EOF # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; - *cygwin* | *mingw* ) + *cygwin* | *mingw* | *windows* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) @@ -10814,7 +10902,7 @@ EOF *) exeext= ;; esac case $host in - *cygwin* | *mingw* ) + *cygwin* | *mingw* | windows* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result @@ -11148,7 +11236,7 @@ EOF # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *windows*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" diff --git a/modules/freetype2/builds/unix/unix-cc.in b/modules/freetype2/builds/unix/unix-cc.in @@ -2,7 +2,7 @@ # FreeType 2 template for Unix-specific compiler definitions # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -110,10 +110,14 @@ LDFLAGS := @LDFLAGS@ # export symbols # -CCraw_build := @CC_BUILD@ # native CC of building system -E_BUILD := @EXEEXT_BUILD@ # extension for executable on building system -EXPORTS_LIST := $(OBJ_DIR)/ftexport.sym -CCexe := $(CCraw_build) # used to compile `apinames' only +CCraw_build := @CC_BUILD@ # native CC of building system +E_BUILD := @EXEEXT_BUILD@ # extension for executable on + # building system +EXPORTS_LIST := $(OBJ_DIR)/ftexport.sym +CCexe := $(CCraw_build) # used to compile `apinames` only, + # see `exports.mk` +CCexe_CFLAGS := @CFLAGS_BUILD@ # ditto +CCexe_LDFLAGS := @LDFLAGS_BUILD@ # ditto # Library linking. diff --git a/modules/freetype2/builds/unix/unix-def.in b/modules/freetype2/builds/unix/unix-def.in @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/unix-dev.mk b/modules/freetype2/builds/unix/unix-dev.mk @@ -6,7 +6,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/unix-lcc.mk b/modules/freetype2/builds/unix/unix-lcc.mk @@ -6,7 +6,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/unix.mk b/modules/freetype2/builds/unix/unix.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/unix/unixddef.mk b/modules/freetype2/builds/unix/unixddef.mk @@ -4,7 +4,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/vms/apinames_vms.bash b/modules/freetype2/builds/vms/apinames_vms.bash @@ -1,2 +1,2 @@ src/tools/apinames -wV include/freetype/*.h > freetype_vms0.opt -mv freetype_vms0.opt freetype_vms.opt +/gnu/bin/mv freetype_vms0.opt freetype_vms.opt diff --git a/modules/freetype2/builds/vms/ftconfig.h b/modules/freetype2/builds/vms/ftconfig.h @@ -4,7 +4,7 @@ * * VMS-specific configuration file (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/builds/vms/ftsystem.c b/modules/freetype2/builds/vms/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* VMS-specific FreeType low-level system interface (body). */ /* */ -/* Copyright (C) 1996-2024 by */ +/* Copyright (C) 1996-2025 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/builds/vms/patch_ftcalc.sed b/modules/freetype2/builds/vms/patch_ftcalc.sed @@ -0,0 +1,4 @@ +/^# *undef FT_MulFix/ a\ +# ifdef vms_auto64_source\ +# define FT_MulFix FT_MulFix64__\ +# endif diff --git a/modules/freetype2/builds/wince/ftdebug.c b/modules/freetype2/builds/wince/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for WinCE (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/builds/wince/vc2005-ce/freetype.sln b/modules/freetype2/builds/wince/vc2005-ce/freetype.sln @@ -146,7 +146,7 @@ Global {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Releaase|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) diff --git a/modules/freetype2/builds/wince/vc2005-ce/index.html b/modules/freetype2/builds/wince/vc2005-ce/index.html @@ -21,7 +21,7 @@ the following targets: <li>PPC/SP WM6 (Windows Mobile 6)</li> </ul> -It compiles the following libraries from the FreeType 2.13.3 sources:</p> +It compiles the following libraries from the FreeType 2.14.1 sources:</p> <ul> <pre> diff --git a/modules/freetype2/builds/wince/vc2008-ce/index.html b/modules/freetype2/builds/wince/vc2008-ce/index.html @@ -21,7 +21,7 @@ the following targets: <li>PPC/SP WM6 (Windows Mobile 6)</li> </ul> -It compiles the following libraries from the FreeType 2.13.3 sources:</p> +It compiles the following libraries from the FreeType 2.14.1 sources:</p> <ul> <pre> diff --git a/modules/freetype2/builds/windows/detect.mk b/modules/freetype2/builds/windows/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/ftdebug.c b/modules/freetype2/builds/windows/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for Win32 (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -64,7 +64,7 @@ * with the actual log message if set to true. * * 5. The flag `ft_timestamp_flag` prints time along with the actual log - * message if set to ture. + * message if set to true. * * 6. `ft_have_newline_char` is used to differentiate between a log * message with and without a trailing newline character. diff --git a/modules/freetype2/builds/windows/ftsystem.c b/modules/freetype2/builds/windows/ftsystem.c @@ -4,7 +4,7 @@ * * Windows-specific FreeType low-level system interface (body). * - * Copyright (C) 2021-2024 by + * Copyright (C) 2021-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -296,7 +296,7 @@ /* support for really old Windows */ #if defined( _WIN32_WCE ) || defined ( _WIN32_WINDOWS ) || \ - !defined( _WIN32_WINNT ) || _WIN32_WINNT <= 0x0400 + ( defined( _WIN32_WINNT ) && _WIN32_WINNT <= 0x0400 ) FT_LOCAL_DEF( BOOL ) GetFileSizeEx( HANDLE hFile, diff --git a/modules/freetype2/builds/windows/vc2010/index.html b/modules/freetype2/builds/windows/vc2010/index.html @@ -12,7 +12,7 @@ <p>This directory contains solution and project files for Visual&nbsp;C++&nbsp;2010 or newer, named <tt>freetype.sln</tt>, and <tt>freetype.vcxproj</tt>. It compiles the following libraries -from the FreeType 2.13.3 sources:</p> +from the FreeType 2.14.1 sources:</p> <ul> <li>freetype.dll using 'Release' or 'Debug' configurations</li> diff --git a/modules/freetype2/builds/windows/visualc/index.html b/modules/freetype2/builds/windows/visualc/index.html @@ -12,7 +12,7 @@ <p>This directory contains project files <tt>freetype.dsp</tt> for Visual C++ 6.0, and <tt>freetype.vcproj</tt> for Visual C++ 2002 through 2008, which you might need to upgrade automatically. -It compiles the following libraries from the FreeType 2.13.3 sources:</p> +It compiles the following libraries from the FreeType 2.14.1 sources:</p> <ul> <li>freetype.dll using 'Release' or 'Debug' configurations</li> diff --git a/modules/freetype2/builds/windows/visualce/index.html b/modules/freetype2/builds/windows/visualce/index.html @@ -21,7 +21,7 @@ the following targets: <li>PPC/SP WM6 (Windows Mobile 6)</li> </ul> -It compiles the following libraries from the FreeType 2.13.3 sources:</p> +It compiles the following libraries from the FreeType 2.14.1 sources:</p> <ul> <pre> diff --git a/modules/freetype2/builds/windows/w32-bcc.mk b/modules/freetype2/builds/windows/w32-bcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-bccd.mk b/modules/freetype2/builds/windows/w32-bccd.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-dev.mk b/modules/freetype2/builds/windows/w32-dev.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-gcc.mk b/modules/freetype2/builds/windows/w32-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-icc.mk b/modules/freetype2/builds/windows/w32-icc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-intl.mk b/modules/freetype2/builds/windows/w32-intl.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-lcc.mk b/modules/freetype2/builds/windows/w32-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-mingw32.mk b/modules/freetype2/builds/windows/w32-mingw32.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-vcc.mk b/modules/freetype2/builds/windows/w32-vcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/w32-wat.mk b/modules/freetype2/builds/windows/w32-wat.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/builds/windows/win32-def.mk b/modules/freetype2/builds/windows/win32-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/configure b/modules/freetype2/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2002-2024 by +# Copyright (C) 2002-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/devel/ft2build.h b/modules/freetype2/devel/ft2build.h @@ -4,7 +4,7 @@ * * FreeType 2 build and setup macros (development version). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/devel/ftoption.h b/modules/freetype2/devel/ftoption.h @@ -4,7 +4,7 @@ * * User-selectable configuration macros (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -158,12 +158,12 @@ FT_BEGIN_HEADER /************************************************************************** * - * If this macro is defined, try to use an inlined assembler version of the - * @FT_MulFix function, which is a 'hotspot' when loading and hinting - * glyphs, and which should be executed as fast as possible. + * If this macro is defined, try to use an inlined 64-bit or assembler + * version of the @FT_MulFix function, which is a 'hotspot' when loading + * and hinting glyphs, and which should be executed as fast as possible. * - * Note that if your compiler or CPU is not supported, this will default to - * the standard and portable implementation found in `ftcalc.c`. + * If your compiler is not C99-compliant or CPU assembly is not supported, + * you can disable this option. */ #define FT_CONFIG_OPTION_INLINE_MULFIX @@ -295,6 +295,31 @@ FT_BEGIN_HEADER /************************************************************************** * + * HarfBuzz dynamic support. + * + * Define this macro if you want the HarfBuzz library to be loaded at + * runtime instead of being linked to FreeType. + * + * This option has no effect if `FT_CONFIG_OPTION_USE_HARFBUZZ` is not + * defined. + * + * When this option is enabled, FreeType will try to load the HarfBuzz + * library at runtime, using `dlopen` or `LoadLibrary`, depending on the + * platform. On Microsoft platforms, the library name looked up is + * `libharfbuzz-0.dll`. On Apple platforms, the library name looked up + * is `libharfbuzz.0.dylib`. On all other platforms, the library name + * looked up is `libharfbuzz.so.0`. This name can be overridden by + * defining the macro `FT_LIBHARFBUZZ` at FreeType compilation time. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +#define FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC + + + /************************************************************************** + * * Brotli support. * * FreeType uses the Brotli library to provide support for decompressing @@ -679,7 +704,7 @@ FT_BEGIN_HEADER * defined. * * [1] - * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx + * https://learn.microsoft.com/typography/cleartype/truetypecleartype */ #define TT_CONFIG_OPTION_SUBPIXEL_HINTING @@ -697,7 +722,7 @@ FT_BEGIN_HEADER * flags array which can be used to disambiguate, but old fonts will not * have them. * - * https://www.microsoft.com/typography/otspec/glyf.htm + * https://learn.microsoft.com/typography/opentype/spec/glyf * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -760,10 +785,10 @@ FT_BEGIN_HEADER /************************************************************************** * * 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. + * implementation (for TrueType and OpenType 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 diff --git a/modules/freetype2/include/freetype/config/ftconfig.h b/modules/freetype2/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ * * ANSI-specific configuration file (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/config/ftheader.h b/modules/freetype2/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ * * Build macros of the FreeType 2 library. * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/config/ftoption.h b/modules/freetype2/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ * * User-selectable configuration macros (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -158,12 +158,12 @@ FT_BEGIN_HEADER /************************************************************************** * - * If this macro is defined, try to use an inlined assembler version of the - * @FT_MulFix function, which is a 'hotspot' when loading and hinting - * glyphs, and which should be executed as fast as possible. + * If this macro is defined, try to use an inlined 64-bit or assembler + * version of the @FT_MulFix function, which is a 'hotspot' when loading + * and hinting glyphs, and which should be executed as fast as possible. * - * Note that if your compiler or CPU is not supported, this will default to - * the standard and portable implementation found in `ftcalc.c`. + * If your compiler is not C99-compliant or CPU assembly is not supported, + * you can disable this option. */ #define FT_CONFIG_OPTION_INLINE_MULFIX @@ -295,6 +295,31 @@ FT_BEGIN_HEADER /************************************************************************** * + * HarfBuzz dynamic support. + * + * Define this macro if you want the HarfBuzz library to be loaded at + * runtime instead of being linked to FreeType. + * + * This option has no effect if `FT_CONFIG_OPTION_USE_HARFBUZZ` is not + * defined. + * + * When this option is enabled, FreeType will try to load the HarfBuzz + * library at runtime, using `dlopen` or `LoadLibrary`, depending on the + * platform. On Microsoft platforms, the library name looked up is + * `libharfbuzz-0.dll`. On Apple platforms, the library name looked up + * is `libharfbuzz.0.dylib`. On all other platforms, the library name + * looked up is `libharfbuzz.so.0`. This name can be overridden by + * defining the macro `FT_LIBHARFBUZZ` at FreeType compilation time. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +/* #define FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */ + + + /************************************************************************** + * * Brotli support. * * FreeType uses the Brotli library to provide support for decompressing @@ -679,7 +704,7 @@ FT_BEGIN_HEADER * defined. * * [1] - * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx + * https://learn.microsoft.com/typography/cleartype/truetypecleartype */ #define TT_CONFIG_OPTION_SUBPIXEL_HINTING @@ -697,7 +722,7 @@ FT_BEGIN_HEADER * flags array which can be used to disambiguate, but old fonts will not * have them. * - * https://www.microsoft.com/typography/otspec/glyf.htm + * https://learn.microsoft.com/typography/opentype/spec/glyf * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -760,10 +785,10 @@ FT_BEGIN_HEADER /************************************************************************** * * 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. + * implementation (for TrueType and OpenType 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 diff --git a/modules/freetype2/include/freetype/config/ftstdlib.h b/modules/freetype2/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ * ANSI-specific library and header configuration file (specification * only). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/config/integer-types.h b/modules/freetype2/include/freetype/config/integer-types.h @@ -4,7 +4,7 @@ * * FreeType integer types definitions. * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,6 +17,8 @@ #ifndef FREETYPE_CONFIG_INTEGER_TYPES_H_ #define FREETYPE_CONFIG_INTEGER_TYPES_H_ +FT_BEGIN_HEADER + /* There are systems (like the Texas Instruments 'C54x) where a `char` */ /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */ /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */ @@ -242,9 +244,34 @@ #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ #ifdef FT_INT64 + typedef FT_INT64 FT_Int64; typedef FT_UINT64 FT_UInt64; -#endif +# define FT_INT64_ZERO 0 + +#else /* !FT_INT64 */ + + /* we need to emulate 64-bit data types if none are available */ + + typedef struct FT_Int64_ + { + FT_UInt32 lo; + FT_UInt32 hi; + + } FT_Int64; + + typedef struct FT_UInt64_ + { + FT_UInt32 lo; + FT_UInt32 hi; + + } FT_UInt64; + +# define FT_INT64_ZERO { 0, 0 } + +#endif /* !FT_INT64 */ + +FT_END_HEADER #endif /* FREETYPE_CONFIG_INTEGER_TYPES_H_ */ diff --git a/modules/freetype2/include/freetype/config/mac-support.h b/modules/freetype2/include/freetype/config/mac-support.h @@ -4,7 +4,7 @@ * * Mac/OS X support configuration header. * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/config/public-macros.h b/modules/freetype2/include/freetype/config/public-macros.h @@ -4,7 +4,7 @@ * * Define a set of compiler macros used in public FreeType headers. * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -62,8 +62,8 @@ FT_BEGIN_HEADER * because it is needed by `FT_EXPORT`. */ - /* Visual C, mingw */ -#if defined( _WIN32 ) + /* Visual C, MinGW, Cygwin */ +#if defined( _WIN32 ) || defined( __CYGWIN__ ) #if defined( FT2_BUILD_LIBRARY ) && defined( DLL_EXPORT ) #define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllexport ) diff --git a/modules/freetype2/include/freetype/freetype.h b/modules/freetype2/include/freetype/freetype.h @@ -4,7 +4,7 @@ * * FreeType high-level API and common types (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -811,7 +811,7 @@ FT_BEGIN_HEADER * FT_ENCODING_MS_SYMBOL :: * Microsoft Symbol encoding, used to encode mathematical symbols and * wingdings. For more information, see - * 'https://www.microsoft.com/typography/otspec/recom.htm#non-standard-symbol-fonts', + * 'https://learn.microsoft.com/typography/opentype/spec/recom#non-standard-symbol-fonts', * 'http://www.kostis.net/charsets/symbol.htm', and * 'http://www.kostis.net/charsets/wingding.htm'. * @@ -1068,12 +1068,12 @@ FT_BEGIN_HEADER * the face in the font file (starting with value~0). They are set * to~0 if there is only one face in the font file. * - * [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType variation - * fonts only, holding the named instance index for the current face - * index (starting with value~1; value~0 indicates font access without - * a named instance). For non-variation fonts, bits 16-30 are ignored. - * If we have the third named instance of face~4, say, `face_index` is - * set to 0x00030004. + * [Since 2.6.1] Bits 16-30 are relevant to TrueType GX and OpenType + * Font Variations only, holding the named instance index for the + * current face index (starting with value~1; value~0 indicates font + * access without a named instance). For non-variation fonts, bits + * 16-30 are ignored. If we have the third named instance of face~4, + * say, `face_index` is set to 0x00030004. * * Bit 31 is always zero (that is, `face_index` is always a positive * value). @@ -1092,10 +1092,10 @@ FT_BEGIN_HEADER * the face; see @FT_STYLE_FLAG_XXX for the details. * * [Since 2.6.1] Bits 16-30 hold the number of named instances - * available for the current face if we have a GX or OpenType variation - * (sub)font. Bit 31 is always zero (that is, `style_flags` is always - * a positive value). Note that a variation font has always at least - * one named instance, namely the default instance. + * available for the current face if we have a TrueType GX or OpenType + * Font Variation. Bit 31 is always zero (that is, `style_flags` is + * always a positive value). Note that a variation font has always at + * least one named instance, namely the default instance. * * num_glyphs :: * The number of glyphs in the face. If the face is scalable and has @@ -1159,7 +1159,7 @@ FT_BEGIN_HEADER * Note that the bounding box might be off by (at least) one pixel for * hinted fonts. See @FT_Size_Metrics for further discussion. * - * Note that the bounding box does not vary in OpenType variation fonts + * Note that the bounding box does not vary in OpenType Font Variations * and should only be used in relation to the default instance. * * units_per_EM :: @@ -1218,7 +1218,7 @@ FT_BEGIN_HEADER * Fields may be changed after a call to @FT_Attach_File or * @FT_Attach_Stream. * - * For an OpenType variation font, the values of the following fields can + * For OpenType Font Variations, the values of the following fields can * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if * the font contains an 'MVAR' table: `ascender`, `descender`, `height`, * `underline_position`, and `underline_thickness`. @@ -1336,7 +1336,7 @@ FT_BEGIN_HEADER * FT_FACE_FLAG_MULTIPLE_MASTERS :: * The face contains multiple masters and is capable of interpolating * between them. Supported formats are Adobe MM, TrueType GX, and - * OpenType variation fonts. + * OpenType Font Variations. * * See section @multiple_masters for API details. * @@ -1609,7 +1609,7 @@ FT_BEGIN_HEADER * * @description: * A macro that returns true whenever a face object is a named instance - * of a GX or OpenType variation font. + * of a TrueType GX or OpenType Font Variations. * * [Since 2.9] Changing the design coordinates with * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does @@ -2147,7 +2147,7 @@ FT_BEGIN_HEADER * freed. * * [Since 2.10.1] If @FT_LOAD_NO_SCALE is set, outline coordinates of - * OpenType variation fonts for a selected instance are internally + * OpenType Font Variations for a selected instance are internally * handled as 26.6 fractional font units but returned as (rounded) * integers, as expected. To get unrounded font units, don't use * @FT_LOAD_NO_SCALE but load the glyph with @FT_LOAD_NO_HINTING and @@ -2640,14 +2640,14 @@ FT_BEGIN_HEADER * the face in the font file (starting with value~0). Set it to~0 if * there is only one face in the font file. * - * [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType variation - * fonts only, specifying the named instance index for the current face - * index (starting with value~1; value~0 makes FreeType ignore named - * instances). For non-variation fonts, bits 16-30 are ignored. - * Assuming that you want to access the third named instance in face~4, - * `face_index` should be set to 0x00030004. If you want to access - * face~4 without variation handling, simply set `face_index` to - * value~4. + * [Since 2.6.1] Bits 16-30 are relevant to TrueType GX and OpenType + * Font Variations only, specifying the named instance index for the + * current face index (starting with value~1; value~0 makes FreeType + * ignore named instances). For non-variation fonts, bits 16-30 are + * ignored. Assuming that you want to access the third named instance + * in face~4, `face_index` should be set to 0x00030004. If you want + * to access face~4 without variation handling, simply set + * `face_index` to value~4. * * `FT_Open_Face` and its siblings can be used to quickly check whether * the font format of a given font resource is supported by FreeType. @@ -2914,11 +2914,11 @@ FT_BEGIN_HEADER * of the available glyphs at a given ppem value is available. FreeType * silently uses outlines if there is no bitmap for a given glyph index. * - * For GX and OpenType variation fonts, a bitmap strike makes sense only - * if the default instance is active (that is, no glyph variation takes - * place); otherwise, FreeType simply ignores bitmap strikes. The same - * is true for all named instances that are different from the default - * instance. + * For TrueType GX and OpenType Font Variations, a bitmap strike makes + * sense only if the default instance is active (that is, no glyph + * variation takes place); otherwise, FreeType simply ignores bitmap + * strikes. The same is true for all named instances that are different + * from the default instance. * * Don't use this function if you are using the FreeType cache API. */ @@ -3078,7 +3078,7 @@ FT_BEGIN_HEADER * is dependent entirely on how the size is defined in the source face. * The font designer chooses the final size of each glyph relative to * this size. For more information refer to - * 'https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'. + * 'https://freetype.org/freetype2/docs/glyphs/glyphs-2.html'. * * Contrary to @FT_Set_Char_Size, this function doesn't have special code * to normalize zero-valued widths, heights, or resolutions, which are @@ -3441,8 +3441,10 @@ FT_BEGIN_HEADER * blending of the color glyph layers associated with the glyph index, * using the same bitmap format as embedded color bitmap images. This * is mainly for convenience and works only for glyphs in 'COLR' v0 - * tables (or glyphs in 'COLR' v1 tables that exclusively use v0 - * features). For full control of color layers use + * tables. **There is no rendering support for 'COLR' v1** (with the + * exception of v1 tables that exclusively use v0 features)! You need + * a graphics library like Skia or Cairo to interpret the graphics + * commands stored in v1 tables. For full control of color layers use * @FT_Get_Color_Glyph_Layer and FreeType's color functions like * @FT_Palette_Select instead of setting @FT_LOAD_COLOR for rendering * so that the client application can handle blending by itself. @@ -3895,8 +3897,10 @@ FT_BEGIN_HEADER * * This process can cost performance. There is an approximation that * does not need to know about the background color; see - * https://bel.fi/alankila/lcd/ and - * https://bel.fi/alankila/lcd/alpcor.html for details. + * https://web.archive.org/web/20211019204945/https://bel.fi/alankila/lcd/ + * and + * https://web.archive.org/web/20210211002939/https://bel.fi/alankila/lcd/alpcor.html + * for details. * * **ATTENTION**: Linear blending is even more important when dealing * with subpixel-rendered glyphs to prevent color-fringing! A @@ -3993,13 +3997,13 @@ FT_BEGIN_HEADER * out of the scope of this API function -- they can be implemented * through format-specific interfaces. * - * 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. + * Note that, for TrueType and OpenType 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 @@ -4530,7 +4534,7 @@ FT_BEGIN_HEADER * table description in the OpenType specification for the meaning of the * various flags (which get synthesized for non-OpenType subglyphs). * - * https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#composite-glyph-description + * https://learn.microsoft.com/typography/opentype/spec/glyf#composite-glyph-description * * @values: * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: @@ -4593,7 +4597,7 @@ FT_BEGIN_HEADER * interpreted depending on the flags returned in `*p_flags`. See the * OpenType specification for details. * - * https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#composite-glyph-description + * https://learn.microsoft.com/typography/opentype/spec/glyf#composite-glyph-description * */ FT_EXPORT( FT_Error ) @@ -4619,7 +4623,7 @@ FT_BEGIN_HEADER * associated with a font. * * See - * https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf + * https://adobe-type-tools.github.io/font-tech-notes/pdfs/AcrobatDC_FontPolicies.pdf * for more details. * * @values: @@ -5173,8 +5177,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 13 -#define FREETYPE_PATCH 3 +#define FREETYPE_MINOR 14 +#define FREETYPE_PATCH 1 /************************************************************************** diff --git a/modules/freetype2/include/freetype/ftadvanc.h b/modules/freetype2/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ * * Quick computation of advance widths (specification only). * - * Copyright (C) 2008-2024 by + * Copyright (C) 2008-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftbbox.h b/modules/freetype2/include/freetype/ftbbox.h @@ -4,7 +4,7 @@ * * FreeType exact bbox computation (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftbdf.h b/modules/freetype2/include/freetype/ftbdf.h @@ -4,7 +4,7 @@ * * FreeType API for accessing BDF-specific strings (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftbitmap.h b/modules/freetype2/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftbzip2.h b/modules/freetype2/include/freetype/ftbzip2.h @@ -4,7 +4,7 @@ * * Bzip2-compressed stream support. * - * Copyright (C) 2010-2024 by + * Copyright (C) 2010-2025 by * Joel Klinghed. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftcache.h b/modules/freetype2/include/freetype/ftcache.h @@ -4,7 +4,7 @@ * * FreeType Cache subsystem (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftcid.h b/modules/freetype2/include/freetype/ftcid.h @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information (specification). * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 by * Dereg Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftcolor.h b/modules/freetype2/include/freetype/ftcolor.h @@ -4,7 +4,7 @@ * * FreeType's glyph color management (specification). * - * Copyright (C) 2018-2024 by + * Copyright (C) 2018-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -317,6 +317,15 @@ FT_BEGIN_HEADER * @description: * The functions described here allow access of colored glyph layer data * in OpenType's 'COLR' tables. + * + * Note that FreeType does *not* provide rendering in general of glyphs + * that use a 'COLR' table! While FreeType has very limited rendering + * support for 'COLR' v0 tables (without a possibility to change the + * color palette) via @FT_Render_Glyph, there is no such convenience + * code for 'COLR' v1 tables -- while it appears that v1 is simply an + * 'improved' version of v0, this is not the case: it is a completely + * different color font format, and you need a dedicated graphics + * library like Skia or Cairo to handle a v1 table's drawing commands. */ @@ -359,7 +368,7 @@ FT_BEGIN_HEADER * iteratively retrieve the colored glyph layers associated with the * current glyph slot. * - * https://docs.microsoft.com/en-us/typography/opentype/spec/colr + * https://learn.microsoft.com/typography/opentype/spec/colr * * The glyph layer data for a given glyph index, if present, provides an * alternative, multi-color glyph representation: Instead of rendering @@ -1518,7 +1527,7 @@ FT_BEGIN_HEADER * * @return: * Value~1 if a clip box is found. If no clip box is found or an error - * occured, value~0 is returned. + * occurred, value~0 is returned. * * @note: * To retrieve the clip box in font units, reset scale to units-per-em @@ -1646,7 +1655,7 @@ FT_BEGIN_HEADER * * @return: * Value~1 if everything is OK. Value~0 if no details can be found for - * this paint or any other error occured. + * this paint or any other error occurred. * * @since: * 2.13 diff --git a/modules/freetype2/include/freetype/ftdriver.h b/modules/freetype2/include/freetype/ftdriver.h @@ -4,7 +4,7 @@ * * FreeType API for controlling driver modules (specification only). * - * Copyright (C) 2017-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -282,7 +282,7 @@ FT_BEGIN_HEADER * minimize hinting techniques that were problematic with the extra * resolution of ClearType; see * http://rastertragedy.com/RTRCh4.htm#Sec1 and - * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. + * https://learn.microsoft.com/typography/cleartype/truetypecleartype. * This technique is not to be confused with ClearType compatible widths. * ClearType backward compatibility has no direct impact on changing * advance widths, but there might be an indirect impact on disabling @@ -784,7 +784,7 @@ FT_BEGIN_HEADER * * Details on subpixel hinting and some of the necessary tweaks can be * found in Greg Hitchcock's whitepaper at - * 'https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * 'https://learn.microsoft.com/typography/cleartype/truetypecleartype'. * Note that FreeType currently doesn't really 'subpixel hint' (6x1, 6x2, * or 6x5 supersampling) like discussed in the paper. Depending on the * chosen interpreter, it simply ignores instructions on vertical stems diff --git a/modules/freetype2/include/freetype/fterrdef.h b/modules/freetype2/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ * * FreeType error codes (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/fterrors.h b/modules/freetype2/include/freetype/fterrors.h @@ -4,7 +4,7 @@ * * FreeType error code handling (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftfntfmt.h b/modules/freetype2/include/freetype/ftfntfmt.h @@ -4,7 +4,7 @@ * * Support functions for font formats. * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftgasp.h b/modules/freetype2/include/freetype/ftgasp.h @@ -4,7 +4,7 @@ * * Access of TrueType's 'gasp' table (specification). * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftglyph.h b/modules/freetype2/include/freetype/ftglyph.h @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftgxval.h b/modules/freetype2/include/freetype/ftgxval.h @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * Masatake YAMATO, Redhat K.K, * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/include/freetype/ftgzip.h b/modules/freetype2/include/freetype/ftgzip.h @@ -4,7 +4,7 @@ * * Gzip-compressed stream support. * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftimage.h b/modules/freetype2/include/freetype/ftimage.h @@ -5,7 +5,7 @@ * FreeType glyph image formats and default raster interface * (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -267,6 +267,10 @@ FT_BEGIN_HEADER * *logical* one. For example, if @FT_Pixel_Mode is set to * `FT_PIXEL_MODE_LCD`, the logical width is a just a third of the * physical one. + * + * An empty bitmap with a NULL `buffer` is valid, with `rows` and/or + * `pitch` also set to 0. Such bitmaps might be produced while rendering + * empty or degenerate outlines. */ typedef struct FT_Bitmap_ { @@ -439,7 +443,7 @@ FT_BEGIN_HEADER * rasterizer; see the `tags` field in @FT_Outline. * * Please refer to the description of the 'SCANTYPE' instruction in the - * [OpenType specification](https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#scantype) + * [OpenType specification](https://learn.microsoft.com/typography/opentype/spec/tt_instructions#scantype) * how simple drop-outs, smart drop-outs, and stubs are defined. */ #define FT_OUTLINE_NONE 0x0 diff --git a/modules/freetype2/include/freetype/ftincrem.h b/modules/freetype2/include/freetype/ftincrem.h @@ -4,7 +4,7 @@ * * FreeType incremental loading (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftlcdfil.h b/modules/freetype2/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ * FreeType API for color filtering of subpixel bitmap glyphs * (specification). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftlist.h b/modules/freetype2/include/freetype/ftlist.h @@ -4,7 +4,7 @@ * * Generic list support for FreeType (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftlogging.h b/modules/freetype2/include/freetype/ftlogging.h @@ -4,7 +4,7 @@ * * Additional debugging APIs. * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftlzw.h b/modules/freetype2/include/freetype/ftlzw.h @@ -4,7 +4,7 @@ * * LZW-compressed stream support. * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftmac.h b/modules/freetype2/include/freetype/ftmac.h @@ -4,7 +4,7 @@ * * Additional Mac-specific API. * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 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/modules/freetype2/include/freetype/ftmm.h b/modules/freetype2/include/freetype/ftmm.h @@ -2,9 +2,9 @@ * * ftmm.h * - * FreeType Multiple Master font interface (specification). + * FreeType variation font interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -37,24 +37,79 @@ FT_BEGIN_HEADER * multiple_masters * * @title: - * Multiple Masters + * OpenType Font Variations, TrueType GX, and Adobe MM Fonts * * @abstract: - * How to manage Multiple Masters fonts. + * How to manage variable fonts with multiple design axes. * * @description: - * The following types and functions are used to manage Multiple Master - * fonts, i.e., the selection of specific design instances by setting - * design axis coordinates. - * - * Besides Adobe MM fonts, the interface supports Apple's TrueType GX and - * OpenType variation fonts. Some of the routines only work with Adobe - * MM fonts, others will work with all three types. They are similar - * enough that a consistent interface makes sense. - * - * For Adobe MM fonts, macro @FT_IS_SFNT returns false. For GX and - * OpenType variation fonts, it returns true. - * + * The following types and functions manage OpenType Font Variations, + * Adobe Multiple Master (MM) fonts, and Apple TrueType GX fonts. These + * formats have in common that they allow the selection of specific + * design instances by setting design coordinates for one or more axes + * like font weight or width. + * + * For historical reasons there are two interfaces. The first, older one + * can be used with Adobe MM fonts only, and the second, newer one is a + * unified interface that handles all three font formats. However, some + * differences remain and are documented accordingly; in particular, + * Adobe MM fonts don't have named instances (see below). + * + * For Adobe MM fonts, macro @FT_IS_SFNT returns false. For TrueType GX + * and OpenType Font Variations, it returns true. + * + * We use mostly the terminology of the OpenType standard. Here are some + * important technical terms. + * + * * A 'named instance' is a tuple of design coordinates that has a + * string ID (i.e., an index into the font's 'name' table) associated + * with it. The font can tell the user that, for example, + * [Weight=700,Width=110] is 'Bold'. Another name for 'named instance' + * is 'named style'. + * + * Adobe MM fonts don't have named instances. + * + * * The 'default instance' of a variation font is that instance for + * which the nth axis coordinate is equal to the nth default axis + * coordinate (i.e., `axis[n].def` as specified in the @FT_MM_Var + * structure), with~n covering all axes. In TrueType GX and OpenType + * Font Variations, the default instance is explicitly given. In Adobe + * MM fonts, the `WeightVector` entry as found in the font file is + * taken as the default instance. + * + * For TrueType GX and OpenType Font Variations, FreeType synthesizes + * a named instance for the default instance if the font does not + * contain such an entry. + * + * * 'Design coordinates' are the axis values found in a variation font + * file. Their meaning is specified by the font designer and the + * values are rather arbitrary. + * + * For example, the 'weight' axis in design coordinates might vary + * between 100 (thin) and 900 (heavy) in font~A, while font~B + * contains values between 400 (normal) and 800 (extra bold). + * + * * 'Normalized coordinates' are design coordinates mapped to a standard + * range; they are also called 'blend coordinates'. + * + * For TrueType GX and OpenType Font Variations, the range is [-1;1], + * with the minimum mapped to value~-1, the default mapped to + * value~0, and the maximum mapped to value~1, and all other + * coordinates mapped to intervening points. Please look up the + * [OpenType + * specification](https://learn.microsoft.com/en-us/typography/opentype/spec/otvaroverview) + * on how this mapping works in detail. + * + * For Adobe MM fonts, this standard range is [0;1], with the minimum + * mapped to value~0 and the maximum mapped to value~1, and all other + * coordinates mapped to intervening points. Please look up [Adobe + * TechNote + * #5015](https://adobe-type-tools.github.io/font-tech-notes/pdfs/5015.Type1_Supp.pdf) + * on how this mapping works in detail. + * + * Assuming that the two fonts in the previous example are OpenType + * Font Variations, both font~A's [100;900] and font~B's [400;800] + * coordinate ranges get mapped to [-1;1]. */ @@ -64,14 +119,14 @@ FT_BEGIN_HEADER * T1_MAX_MM_XXX * * @description: - * Multiple Masters limits as defined in their specifications. + * Adobe MM font limits as defined in their specifications. * * @values: * T1_MAX_MM_AXIS :: - * The maximum number of Multiple Masters axes. + * The maximum number of Adobe MM font axes. * * T1_MAX_MM_DESIGNS :: - * The maximum number of Multiple Masters designs. + * The maximum number of Adobe MM font designs. * * T1_MAX_MM_MAP_POINTS :: * The maximum number of elements in a design map. @@ -88,11 +143,10 @@ FT_BEGIN_HEADER * FT_MM_Axis * * @description: - * A structure to model a given axis in design space for Multiple Masters - * fonts. + * A structure to model a given axis in design space for Adobe MM fonts. * - * This structure can't be used for TrueType GX or OpenType variation - * fonts. + * This structure can't be used with TrueType GX or OpenType Font + * Variations. * * @fields: * name :: @@ -119,17 +173,17 @@ FT_BEGIN_HEADER * FT_Multi_Master * * @description: - * A structure to model the axes and space of a Multiple Masters font. + * A structure to model the axes and space of an Adobe MM font. * - * This structure can't be used for TrueType GX or OpenType variation - * fonts. + * This structure can't be used with TrueType GX or OpenType Font + * Variations. * * @fields: * num_axis :: * Number of axes. Cannot exceed~4. * * num_designs :: - * Number of designs; should be normally 2^num_axis even though the + * Number of designs; should be normally `2^num_axis` even though the * Type~1 specification strangely allows for intermediate designs to be * present. This number cannot exceed~16. * @@ -151,13 +205,13 @@ FT_BEGIN_HEADER * FT_Var_Axis * * @description: - * A structure to model a given axis in design space for Multiple - * Masters, TrueType GX, and OpenType variation fonts. + * A structure to model a given axis in design space for Adobe MM fonts, + * TrueType GX, and OpenType Font Variations. * * @fields: * name :: * The axis's name. Not always meaningful for TrueType GX or OpenType - * variation fonts. + * Font Variations. * * minimum :: * The axis's minimum design coordinate. @@ -171,17 +225,17 @@ FT_BEGIN_HEADER * * tag :: * The axis's tag (the equivalent to 'name' for TrueType GX and - * OpenType variation fonts). FreeType provides default values for + * OpenType Font Variations). FreeType provides default values for * Adobe MM fonts if possible. * * strid :: * The axis name entry in the font's 'name' table. This is another * (and often better) version of the 'name' field for TrueType GX or - * OpenType variation fonts. Not meaningful for Adobe MM fonts. + * OpenType Font Variations. Not meaningful for Adobe MM fonts. * * @note: * The fields `minimum`, `def`, and `maximum` are 16.16 fractional values - * for TrueType GX and OpenType variation fonts. For Adobe MM fonts, the + * for TrueType GX and OpenType Font Variations. For Adobe MM fonts, the * values are whole numbers (i.e., the fractional part is zero). */ typedef struct FT_Var_Axis_ @@ -205,7 +259,7 @@ FT_BEGIN_HEADER * * @description: * A structure to model a named instance in a TrueType GX or OpenType - * variation font. + * Font Variations. * * This structure can't be used for Adobe MM fonts. * @@ -215,11 +269,11 @@ FT_BEGIN_HEADER * entry for each axis. * * strid :: - * The entry in 'name' table identifying this instance. + * An index into the 'name' table identifying this instance. * * psid :: - * The entry in 'name' table identifying a PostScript name for this - * instance. Value 0xFFFF indicates a missing entry. + * An index into the 'name' table identifying a PostScript name for + * this instance. Value 0xFFFF indicates a missing entry. */ typedef struct FT_Var_Named_Style_ { @@ -236,39 +290,33 @@ FT_BEGIN_HEADER * FT_MM_Var * * @description: - * A structure to model the axes and space of an Adobe MM, TrueType GX, - * or OpenType variation font. + * A structure to model the axes and space of Adobe MM fonts, TrueType + * GX, or OpenType Font Variations. * * Some fields are specific to one format and not to the others. * * @fields: * num_axis :: * The number of axes. The maximum value is~4 for Adobe MM fonts; no - * limit in TrueType GX or OpenType variation fonts. + * limit in TrueType GX or OpenType Font Variations. * * num_designs :: - * The number of designs; should be normally 2^num_axis for Adobe MM - * fonts. Not meaningful for TrueType GX or OpenType variation fonts + * The number of designs; should be normally `2^num_axis` for Adobe MM + * fonts. Not meaningful for TrueType GX or OpenType Font Variations * (where every glyph could have a different number of designs). * * num_namedstyles :: - * The number of named styles; a 'named style' is a tuple of design - * coordinates that has a string ID (in the 'name' table) associated - * with it. The font can tell the user that, for example, - * [Weight=1.5,Width=1.1] is 'Bold'. Another name for 'named style' is - * 'named instance'. - * - * For Adobe Multiple Masters fonts, this value is always zero because - * the format does not support named styles. + * The number of named instances. For Adobe MM fonts, this value is + * always zero. * * axis :: - * An axis descriptor table. TrueType GX and OpenType variation fonts + * An axis descriptor table. TrueType GX and OpenType Font Variations * contain slightly more data than Adobe MM fonts. Memory management * of this pointer is done internally by FreeType. * * namedstyle :: - * A named style (instance) table. Only meaningful for TrueType GX and - * OpenType variation fonts. Memory management of this pointer is done + * An array of named instances. Only meaningful for TrueType GX and + * OpenType Font Variations. Memory management of this pointer is done * internally by FreeType. */ typedef struct FT_MM_Var_ @@ -290,8 +338,8 @@ FT_BEGIN_HEADER * @description: * Retrieve a variation descriptor of a given Adobe MM font. * - * This function can't be used with TrueType GX or OpenType variation - * fonts. + * This function can't be used with TrueType GX or OpenType Font + * Variations. * * @input: * face :: @@ -299,7 +347,7 @@ FT_BEGIN_HEADER * * @output: * amaster :: - * The Multiple Masters descriptor. + * The Adobe MM font's variation descriptor. * * @return: * FreeType error code. 0~means success. @@ -366,8 +414,8 @@ FT_BEGIN_HEADER * For Adobe MM fonts, choose an interpolated font design through design * coordinates. * - * This function can't be used with TrueType GX or OpenType variation - * fonts. + * This function can't be used with TrueType GX or OpenType Font + * Variations. * * @inout: * face :: @@ -391,8 +439,8 @@ FT_BEGIN_HEADER * * [Since 2.9] If `num_coords` is larger than zero, this function sets * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field - * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero, - * this bit flag gets unset. + * (i.e., @FT_IS_VARIATION returns true). If `num_coords` is zero, this + * bit flag gets unset. */ FT_EXPORT( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, @@ -428,7 +476,7 @@ FT_BEGIN_HEADER * * @note: * The design coordinates are 16.16 fractional values for TrueType GX and - * OpenType variation fonts. For Adobe MM fonts, the values are supposed + * OpenType Font Variations. For Adobe MM fonts, the values are supposed * to be whole numbers (i.e., the fractional part is zero). * * [Since 2.8.1] To reset all axes to the default values, call the @@ -438,8 +486,14 @@ FT_BEGIN_HEADER * * [Since 2.9] If `num_coords` is larger than zero, this function sets * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field - * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero, - * this bit flag gets unset. + * (i.e., @FT_IS_VARIATION returns true). If `num_coords` is zero, this + * bit flag gets unset. + * + * [Since 2.14] This function also sets the @FT_FACE_FLAG_VARIATION bit + * in @FT_Face's `face_flags` field (i.e., @FT_IS_VARIATION returns + * true) if any of the provided coordinates is different from the face's + * default value for the corresponding axis, that is, the set up face is + * not at its default position. */ FT_EXPORT( FT_Error ) FT_Set_Var_Design_Coordinates( FT_Face face, @@ -468,14 +522,14 @@ FT_BEGIN_HEADER * * @output: * coords :: - * The design coordinates array. + * The design coordinates array, which must be allocated by the user. * * @return: * FreeType error code. 0~means success. * * @note: * The design coordinates are 16.16 fractional values for TrueType GX and - * OpenType variation fonts. For Adobe MM fonts, the values are whole + * OpenType Font Variations. For Adobe MM fonts, the values are whole * numbers (i.e., the fractional part is zero). * * @since: @@ -493,8 +547,7 @@ FT_BEGIN_HEADER * FT_Set_MM_Blend_Coordinates * * @description: - * Choose an interpolated font design through normalized blend - * coordinates. + * Choose an interpolated font design through normalized coordinates. * * This function works with all supported variation formats. * @@ -509,9 +562,10 @@ FT_BEGIN_HEADER * the number of axes, use default values for the remaining axes. * * coords :: - * The design coordinates array. Each element is a 16.16 fractional - * value and must be between 0 and 1.0 for Adobe MM fonts, and between - * -1.0 and 1.0 for TrueType GX and OpenType variation fonts. + * The normalized coordinates array. Each element is a 16.16 + * fractional value and must be between 0 and 1.0 for Adobe MM fonts, + * and between -1.0 and 1.0 for TrueType GX and OpenType Font + * Variations. * * @return: * FreeType error code. 0~means success. @@ -524,8 +578,14 @@ FT_BEGIN_HEADER * * [Since 2.9] If `num_coords` is larger than zero, this function sets * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field - * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero, - * this bit flag gets unset. + * (i.e., @FT_IS_VARIATION returns true). If `num_coords` is zero, this + * bit flag gets unset. + * + * [Since 2.14] This function also sets the @FT_FACE_FLAG_VARIATION bit + * in @FT_Face's `face_flags` field (i.e., @FT_IS_VARIATION returns + * true) if any of the provided coordinates is different from the face's + * default value for the corresponding axis, that is, the set up face is + * not at its default position. */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, @@ -539,8 +599,8 @@ FT_BEGIN_HEADER * FT_Get_MM_Blend_Coordinates * * @description: - * Get the normalized blend coordinates of the currently selected - * interpolated font. + * Get the normalized coordinates of the currently selected interpolated + * font. * * This function works with all supported variation formats. * @@ -549,14 +609,14 @@ FT_BEGIN_HEADER * A handle to the source face. * * num_coords :: - * The number of normalized blend coordinates to retrieve. If it is - * larger than the number of axes, set the excess values to~0.5 for - * Adobe MM fonts, and to~0 for TrueType GX and OpenType variation - * fonts. + * The number of normalized coordinates to retrieve. If it is larger + * than the number of axes, set the excess values to~0.5 for Adobe MM + * fonts, and to~0 for TrueType GX and OpenType Font Variations. * * @output: * coords :: - * The normalized blend coordinates array (as 16.16 fractional values). + * The normalized coordinates array (as 16.16 fractional values), which + * must be allocated by the user. * * @return: * FreeType error code. 0~means success. @@ -610,8 +670,8 @@ FT_BEGIN_HEADER * For Adobe MM fonts, choose an interpolated font design by directly * setting the weight vector. * - * This function can't be used with TrueType GX or OpenType variation - * fonts. + * This function can't be used with TrueType GX or OpenType Font + * Variations. * * @inout: * face :: @@ -630,16 +690,16 @@ FT_BEGIN_HEADER * FreeType error code. 0~means success. * * @note: - * Adobe Multiple Master fonts limit the number of designs, and thus the - * length of the weight vector to 16~elements. + * Adobe MM fonts limit the number of designs, and thus the length of the + * weight vector, to 16~elements. * * If `len` is larger than zero, this function sets the * @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field (i.e., - * @FT_IS_VARIATION will return true). If `len` is zero, this bit flag - * is unset and the weight vector array is reset to the default values. + * @FT_IS_VARIATION returns true). If `len` is zero, this bit flag is + * unset and the weight vector array is reset to the default values. * * The Adobe documentation also states that the values in the - * WeightVector array must total 1.0 +/-~0.001. In practice this does + * `WeightVector` array must total 1.0 +/-~0.001. In practice this does * not seem to be enforced, so is not enforced here, either. * * @since: @@ -659,8 +719,8 @@ FT_BEGIN_HEADER * @description: * For Adobe MM fonts, retrieve the current weight vector of the font. * - * This function can't be used with TrueType GX or OpenType variation - * fonts. + * This function can't be used with TrueType GX or OpenType Font + * Variations. * * @inout: * face :: @@ -677,14 +737,14 @@ FT_BEGIN_HEADER * * @output: * weightvector :: - * An array to be filled. + * An array to be filled; it must be allocated by the user. * * @return: * FreeType error code. 0~means success. * * @note: - * Adobe Multiple Master fonts limit the number of designs, and thus the - * length of the WeightVector to~16. + * Adobe MM fonts limit the number of designs, and thus the length of the + * weight vector, to~16 elements. * * @since: * 2.10 @@ -760,8 +820,8 @@ FT_BEGIN_HEADER * A handle to the source face. * * instance_index :: - * The index of the requested instance, starting with value 1. If set - * to value 0, FreeType switches to font access without a named + * The index of the requested instance, starting with value~1. If set + * to value~0, FreeType switches to font access without a named * instance. * * @return: @@ -771,11 +831,11 @@ FT_BEGIN_HEADER * The function uses the value of `instance_index` to set bits 16-30 of * the face's `face_index` field. It also resets any variation applied * to the font, and the @FT_FACE_FLAG_VARIATION bit of the face's - * `face_flags` field gets reset to zero (i.e., @FT_IS_VARIATION will - * return false). + * `face_flags` field gets reset to zero (i.e., @FT_IS_VARIATION returns + * false). * - * For Adobe MM fonts (which don't have named instances) this function - * simply resets the current face to the default instance. + * For Adobe MM fonts, this function resets the current face to the + * default instance. * * @since: * 2.9 @@ -794,10 +854,6 @@ FT_BEGIN_HEADER * Retrieve the index of the default named instance, to be used with * @FT_Set_Named_Instance. * - * The default instance of a variation font is that instance for which - * the nth axis coordinate is equal to `axis[n].def` (as specified in the - * @FT_MM_Var structure), with~n covering all axes. - * * FreeType synthesizes a named instance for the default instance if the * font does not contain such an entry. * @@ -813,8 +869,8 @@ FT_BEGIN_HEADER * FreeType error code. 0~means success. * * @note: - * For Adobe MM fonts (which don't have named instances) this function - * always returns zero for `instance_index`. + * For Adobe MM fonts, this function always returns zero for + * `instance_index`. * * @since: * 2.13.1 diff --git a/modules/freetype2/include/freetype/ftmodapi.h b/modules/freetype2/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ * * FreeType modules public interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftmoderr.h b/modules/freetype2/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ * * FreeType module error offsets (specification). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftotval.h b/modules/freetype2/include/freetype/ftotval.h @@ -4,7 +4,7 @@ * * FreeType API for validating OpenType tables (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftoutln.h b/modules/freetype2/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-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftparams.h b/modules/freetype2/include/freetype/ftparams.h @@ -4,7 +4,7 @@ * * FreeType API for possible FT_Parameter tags (specification only). * - * Copyright (C) 2017-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftpfr.h b/modules/freetype2/include/freetype/ftpfr.h @@ -4,7 +4,7 @@ * * FreeType API for accessing PFR-specific data (specification only). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftrender.h b/modules/freetype2/include/freetype/ftrender.h @@ -4,7 +4,7 @@ * * FreeType renderer modules public interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftsizes.h b/modules/freetype2/include/freetype/ftsizes.h @@ -4,7 +4,7 @@ * * FreeType size objects management (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftsnames.h b/modules/freetype2/include/freetype/ftsnames.h @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftstroke.h b/modules/freetype2/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ * * FreeType path stroker (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftsynth.h b/modules/freetype2/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ * FreeType synthesizing code for emboldening and slanting * (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftsystem.h b/modules/freetype2/include/freetype/ftsystem.h @@ -4,7 +4,7 @@ * * FreeType low-level system interface definition (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/fttrigon.h b/modules/freetype2/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (specification). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/fttypes.h b/modules/freetype2/include/freetype/fttypes.h @@ -4,7 +4,7 @@ * * FreeType simple types definitions (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ftwinfnt.h b/modules/freetype2/include/freetype/ftwinfnt.h @@ -4,7 +4,7 @@ * * FreeType API for accessing Windows fnt-specific data. * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -93,8 +93,7 @@ FT_BEGIN_HEADER * second default codepage that most international versions of Windows * have. It is one of the OEM codepages from * - * https://docs.microsoft.com/en-us/windows/desktop/intl/code-page-identifiers - * , + * https://learn.microsoft.com/windows/win32/intl/code-page-identifiers , * * and is used for the 'DOS boxes', to support legacy applications. A * German Windows version for example usually uses ANSI codepage 1252 diff --git a/modules/freetype2/include/freetype/internal/autohint.h b/modules/freetype2/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ * * High-level 'autohint' module-specific interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/cffotypes.h b/modules/freetype2/include/freetype/internal/cffotypes.h @@ -4,7 +4,7 @@ * * Basic OpenType/CFF object type definitions (specification). * - * Copyright (C) 2017-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/cfftypes.h b/modules/freetype2/include/freetype/internal/cfftypes.h @@ -5,7 +5,7 @@ * Basic OpenType/CFF type definitions and interface (specification * only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/compiler-macros.h b/modules/freetype2/include/freetype/internal/compiler-macros.h @@ -4,7 +4,7 @@ * * Compiler-specific macro definitions used internally by FreeType. * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -128,8 +128,8 @@ FT_BEGIN_HEADER * before a function declaration. */ - /* Visual C, mingw */ -#if defined( _WIN32 ) + /* Visual C, MinGW, Cygwin */ +#if defined( _WIN32 ) || defined( __CYGWIN__ ) #define FT_INTERNAL_FUNCTION_ATTRIBUTE /* empty */ /* gcc, clang */ diff --git a/modules/freetype2/include/freetype/internal/ftcalc.h b/modules/freetype2/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ * * Arithmetic computations (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -27,17 +27,87 @@ FT_BEGIN_HEADER + /* + * The following macros have two purposes. + * + * - Tag places where overflow is expected and harmless. + * + * - Avoid run-time undefined behavior sanitizer errors. + * + * Use with care! + */ +#define ADD_INT( a, b ) \ + (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) ) +#define SUB_INT( a, b ) \ + (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) ) +#define MUL_INT( a, b ) \ + (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) ) +#define NEG_INT( a ) \ + (FT_Int)( (FT_UInt)0 - (FT_UInt)(a) ) + +#define ADD_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) +#define SUB_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) ) +#define MUL_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) +#define NEG_LONG( a ) \ + (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) ) + +#define ADD_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) ) +#define SUB_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) ) +#define MUL_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) ) +#define NEG_INT32( a ) \ + (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) ) + +#ifdef FT_INT64 + +#define ADD_INT64( a, b ) \ + (FT_Int64)( (FT_UInt64)(a) + (FT_UInt64)(b) ) +#define SUB_INT64( a, b ) \ + (FT_Int64)( (FT_UInt64)(a) - (FT_UInt64)(b) ) +#define MUL_INT64( a, b ) \ + (FT_Int64)( (FT_UInt64)(a) * (FT_UInt64)(b) ) +#define NEG_INT64( a ) \ + (FT_Int64)( (FT_UInt64)0 - (FT_UInt64)(a) ) + +#endif /* FT_INT64 */ + + /************************************************************************** * * FT_MulDiv() and FT_MulFix() are declared in freetype.h. * */ -#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER - /* Provide assembler fragments for performance-critical functions. */ - /* These must be defined `static __inline__' with GCC. */ +#ifdef FT_CONFIG_OPTION_INLINE_MULFIX -#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ +#ifdef FT_INT64 + + static inline FT_Long + FT_MulFix_64( FT_Long a, + FT_Long b ) + { + FT_Int64 ab = MUL_INT64( a, b ); + + + ab = ADD_INT64( ab, 0x8000 + ( ab >> 63 ) ); /* rounding phase */ + + return (FT_Long)( ab >> 16 ); + } + + +#define FT_MulFix( a, b ) FT_MulFix_64( a, b ) + +#elif !defined( FT_CONFIG_OPTION_NO_ASSEMBLER ) + /* Provide 32-bit assembler fragments for optimized FT_MulFix. */ + /* These must be defined `static __inline__' or similar. */ + +#if defined( __arm__ ) && \ + ( defined( __thumb2__ ) || !defined( __thumb__ ) ) #define FT_MULFIX_ASSEMBLER FT_MulFix_arm @@ -49,6 +119,7 @@ FT_BEGIN_HEADER { FT_Int32 t, t2; +#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ __asm { @@ -60,28 +131,8 @@ FT_BEGIN_HEADER mov a, t2, lsr #16 /* a = t2 >> 16 */ orr a, a, t, lsl #16 /* a |= t << 16 */ } - return a; - } - -#endif /* __CC_ARM || __ARMCC__ */ - - -#ifdef __GNUC__ - -#if defined( __arm__ ) && \ - ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \ - !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) - -#define FT_MULFIX_ASSEMBLER FT_MulFix_arm - - /* documentation is in freetype.h */ - - static __inline__ FT_Int32 - FT_MulFix_arm( FT_Int32 a, - FT_Int32 b ) - { - FT_Int32 t, t2; +#elif defined( __GNUC__ ) __asm__ __volatile__ ( "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ @@ -98,26 +149,25 @@ FT_BEGIN_HEADER : "=r"(a), "=&r"(t2), "=&r"(t) : "r"(a), "r"(b) : "cc" ); - return a; - } -#endif /* __arm__ && */ - /* ( __thumb2__ || !__thumb__ ) && */ - /* !( __CC_ARM || __ARMCC__ ) */ +#endif + return a; + } -#if defined( __i386__ ) +#elif defined( __i386__ ) || defined( _M_IX86 ) #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 /* documentation is in freetype.h */ - static __inline__ FT_Int32 + static __inline FT_Int32 FT_MulFix_i386( FT_Int32 a, FT_Int32 b ) { FT_Int32 result; +#if defined( __GNUC__ ) __asm__ __volatile__ ( "imul %%edx\n" @@ -132,27 +182,8 @@ FT_BEGIN_HEADER : "=a"(result), "=d"(b) : "a"(a), "d"(b) : "%ecx", "cc" ); - return result; - } - -#endif /* i386 */ - -#endif /* __GNUC__ */ - - -#ifdef _MSC_VER /* Visual C++ */ -#ifdef _M_IX86 - -#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 - - /* documentation is in freetype.h */ - - static __inline FT_Int32 - FT_MulFix_i386( FT_Int32 a, - FT_Int32 b ) - { - FT_Int32 result; +#elif defined( _MSC_VER ) __asm { @@ -169,81 +200,21 @@ FT_BEGIN_HEADER add eax, edx mov result, eax } - return result; - } - -#endif /* _M_IX86 */ -#endif /* _MSC_VER */ - - -#if defined( __GNUC__ ) && defined( __x86_64__ ) - -#define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64 - - static __inline__ FT_Int32 - FT_MulFix_x86_64( FT_Int32 a, - FT_Int32 b ) - { - /* Temporarily disable the warning that C90 doesn't support */ - /* `long long'. */ -#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wlong-long" #endif -#if 1 - /* Technically not an assembly fragment, but GCC does a really good */ - /* job at inlining it and generating good machine code for it. */ - long long ret, tmp; - - - ret = (long long)a * b; - tmp = ret >> 63; - ret += 0x8000 + tmp; - - return (FT_Int32)( ret >> 16 ); -#else - - /* For some reason, GCC 4.6 on Ubuntu 12.04 generates invalid machine */ - /* code from the lines below. The main issue is that `wide_a' is not */ - /* properly initialized by sign-extending `a'. Instead, the generated */ - /* machine code assumes that the register that contains `a' on input */ - /* can be used directly as a 64-bit value, which is wrong most of the */ - /* time. */ - long long wide_a = (long long)a; - long long wide_b = (long long)b; - long long result; - - - __asm__ __volatile__ ( - "imul %2, %1\n" - "mov %1, %0\n" - "sar $63, %0\n" - "lea 0x8000(%1, %0), %0\n" - "sar $16, %0\n" - : "=&r"(result), "=&r"(wide_a) - : "r"(wide_b) - : "cc" ); - - return (FT_Int32)result; -#endif - -#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) -#pragma GCC diagnostic pop -#endif + return result; } -#endif /* __GNUC__ && __x86_64__ */ - -#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ - +#endif /* __i386__ || _M_IX86 */ -#ifdef FT_CONFIG_OPTION_INLINE_MULFIX #ifdef FT_MULFIX_ASSEMBLER #define FT_MulFix( a, b ) FT_MULFIX_ASSEMBLER( (FT_Int32)(a), (FT_Int32)(b) ) #endif -#endif + +#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ + +#endif /* FT_CONFIG_OPTION_INLINE_MULFIX */ /************************************************************************** @@ -278,40 +249,6 @@ FT_BEGIN_HEADER FT_Long c ); - /************************************************************************** - * - * @function: - * FT_MulAddFix - * - * @description: - * Compute `(s[0] * f[0] + s[1] * f[1] + ...) / 0x10000`, where `s[n]` is - * usually a 16.16 scalar. - * - * @input: - * s :: - * The array of scalars. - * f :: - * The array of factors. - * count :: - * The number of entries in the array. - * - * @return: - * The result of `(s[0] * f[0] + s[1] * f[1] + ...) / 0x10000`. - * - * @note: - * This function is currently used for the scaled delta computation of - * variation stores. It internally uses 64-bit data types when - * available, otherwise it emulates 64-bit math by using 32-bit - * operations, which produce a correct result but most likely at a slower - * performance in comparison to the implementation base on `int64_t`. - * - */ - FT_BASE( FT_Int32 ) - FT_MulAddFix( FT_Fixed* s, - FT_Int32* f, - FT_UInt count ); - - /* * A variant of FT_Matrix_Multiply which scales its result afterwards. The * idea is that both `a' and `b' are scaled by factors of 10 so that the @@ -455,6 +392,10 @@ FT_BEGIN_HEADER #define FT_MSB( x ) FT_MSB_i386( x ) +#elif defined( __CC_ARM ) + +#define FT_MSB( x ) ( 31 - __clz( x ) ) + #elif defined( __SunOS_5_11 ) #include <string.h> @@ -526,55 +467,6 @@ FT_BEGIN_HEADER #define ROUND_F26DOT6( x ) ( ( (x) + 32 - ( x < 0 ) ) & -64 ) - /* - * The following macros have two purposes. - * - * - Tag places where overflow is expected and harmless. - * - * - Avoid run-time sanitizer errors. - * - * Use with care! - */ -#define ADD_INT( a, b ) \ - (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) ) -#define SUB_INT( a, b ) \ - (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) ) -#define MUL_INT( a, b ) \ - (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) ) -#define NEG_INT( a ) \ - (FT_Int)( (FT_UInt)0 - (FT_UInt)(a) ) - -#define ADD_LONG( a, b ) \ - (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) -#define SUB_LONG( a, b ) \ - (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) ) -#define MUL_LONG( a, b ) \ - (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) -#define NEG_LONG( a ) \ - (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) ) - -#define ADD_INT32( a, b ) \ - (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) ) -#define SUB_INT32( a, b ) \ - (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) ) -#define MUL_INT32( a, b ) \ - (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) ) -#define NEG_INT32( a ) \ - (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) ) - -#ifdef FT_INT64 - -#define ADD_INT64( a, b ) \ - (FT_Int64)( (FT_UInt64)(a) + (FT_UInt64)(b) ) -#define SUB_INT64( a, b ) \ - (FT_Int64)( (FT_UInt64)(a) - (FT_UInt64)(b) ) -#define MUL_INT64( a, b ) \ - (FT_Int64)( (FT_UInt64)(a) * (FT_UInt64)(b) ) -#define NEG_INT64( a ) \ - (FT_Int64)( (FT_UInt64)0 - (FT_UInt64)(a) ) - -#endif /* FT_INT64 */ - FT_END_HEADER diff --git a/modules/freetype2/include/freetype/internal/ftdebug.h b/modules/freetype2/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ * * Debugging and logging component (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/ftdrv.h b/modules/freetype2/include/freetype/internal/ftdrv.h @@ -4,7 +4,7 @@ * * FreeType internal font driver interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/ftgloadr.h b/modules/freetype2/include/freetype/internal/ftgloadr.h @@ -4,7 +4,7 @@ * * The FreeType glyph loader (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/fthash.h b/modules/freetype2/include/freetype/internal/fthash.h @@ -117,6 +117,18 @@ FT_BEGIN_HEADER FT_Hash hash, FT_Memory memory ); + FT_Error + ft_hash_str_insert_no_overwrite( const char* key, + size_t data, + FT_Hash hash, + FT_Memory memory ); + + FT_Error + ft_hash_num_insert_no_overwrite( FT_Int num, + size_t data, + FT_Hash hash, + FT_Memory memory ); + size_t* ft_hash_str_lookup( const char* key, FT_Hash hash ); @@ -125,6 +137,17 @@ FT_BEGIN_HEADER ft_hash_num_lookup( FT_Int num, FT_Hash hash ); + FT_Bool + ft_hash_num_iterator( FT_UInt *idx, + FT_Int *key, + size_t *value, + FT_Hash hash ); + + FT_Bool + ft_hash_str_iterator( FT_UInt *idx, + const char* *key, + size_t *value, + FT_Hash hash ); FT_END_HEADER diff --git a/modules/freetype2/include/freetype/internal/ftmemory.h b/modules/freetype2/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ * * The FreeType memory management macros (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/ftmmtypes.h b/modules/freetype2/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-2024 by + * Copyright (C) 2022-2025 by * David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and * Dominik Röttsches. * diff --git a/modules/freetype2/include/freetype/internal/ftobjs.h b/modules/freetype2/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ * * The FreeType private base classes (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -275,6 +275,28 @@ FT_BEGIN_HEADER FT_GlyphSlot slot, FT_Render_Mode mode ); + + /************************************************************************** + * + * @Function: + * find_unicode_charmap + * + * @Description: + * This function finds a Unicode charmap, if there is one. And if there + * is more than one, it tries to favour the more extensive one, i.e., one + * that supports UCS-4 against those which are limited to the BMP (UCS-2 + * encoding.) + * + * If a unicode charmap is found, `face->charmap` is set to it. + * + * This function is called from `open_face`, from `FT_Select_Charmap(..., + * FT_ENCODING_UNICODE)`, and also from `afadjust.c` in the 'autofit' + * module. + */ + FT_BASE( FT_Error ) + find_unicode_charmap( FT_Face face ); + + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, @@ -498,9 +520,9 @@ FT_BEGIN_HEADER */ typedef struct FT_ModuleRec_ { - FT_Module_Class* clazz; - FT_Library library; - FT_Memory memory; + const FT_Module_Class* clazz; + FT_Library library; + FT_Memory memory; } FT_ModuleRec; diff --git a/modules/freetype2/include/freetype/internal/ftpsprop.h b/modules/freetype2/include/freetype/internal/ftpsprop.h @@ -4,7 +4,7 @@ * * Get and set properties of PostScript drivers (specification). * - * Copyright (C) 2017-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/ftrfork.h b/modules/freetype2/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * Masatake YAMATO and Redhat K.K. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/ftserv.h b/modules/freetype2/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ * * The FreeType services (specification only). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/ftstream.h b/modules/freetype2/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ * * Stream handling (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/fttrace.h b/modules/freetype2/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ * * Tracing handling (specification only). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,7 @@ /* definitions of trace levels for FreeType 2 */ /* the maximum string length (if the argument to `FT_TRACE_DEF` */ - /* gets used as a string) plus one charachter for ':' plus */ + /* gets used as a string) plus one character for ':' plus */ /* another one for the trace level */ #define FT_MAX_TRACE_LEVEL_LENGTH (9 + 1 + 1) @@ -159,6 +159,7 @@ FT_TRACE_DEF( gxvprop ) FT_TRACE_DEF( gxvtrak ) /* autofit components */ +FT_TRACE_DEF( afadjust ) FT_TRACE_DEF( afcjk ) FT_TRACE_DEF( afglobal ) FT_TRACE_DEF( afhints ) diff --git a/modules/freetype2/include/freetype/internal/ftvalid.h b/modules/freetype2/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ * * FreeType validation support (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/psaux.h b/modules/freetype2/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ * Auxiliary functions and data structures related to PostScript fonts * (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/pshints.h b/modules/freetype2/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-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svbdf.h b/modules/freetype2/include/freetype/internal/services/svbdf.h @@ -4,7 +4,7 @@ * * The FreeType BDF services (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svcfftl.h b/modules/freetype2/include/freetype/internal/services/svcfftl.h @@ -4,7 +4,7 @@ * * The FreeType CFF tables loader service (specification). * - * Copyright (C) 2017-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svcid.h b/modules/freetype2/include/freetype/internal/services/svcid.h @@ -4,7 +4,7 @@ * * The FreeType CID font services (specification). * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svfntfmt.h b/modules/freetype2/include/freetype/internal/services/svfntfmt.h @@ -4,7 +4,7 @@ * * The FreeType font format service (specification only). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svgldict.h b/modules/freetype2/include/freetype/internal/services/svgldict.h @@ -4,7 +4,7 @@ * * The FreeType glyph dictionary services (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svgxval.h b/modules/freetype2/include/freetype/internal/services/svgxval.h @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/include/freetype/internal/services/svkern.h b/modules/freetype2/include/freetype/internal/services/svkern.h @@ -4,7 +4,7 @@ * * The FreeType Kerning service (specification). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svmetric.h b/modules/freetype2/include/freetype/internal/services/svmetric.h @@ -4,7 +4,7 @@ * * The FreeType services for metrics variations (specification). * - * Copyright (C) 2016-2024 by + * Copyright (C) 2016-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -77,7 +77,7 @@ FT_BEGIN_HEADER typedef void (*FT_Metrics_Adjust_Func)( FT_Face face ); - typedef FT_Error + typedef void (*FT_Size_Reset_Func)( FT_Size size ); diff --git a/modules/freetype2/include/freetype/internal/services/svmm.h b/modules/freetype2/include/freetype/internal/services/svmm.h @@ -4,7 +4,7 @@ * * The FreeType Multiple Masters and GX var services (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 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/modules/freetype2/include/freetype/internal/services/svotval.h b/modules/freetype2/include/freetype/internal/services/svotval.h @@ -4,7 +4,7 @@ * * The FreeType OpenType validation service (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svpfr.h b/modules/freetype2/include/freetype/internal/services/svpfr.h @@ -4,7 +4,7 @@ * * Internal PFR service functions (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svpostnm.h b/modules/freetype2/include/freetype/internal/services/svpostnm.h @@ -4,7 +4,7 @@ * * The FreeType PostScript name services (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svprop.h b/modules/freetype2/include/freetype/internal/services/svprop.h @@ -4,7 +4,7 @@ * * The FreeType property service (specification). * - * Copyright (C) 2012-2024 by + * Copyright (C) 2012-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svpscmap.h b/modules/freetype2/include/freetype/internal/services/svpscmap.h @@ -4,7 +4,7 @@ * * The FreeType PostScript charmap service (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svpsinfo.h b/modules/freetype2/include/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ * * The FreeType PostScript info service (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svsfnt.h b/modules/freetype2/include/freetype/internal/services/svsfnt.h @@ -4,7 +4,7 @@ * * The FreeType SFNT table loading service (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svttcmap.h b/modules/freetype2/include/freetype/internal/services/svttcmap.h @@ -4,7 +4,7 @@ * * The FreeType TrueType/sfnt cmap extra information service. * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * Masatake YAMATO, Redhat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/include/freetype/internal/services/svtteng.h b/modules/freetype2/include/freetype/internal/services/svtteng.h @@ -4,7 +4,7 @@ * * The FreeType TrueType engine query service (specification). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svttglyf.h b/modules/freetype2/include/freetype/internal/services/svttglyf.h @@ -4,7 +4,7 @@ * * The FreeType TrueType glyph service. * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/services/svwinfnt.h b/modules/freetype2/include/freetype/internal/services/svwinfnt.h @@ -4,7 +4,7 @@ * * The FreeType Windows FNT/FONT service (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/sfnt.h b/modules/freetype2/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ * * High-level 'sfnt' driver interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -612,7 +612,7 @@ FT_BEGIN_HEADER * * @return: * Value~1 if a ClipBox is found. If no clip box is found or an - * error occured, value~0 is returned. + * error occurred, value~0 is returned. */ typedef FT_Bool ( *TT_Get_Color_Glyph_ClipBox_Func )( TT_Face face, @@ -707,7 +707,7 @@ FT_BEGIN_HEADER * * @return: * Value~1 if everything is OK. Value~0 if no details can be found for - * this paint or any other error occured. + * this paint or any other error occurred. */ typedef FT_Bool ( *TT_Get_Paint_Func )( TT_Face face, @@ -808,7 +808,7 @@ FT_BEGIN_HEADER * corresponding (1,0) Apple entry. * * @return: - * 1 if there is either a win or apple entry (or both), 0 otheriwse. + * 1 if there is either a win or apple entry (or both), 0 otherwise. */ typedef FT_Bool (*TT_Get_Name_ID_Func)( TT_Face face, diff --git a/modules/freetype2/include/freetype/internal/svginterface.h b/modules/freetype2/include/freetype/internal/svginterface.h @@ -4,7 +4,7 @@ * * Interface of ot-svg module (specification only). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 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/modules/freetype2/include/freetype/internal/t1types.h b/modules/freetype2/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ * Basic Type1/Type2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/internal/tttypes.h b/modules/freetype2/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ * Basic SFNT/TrueType type definitions and interface (specification * only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -930,8 +930,8 @@ FT_BEGIN_HEADER * resolution and scaling independent parts of a TrueType font resource. * * @note: - * The TT_Face structure is also used as a 'parent class' for the - * OpenType-CFF class (T2_Face). + * The TT_Face structure is also used for CFF support; see file + * `cffotypes.h`. */ typedef struct TT_FaceRec_* TT_Face; @@ -1276,10 +1276,6 @@ FT_BEGIN_HEADER * * If varied by the `CVAR' table, non-integer values are possible. * - * interpreter :: - * A pointer to the TrueType bytecode interpreters field is also used - * to hook the debugger in 'ttdebug'. - * * extra :: * Reserved for third-party font drivers. * @@ -1521,10 +1517,6 @@ FT_BEGIN_HEADER FT_ULong cvt_size; FT_Int32* cvt; - /* A pointer to the bytecode interpreter to use. This is also */ - /* used to hook the debugger for the `ttdebug' utility. */ - TT_Interpreter interpreter; - /************************************************************************ * @@ -1582,11 +1574,6 @@ 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 */ @@ -1608,6 +1595,15 @@ FT_BEGIN_HEADER /* since 2.12 */ void* svg; +#ifdef TT_CONFIG_OPTION_GPOS_KERNING + /* since 2.13.3 */ + FT_Byte* gpos_table; + /* since 2.14 */ + /* This is actually an array of GPOS lookup subtables. */ + FT_UInt32* gpos_lookups_kerning; + FT_UInt num_gpos_lookups_kerning; +#endif + } TT_FaceRec; @@ -1621,15 +1617,6 @@ FT_BEGIN_HEADER * coordinates. * * @fields: - * memory :: - * A handle to the memory manager. - * - * max_points :: - * The maximum size in points of the zone. - * - * max_contours :: - * Max size in links contours of the zone. - * * n_points :: * The current number of points in the zone. * @@ -1653,9 +1640,6 @@ FT_BEGIN_HEADER */ typedef struct TT_GlyphZoneRec_ { - FT_Memory memory; - FT_UShort max_points; - FT_UShort max_contours; FT_UShort n_points; /* number of points in zone */ FT_UShort n_contours; /* number of contours */ @@ -1714,7 +1698,6 @@ FT_BEGIN_HEADER TT_GlyphZoneRec zone; TT_ExecContext exec; - FT_Byte* instructions; FT_ULong ins_pos; /* for possible extensibility in other formats */ diff --git a/modules/freetype2/include/freetype/internal/wofftypes.h b/modules/freetype2/include/freetype/internal/wofftypes.h @@ -5,7 +5,7 @@ * Basic WOFF/WOFF2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/otsvg.h b/modules/freetype2/include/freetype/otsvg.h @@ -4,7 +4,7 @@ * * Interface for OT-SVG support related things (specification). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 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/modules/freetype2/include/freetype/t1tables.h b/modules/freetype2/include/freetype/t1tables.h @@ -5,7 +5,7 @@ * Basic Type 1/Type 2 tables definitions and interface (specification * only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/freetype/ttnameid.h b/modules/freetype2/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ * * TrueType name ID definitions (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -436,7 +436,7 @@ FT_BEGIN_HEADER * * The canonical source for Microsoft's IDs is * - * https://docs.microsoft.com/en-us/windows/desktop/Intl/language-identifier-constants-and-strings , + * https://learn.microsoft.com/windows/win32/intl/language-identifier-constants-and-strings , * * however, we only provide macros for language identifiers present in * the OpenType specification: Microsoft has abandoned the concept of @@ -847,113 +847,113 @@ FT_BEGIN_HEADER /* --------------- */ /* Bit 0 Basic Latin */ -#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */ +#define TT_UCR_BASIC_LATIN (1UL << 0) /* U+0020-U+007E */ /* Bit 1 C1 Controls and Latin-1 Supplement */ -#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */ +#define TT_UCR_LATIN1_SUPPLEMENT (1UL << 1) /* U+0080-U+00FF */ /* Bit 2 Latin Extended-A */ -#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */ +#define TT_UCR_LATIN_EXTENDED_A (1UL << 2) /* U+0100-U+017F */ /* Bit 3 Latin Extended-B */ -#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */ +#define TT_UCR_LATIN_EXTENDED_B (1UL << 3) /* U+0180-U+024F */ /* Bit 4 IPA Extensions */ /* Phonetic Extensions */ /* Phonetic Extensions Supplement */ -#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */ +#define TT_UCR_IPA_EXTENSIONS (1UL << 4) /* U+0250-U+02AF */ /* U+1D00-U+1D7F */ /* U+1D80-U+1DBF */ /* Bit 5 Spacing Modifier Letters */ /* Modifier Tone Letters */ -#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */ +#define TT_UCR_SPACING_MODIFIER (1UL << 5) /* U+02B0-U+02FF */ /* U+A700-U+A71F */ /* Bit 6 Combining Diacritical Marks */ /* Combining Diacritical Marks Supplement */ -#define TT_UCR_COMBINING_DIACRITICAL_MARKS (1L << 6) /* U+0300-U+036F */ +#define TT_UCR_COMBINING_DIACRITICAL_MARKS (1UL << 6) /* U+0300-U+036F */ /* U+1DC0-U+1DFF */ /* Bit 7 Greek and Coptic */ -#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */ +#define TT_UCR_GREEK (1UL << 7) /* U+0370-U+03FF */ /* Bit 8 Coptic */ -#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */ +#define TT_UCR_COPTIC (1UL << 8) /* U+2C80-U+2CFF */ /* Bit 9 Cyrillic */ /* Cyrillic Supplement */ /* Cyrillic Extended-A */ /* Cyrillic Extended-B */ -#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */ +#define TT_UCR_CYRILLIC (1UL << 9) /* U+0400-U+04FF */ /* U+0500-U+052F */ /* U+2DE0-U+2DFF */ /* U+A640-U+A69F */ /* Bit 10 Armenian */ -#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */ +#define TT_UCR_ARMENIAN (1UL << 10) /* U+0530-U+058F */ /* Bit 11 Hebrew */ -#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */ +#define TT_UCR_HEBREW (1UL << 11) /* U+0590-U+05FF */ /* Bit 12 Vai */ -#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */ +#define TT_UCR_VAI (1UL << 12) /* U+A500-U+A63F */ /* Bit 13 Arabic */ /* Arabic Supplement */ -#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */ +#define TT_UCR_ARABIC (1UL << 13) /* U+0600-U+06FF */ /* U+0750-U+077F */ /* Bit 14 NKo */ -#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */ +#define TT_UCR_NKO (1UL << 14) /* U+07C0-U+07FF */ /* Bit 15 Devanagari */ -#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */ - /* Bit 16 Bengali */ -#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */ +#define TT_UCR_DEVANAGARI (1UL << 15) /* U+0900-U+097F */ + /* Bit 16 Bangla (Bengali) */ +#define TT_UCR_BENGALI (1UL << 16) /* U+0980-U+09FF */ /* Bit 17 Gurmukhi */ -#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */ +#define TT_UCR_GURMUKHI (1UL << 17) /* U+0A00-U+0A7F */ /* Bit 18 Gujarati */ -#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */ - /* Bit 19 Oriya */ -#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */ +#define TT_UCR_GUJARATI (1UL << 18) /* U+0A80-U+0AFF */ + /* Bit 19 Oriya (Odia) */ +#define TT_UCR_ORIYA (1UL << 19) /* U+0B00-U+0B7F */ /* Bit 20 Tamil */ -#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */ +#define TT_UCR_TAMIL (1UL << 20) /* U+0B80-U+0BFF */ /* Bit 21 Telugu */ -#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */ +#define TT_UCR_TELUGU (1UL << 21) /* U+0C00-U+0C7F */ /* Bit 22 Kannada */ -#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */ +#define TT_UCR_KANNADA (1UL << 22) /* U+0C80-U+0CFF */ /* Bit 23 Malayalam */ -#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */ +#define TT_UCR_MALAYALAM (1UL << 23) /* U+0D00-U+0D7F */ /* Bit 24 Thai */ -#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */ +#define TT_UCR_THAI (1UL << 24) /* U+0E00-U+0E7F */ /* Bit 25 Lao */ -#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */ +#define TT_UCR_LAO (1UL << 25) /* U+0E80-U+0EFF */ /* Bit 26 Georgian */ /* Georgian Supplement */ -#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */ +#define TT_UCR_GEORGIAN (1UL << 26) /* U+10A0-U+10FF */ /* U+2D00-U+2D2F */ /* Bit 27 Balinese */ -#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */ +#define TT_UCR_BALINESE (1UL << 27) /* U+1B00-U+1B7F */ /* Bit 28 Hangul Jamo */ -#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */ +#define TT_UCR_HANGUL_JAMO (1UL << 28) /* U+1100-U+11FF */ /* Bit 29 Latin Extended Additional */ /* Latin Extended-C */ /* Latin Extended-D */ -#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */ +#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1UL << 29) /* U+1E00-U+1EFF */ /* U+2C60-U+2C7F */ /* U+A720-U+A7FF */ /* Bit 30 Greek Extended */ -#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */ +#define TT_UCR_GREEK_EXTENDED (1UL << 30) /* U+1F00-U+1FFF */ /* Bit 31 General Punctuation */ /* Supplemental Punctuation */ -#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */ +#define TT_UCR_GENERAL_PUNCTUATION (1UL << 31) /* U+2000-U+206F */ /* U+2E00-U+2E7F */ /* ulUnicodeRange2 */ /* --------------- */ /* Bit 32 Superscripts And Subscripts */ -#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */ +#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1UL << 0) /* U+2070-U+209F */ /* Bit 33 Currency Symbols */ -#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */ +#define TT_UCR_CURRENCY_SYMBOLS (1UL << 1) /* U+20A0-U+20CF */ /* Bit 34 Combining Diacritical Marks For Symbols */ #define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \ - (1L << 2) /* U+20D0-U+20FF */ + (1UL << 2) /* U+20D0-U+20FF */ /* Bit 35 Letterlike Symbols */ -#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */ +#define TT_UCR_LETTERLIKE_SYMBOLS (1UL << 3) /* U+2100-U+214F */ /* Bit 36 Number Forms */ -#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */ +#define TT_UCR_NUMBER_FORMS (1UL << 4) /* U+2150-U+218F */ /* Bit 37 Arrows */ /* Supplemental Arrows-A */ /* Supplemental Arrows-B */ /* Miscellaneous Symbols and Arrows */ -#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */ +#define TT_UCR_ARROWS (1UL << 5) /* U+2190-U+21FF */ /* U+27F0-U+27FF */ /* U+2900-U+297F */ /* U+2B00-U+2BFF */ @@ -961,52 +961,52 @@ FT_BEGIN_HEADER /* Supplemental Mathematical Operators */ /* Miscellaneous Mathematical Symbols-A */ /* Miscellaneous Mathematical Symbols-B */ -#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */ +#define TT_UCR_MATHEMATICAL_OPERATORS (1UL << 6) /* U+2200-U+22FF */ /* U+2A00-U+2AFF */ /* U+27C0-U+27EF */ /* U+2980-U+29FF */ /* Bit 39 Miscellaneous Technical */ -#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */ +#define TT_UCR_MISCELLANEOUS_TECHNICAL (1UL << 7) /* U+2300-U+23FF */ /* Bit 40 Control Pictures */ -#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */ +#define TT_UCR_CONTROL_PICTURES (1UL << 8) /* U+2400-U+243F */ /* Bit 41 Optical Character Recognition */ -#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */ +#define TT_UCR_OCR (1UL << 9) /* U+2440-U+245F */ /* Bit 42 Enclosed Alphanumerics */ -#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */ +#define TT_UCR_ENCLOSED_ALPHANUMERICS (1UL << 10) /* U+2460-U+24FF */ /* Bit 43 Box Drawing */ -#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */ +#define TT_UCR_BOX_DRAWING (1UL << 11) /* U+2500-U+257F */ /* Bit 44 Block Elements */ -#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */ +#define TT_UCR_BLOCK_ELEMENTS (1UL << 12) /* U+2580-U+259F */ /* Bit 45 Geometric Shapes */ -#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */ +#define TT_UCR_GEOMETRIC_SHAPES (1UL << 13) /* U+25A0-U+25FF */ /* Bit 46 Miscellaneous Symbols */ -#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */ +#define TT_UCR_MISCELLANEOUS_SYMBOLS (1UL << 14) /* U+2600-U+26FF */ /* Bit 47 Dingbats */ -#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */ +#define TT_UCR_DINGBATS (1UL << 15) /* U+2700-U+27BF */ /* Bit 48 CJK Symbols and Punctuation */ -#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */ +#define TT_UCR_CJK_SYMBOLS (1UL << 16) /* U+3000-U+303F */ /* Bit 49 Hiragana */ -#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */ +#define TT_UCR_HIRAGANA (1UL << 17) /* U+3040-U+309F */ /* Bit 50 Katakana */ /* Katakana Phonetic Extensions */ -#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */ +#define TT_UCR_KATAKANA (1UL << 18) /* U+30A0-U+30FF */ /* U+31F0-U+31FF */ /* Bit 51 Bopomofo */ /* Bopomofo Extended */ -#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */ +#define TT_UCR_BOPOMOFO (1UL << 19) /* U+3100-U+312F */ /* U+31A0-U+31BF */ /* Bit 52 Hangul Compatibility Jamo */ -#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */ +#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1UL << 20) /* U+3130-U+318F */ /* Bit 53 Phags-Pa */ -#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */ -#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */ -#define TT_UCR_PHAGSPA +#define TT_UCR_PHAGSPA (1UL << 21) /* U+A840-U+A87F */ +#define TT_UCR_KANBUN TT_UCR_PHAGSPA /* deprecated */ +#define TT_UCR_CJK_MISC TT_UCR_PHAGSPA /* deprecated */ /* Bit 54 Enclosed CJK Letters and Months */ -#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */ +#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1UL << 22) /* U+3200-U+32FF */ /* Bit 55 CJK Compatibility */ -#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */ +#define TT_UCR_CJK_COMPATIBILITY (1UL << 23) /* U+3300-U+33FF */ /* Bit 56 Hangul Syllables */ -#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */ +#define TT_UCR_HANGUL (1UL << 24) /* U+AC00-U+D7A3 */ /* Bit 57 High Surrogates */ /* High Private Use Surrogates */ /* Low Surrogates */ @@ -1017,12 +1017,12 @@ FT_BEGIN_HEADER /* Basic Multilingual Plane that is */ /* supported by this font. So it really */ /* means >= U+10000. */ -#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */ +#define TT_UCR_SURROGATES (1UL << 25) /* U+D800-U+DB7F */ /* U+DB80-U+DBFF */ /* U+DC00-U+DFFF */ #define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES /* Bit 58 Phoenician */ -#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/ +#define TT_UCR_PHOENICIAN (1UL << 26) /*U+10900-U+1091F*/ /* Bit 59 CJK Unified Ideographs */ /* CJK Radicals Supplement */ /* Kangxi Radicals */ @@ -1030,7 +1030,7 @@ FT_BEGIN_HEADER /* CJK Unified Ideographs Extension A */ /* CJK Unified Ideographs Extension B */ /* Kanbun */ -#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */ +#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1UL << 27) /* U+4E00-U+9FFF */ /* U+2E80-U+2EFF */ /* U+2F00-U+2FDF */ /* U+2FF0-U+2FFF */ @@ -1038,178 +1038,178 @@ FT_BEGIN_HEADER /*U+20000-U+2A6DF*/ /* U+3190-U+319F */ /* Bit 60 Private Use */ -#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */ +#define TT_UCR_PRIVATE_USE (1UL << 28) /* U+E000-U+F8FF */ /* Bit 61 CJK Strokes */ /* CJK Compatibility Ideographs */ /* CJK Compatibility Ideographs Supplement */ -#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */ +#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1UL << 29) /* U+31C0-U+31EF */ /* U+F900-U+FAFF */ /*U+2F800-U+2FA1F*/ /* Bit 62 Alphabetic Presentation Forms */ -#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */ +#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1UL << 30) /* U+FB00-U+FB4F */ /* Bit 63 Arabic Presentation Forms-A */ -#define TT_UCR_ARABIC_PRESENTATION_FORMS_A (1L << 31) /* U+FB50-U+FDFF */ +#define TT_UCR_ARABIC_PRESENTATION_FORMS_A (1UL << 31) /* U+FB50-U+FDFF */ /* ulUnicodeRange3 */ /* --------------- */ /* Bit 64 Combining Half Marks */ -#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */ +#define TT_UCR_COMBINING_HALF_MARKS (1UL << 0) /* U+FE20-U+FE2F */ /* Bit 65 Vertical forms */ /* CJK Compatibility Forms */ -#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */ +#define TT_UCR_CJK_COMPATIBILITY_FORMS (1UL << 1) /* U+FE10-U+FE1F */ /* U+FE30-U+FE4F */ /* Bit 66 Small Form Variants */ -#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */ +#define TT_UCR_SMALL_FORM_VARIANTS (1UL << 2) /* U+FE50-U+FE6F */ /* Bit 67 Arabic Presentation Forms-B */ -#define TT_UCR_ARABIC_PRESENTATION_FORMS_B (1L << 3) /* U+FE70-U+FEFE */ +#define TT_UCR_ARABIC_PRESENTATION_FORMS_B (1UL << 3) /* U+FE70-U+FEFF */ /* Bit 68 Halfwidth and Fullwidth Forms */ -#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */ +#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1UL << 4) /* U+FF00-U+FFEF */ /* Bit 69 Specials */ -#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */ +#define TT_UCR_SPECIALS (1UL << 5) /* U+FFF0-U+FFFF */ /* Bit 70 Tibetan */ -#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */ +#define TT_UCR_TIBETAN (1UL << 6) /* U+0F00-U+0FFF */ /* Bit 71 Syriac */ -#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */ +#define TT_UCR_SYRIAC (1UL << 7) /* U+0700-U+074F */ /* Bit 72 Thaana */ -#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */ +#define TT_UCR_THAANA (1UL << 8) /* U+0780-U+07BF */ /* Bit 73 Sinhala */ -#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */ +#define TT_UCR_SINHALA (1UL << 9) /* U+0D80-U+0DFF */ /* Bit 74 Myanmar */ -#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */ +#define TT_UCR_MYANMAR (1UL << 10) /* U+1000-U+109F */ /* Bit 75 Ethiopic */ /* Ethiopic Supplement */ /* Ethiopic Extended */ -#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */ +#define TT_UCR_ETHIOPIC (1UL << 11) /* U+1200-U+137F */ /* U+1380-U+139F */ /* U+2D80-U+2DDF */ /* Bit 76 Cherokee */ -#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */ +#define TT_UCR_CHEROKEE (1UL << 12) /* U+13A0-U+13FF */ /* Bit 77 Unified Canadian Aboriginal Syllabics */ -#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */ +#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1UL << 13) /* U+1400-U+167F */ /* Bit 78 Ogham */ -#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */ +#define TT_UCR_OGHAM (1UL << 14) /* U+1680-U+169F */ /* Bit 79 Runic */ -#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */ +#define TT_UCR_RUNIC (1UL << 15) /* U+16A0-U+16FF */ /* Bit 80 Khmer */ /* Khmer Symbols */ -#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */ +#define TT_UCR_KHMER (1UL << 16) /* U+1780-U+17FF */ /* U+19E0-U+19FF */ /* Bit 81 Mongolian */ -#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */ +#define TT_UCR_MONGOLIAN (1UL << 17) /* U+1800-U+18AF */ /* Bit 82 Braille Patterns */ -#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */ +#define TT_UCR_BRAILLE (1UL << 18) /* U+2800-U+28FF */ /* Bit 83 Yi Syllables */ /* Yi Radicals */ -#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */ +#define TT_UCR_YI (1UL << 19) /* U+A000-U+A48F */ /* U+A490-U+A4CF */ /* Bit 84 Tagalog */ /* Hanunoo */ /* Buhid */ /* Tagbanwa */ -#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */ +#define TT_UCR_PHILIPPINE (1UL << 20) /* U+1700-U+171F */ /* U+1720-U+173F */ /* U+1740-U+175F */ /* U+1760-U+177F */ /* Bit 85 Old Italic */ -#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/ +#define TT_UCR_OLD_ITALIC (1UL << 21) /*U+10300-U+1032F*/ /* Bit 86 Gothic */ -#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/ +#define TT_UCR_GOTHIC (1UL << 22) /*U+10330-U+1034F*/ /* Bit 87 Deseret */ -#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/ +#define TT_UCR_DESERET (1UL << 23) /*U+10400-U+1044F*/ /* Bit 88 Byzantine Musical Symbols */ /* Musical Symbols */ /* Ancient Greek Musical Notation */ -#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/ +#define TT_UCR_MUSICAL_SYMBOLS (1UL << 24) /*U+1D000-U+1D0FF*/ /*U+1D100-U+1D1FF*/ /*U+1D200-U+1D24F*/ /* Bit 89 Mathematical Alphanumeric Symbols */ -#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/ +#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1UL << 25) /*U+1D400-U+1D7FF*/ /* Bit 90 Private Use (plane 15) */ /* Private Use (plane 16) */ -#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/ +#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1UL << 26) /*U+F0000-U+FFFFD*/ /*U+100000-U+10FFFD*/ /* Bit 91 Variation Selectors */ /* Variation Selectors Supplement */ -#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */ +#define TT_UCR_VARIATION_SELECTORS (1UL << 27) /* U+FE00-U+FE0F */ /*U+E0100-U+E01EF*/ /* Bit 92 Tags */ -#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/ +#define TT_UCR_TAGS (1UL << 28) /*U+E0000-U+E007F*/ /* Bit 93 Limbu */ -#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */ +#define TT_UCR_LIMBU (1UL << 29) /* U+1900-U+194F */ /* Bit 94 Tai Le */ -#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */ +#define TT_UCR_TAI_LE (1UL << 30) /* U+1950-U+197F */ /* Bit 95 New Tai Lue */ -#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */ +#define TT_UCR_NEW_TAI_LUE (1UL << 31) /* U+1980-U+19DF */ /* ulUnicodeRange4 */ /* --------------- */ /* Bit 96 Buginese */ -#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */ +#define TT_UCR_BUGINESE (1UL << 0) /* U+1A00-U+1A1F */ /* Bit 97 Glagolitic */ -#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */ +#define TT_UCR_GLAGOLITIC (1UL << 1) /* U+2C00-U+2C5F */ /* Bit 98 Tifinagh */ -#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */ +#define TT_UCR_TIFINAGH (1UL << 2) /* U+2D30-U+2D7F */ /* Bit 99 Yijing Hexagram Symbols */ -#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */ +#define TT_UCR_YIJING (1UL << 3) /* U+4DC0-U+4DFF */ /* Bit 100 Syloti Nagri */ -#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */ +#define TT_UCR_SYLOTI_NAGRI (1UL << 4) /* U+A800-U+A82F */ /* Bit 101 Linear B Syllabary */ /* Linear B Ideograms */ /* Aegean Numbers */ -#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/ +#define TT_UCR_LINEAR_B (1UL << 5) /*U+10000-U+1007F*/ /*U+10080-U+100FF*/ /*U+10100-U+1013F*/ /* Bit 102 Ancient Greek Numbers */ -#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/ +#define TT_UCR_ANCIENT_GREEK_NUMBERS (1UL << 6) /*U+10140-U+1018F*/ /* Bit 103 Ugaritic */ -#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/ +#define TT_UCR_UGARITIC (1UL << 7) /*U+10380-U+1039F*/ /* Bit 104 Old Persian */ -#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/ +#define TT_UCR_OLD_PERSIAN (1UL << 8) /*U+103A0-U+103DF*/ /* Bit 105 Shavian */ -#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/ +#define TT_UCR_SHAVIAN (1UL << 9) /*U+10450-U+1047F*/ /* Bit 106 Osmanya */ -#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/ +#define TT_UCR_OSMANYA (1UL << 10) /*U+10480-U+104AF*/ /* Bit 107 Cypriot Syllabary */ -#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/ +#define TT_UCR_CYPRIOT_SYLLABARY (1UL << 11) /*U+10800-U+1083F*/ /* Bit 108 Kharoshthi */ -#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/ +#define TT_UCR_KHAROSHTHI (1UL << 12) /*U+10A00-U+10A5F*/ /* Bit 109 Tai Xuan Jing Symbols */ -#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/ +#define TT_UCR_TAI_XUAN_JING (1UL << 13) /*U+1D300-U+1D35F*/ /* Bit 110 Cuneiform */ /* Cuneiform Numbers and Punctuation */ -#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/ +#define TT_UCR_CUNEIFORM (1UL << 14) /*U+12000-U+123FF*/ /*U+12400-U+1247F*/ /* Bit 111 Counting Rod Numerals */ -#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/ +#define TT_UCR_COUNTING_ROD_NUMERALS (1UL << 15) /*U+1D360-U+1D37F*/ /* Bit 112 Sundanese */ -#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */ +#define TT_UCR_SUNDANESE (1UL << 16) /* U+1B80-U+1BBF */ /* Bit 113 Lepcha */ -#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */ +#define TT_UCR_LEPCHA (1UL << 17) /* U+1C00-U+1C4F */ /* Bit 114 Ol Chiki */ -#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */ +#define TT_UCR_OL_CHIKI (1UL << 18) /* U+1C50-U+1C7F */ /* Bit 115 Saurashtra */ -#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */ +#define TT_UCR_SAURASHTRA (1UL << 19) /* U+A880-U+A8DF */ /* Bit 116 Kayah Li */ -#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */ +#define TT_UCR_KAYAH_LI (1UL << 20) /* U+A900-U+A92F */ /* Bit 117 Rejang */ -#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */ +#define TT_UCR_REJANG (1UL << 21) /* U+A930-U+A95F */ /* Bit 118 Cham */ -#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */ +#define TT_UCR_CHAM (1UL << 22) /* U+AA00-U+AA5F */ /* Bit 119 Ancient Symbols */ -#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/ +#define TT_UCR_ANCIENT_SYMBOLS (1UL << 23) /*U+10190-U+101CF*/ /* Bit 120 Phaistos Disc */ -#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/ +#define TT_UCR_PHAISTOS_DISC (1UL << 24) /*U+101D0-U+101FF*/ /* Bit 121 Carian */ /* Lycian */ /* Lydian */ -#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/ +#define TT_UCR_OLD_ANATOLIAN (1UL << 25) /*U+102A0-U+102DF*/ /*U+10280-U+1029F*/ /*U+10920-U+1093F*/ /* Bit 122 Domino Tiles */ /* Mahjong Tiles */ -#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/ +#define TT_UCR_GAME_TILES (1UL << 26) /*U+1F030-U+1F09F*/ /*U+1F000-U+1F02F*/ /* Bit 123-127 Reserved for process-internal usage */ diff --git a/modules/freetype2/include/freetype/tttables.h b/modules/freetype2/include/freetype/tttables.h @@ -5,7 +5,7 @@ * Basic SFNT/TrueType tables definitions and interface * (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -192,7 +192,7 @@ FT_BEGIN_HEADER * A pointer into the 'hmtx' table. * * @note: - * For an OpenType variation font, the values of the following fields can + * For OpenType Font Variations, the values of the following fields can * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if * the font contains an 'MVAR' table: `caret_Slope_Rise`, * `caret_Slope_Run`, and `caret_Offset`. @@ -310,7 +310,7 @@ FT_BEGIN_HEADER * A pointer into the 'vmtx' table. * * @note: - * For an OpenType variation font, the values of the following fields can + * For OpenType Font Variations, the values of the following fields can * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if * the font contains an 'MVAR' table: `Ascender`, `Descender`, * `Line_Gap`, `caret_Slope_Rise`, `caret_Slope_Run`, and `caret_Offset`. @@ -359,7 +359,7 @@ FT_BEGIN_HEADER * table. In this case, the `version` field is always set to 0xFFFF. * * @note: - * For an OpenType variation font, the values of the following fields can + * For OpenType Font Variations, the values of the following fields can * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if * the font contains an 'MVAR' table: `sCapHeight`, `sTypoAscender`, * `sTypoDescender`, `sTypoLineGap`, `sxHeight`, `usWinAscent`, @@ -442,7 +442,7 @@ FT_BEGIN_HEADER * them. * * @note: - * For an OpenType variation font, the values of the following fields can + * For OpenType Font Variations, the values of the following fields can * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if * the font contains an 'MVAR' table: `underlinePosition` and * `underlineThickness`. @@ -705,6 +705,9 @@ FT_BEGIN_HEADER * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new * one with @FT_MAKE_TAG. * + * [Since 2.14] Use value~1 if you want to access the table directory + * of the (currently selected) font. + * * offset :: * The starting offset in the table (or file if tag~==~0). * diff --git a/modules/freetype2/include/freetype/tttags.h b/modules/freetype2/include/freetype/tttags.h @@ -4,7 +4,7 @@ * * Tags for TrueType and OpenType tables (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/include/ft2build.h b/modules/freetype2/include/ft2build.h @@ -4,7 +4,7 @@ * * FreeType 2 build and setup macros. * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/meson.build b/modules/freetype2/meson.build @@ -2,7 +2,7 @@ # Meson project file for FreeType 2 # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -159,6 +159,7 @@ ft2_public_headers = files([ 'include/freetype/ftincrem.h', 'include/freetype/ftlcdfil.h', 'include/freetype/ftlist.h', + 'include/freetype/ftlogging.h', 'include/freetype/ftlzw.h', 'include/freetype/ftmac.h', 'include/freetype/ftmm.h', @@ -319,11 +320,16 @@ else endif # BZip2 support. -bzip2_dep = dependency('bzip2', required: false) +bzip2_dep = dependency( + 'bzip2', + required: get_option('bzip2').disabled() ? get_option('bzip2') : false, +) if not bzip2_dep.found() - bzip2_dep = cc.find_library('bz2', + bzip2_dep = cc.find_library( + 'bz2', has_headers: ['bzlib.h'], - required: get_option('bzip2')) + required: get_option('bzip2'), + ) endif if bzip2_dep.found() @@ -342,15 +348,48 @@ if libpng_dep.found() ft2_deps += [libpng_dep] endif -# Harfbuzz support. -harfbuzz_dep = dependency('harfbuzz', - version: '>= 2.0.0', - required: get_option('harfbuzz'), - default_options: ['freetype=disabled']) +# HarfBuzz support. +harfbuzz_opt = get_option('harfbuzz') +harfbuzz_dep = disabler() + +if harfbuzz_opt == 'enabled' or harfbuzz_opt == 'auto' + harfbuzz_dep = dependency('harfbuzz', + version: '>= 2.0.0', + required: harfbuzz_opt == 'enabled', + default_options: ['freetype=disabled']) + if harfbuzz_dep.found() + harfbuzz_opt = 'YES' + ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ'] + ft2_deps += [harfbuzz_dep] + endif +endif -if harfbuzz_dep.found() - ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ'] - ft2_deps += [harfbuzz_dep] +if not harfbuzz_dep.found() and \ + (harfbuzz_opt == 'dynamic' or harfbuzz_opt == 'auto') + # On Windows we don't need libdl, but on other platforms we need it. + if host_machine.system() == 'windows' + harfbuzz_opt = 'dynamic' + ftoption_command += [ + '--enable=FT_CONFIG_OPTION_USE_HARFBUZZ', + '--enable=FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC', + ] + else + harfbuzz_dep = meson.get_compiler('c').find_library('dl', + required: harfbuzz_opt == 'dynamic', + ) + if harfbuzz_dep.found() + harfbuzz_opt = 'dynamic' + ftoption_command += [ + '--enable=FT_CONFIG_OPTION_USE_HARFBUZZ', + '--enable=FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC', + ] + ft2_deps += [harfbuzz_dep] + endif + endif +endif + +if harfbuzz_opt == 'disabled' or harfbuzz_opt == 'auto' + harfbuzz_opt = 'NO' endif # Brotli decompression support. @@ -362,6 +401,10 @@ if brotli_dep.found() ft2_deps += [brotli_dep] endif +if get_option('error_strings') + ftoption_command += ['--enable=FT_CONFIG_OPTION_ERROR_STRINGS'] +endif + # We can now generate `ftoption.h`. ftoption_h = custom_target('ftoption.h', input: 'include/freetype/config/ftoption.h', @@ -373,7 +416,8 @@ ftoption_h = custom_target('ftoption.h', ft2_sources += ftoption_h ft2_defines += ['-DFT_CONFIG_OPTIONS_H=<ftoption.h>'] -if host_machine.system() == 'windows' +if host_machine.system() == 'windows' and \ + get_option('default_library') == 'shared' ft2_defines += ['-DDLL_EXPORT=1'] endif @@ -476,10 +520,10 @@ summary({'OS': host_machine.system(), }, section: 'Operating System') summary({'Zlib': zlib_option, - 'Bzip2': bzip2_dep.found() ? 'yes' : 'no', - 'Png': libpng_dep.found() ? 'yes' : 'no', - 'Harfbuzz': harfbuzz_dep.found() ? 'yes' : 'no', - 'Brotli': brotli_dep.found() ? 'yes' : 'no', - }, section: 'Used Libraries') + 'Bzip2': bzip2_dep.found(), + 'Png': libpng_dep.found(), + 'HarfBuzz': harfbuzz_opt, + 'Brotli': brotli_dep.found(), + }, bool_yn: true, section: 'Used Libraries') # EOF diff --git a/modules/freetype2/meson_options.txt b/modules/freetype2/meson_options.txt @@ -2,7 +2,7 @@ # meson_options.txt # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -23,7 +23,8 @@ option('bzip2', description: 'Support reading bzip2-compressed font files') option('harfbuzz', - type: 'feature', + type: 'combo', + choices: ['auto', 'enabled', 'dynamic', 'disabled'], value: 'auto', description: 'Use Harfbuzz library to improve auto-hinting;' + ' if available, many glyphs not directly addressable' @@ -52,4 +53,9 @@ option('zlib', 'disabled', 'enabled' ], description: 'Support reading gzip-compressed font files') +option('error_strings', + type: 'boolean', + value: false, + description: 'Enable support for meaningful error descriptions') + # EOF diff --git a/modules/freetype2/modules.cfg b/modules/freetype2/modules.cfg @@ -1,6 +1,6 @@ # modules.cfg # -# Copyright (C) 2005-2024 by +# Copyright (C) 2005-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/autofit/afadjust.c b/modules/freetype2/src/autofit/afadjust.c @@ -0,0 +1,1612 @@ +/**************************************************************************** + * + * afadjust.c + * + * Auto-fitter routines to adjust components based on charcode (body). + * + * Copyright (C) 2023-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Written by Craig White <gerzytet@gmail.com>. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.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 "afadjust.h" +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ +# include "afgsub.h" +#endif + +#include <freetype/freetype.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftdebug.h> + +#define AF_ADJUSTMENT_DATABASE_LENGTH \ + ( sizeof ( adjustment_database ) / \ + sizeof ( adjustment_database[0] ) ) + +#undef FT_COMPONENT +#define FT_COMPONENT afadjust + + + typedef struct AF_AdjustmentDatabaseEntry_ + { + FT_UInt32 codepoint; + FT_UInt32 flags; + + } AF_AdjustmentDatabaseEntry; + + + /* + All entries in this list must be sorted by ascending Unicode code + points. The table entries are 3 numbers consisting of: + + - Unicode code point. + - The vertical adjustment type. This should be a combination of the + AF_ADJUST_XXX and AF_IGNORE_XXX macros. + */ + static AF_AdjustmentDatabaseEntry adjustment_database[] = + { + /* C0 Controls and Basic Latin */ + { 0x21, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ! */ + { 0x51, AF_IGNORE_CAPITAL_BOTTOM } , /* Q */ + { 0x3F, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ? */ + { 0x69, AF_ADJUST_UP }, /* i */ + { 0x6A, AF_ADJUST_UP }, /* j */ +#if 0 + /* XXX TODO */ + { 0x7E, AF_ADJUST_TILDE_TOP }, /* ~ */ +#endif + + /* C1 Controls and Latin-1 Supplement */ + { 0xA1, AF_ADJUST_UP }, /* ¡ */ + { 0xA6, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ¦ */ + { 0xAA, AF_ADJUST_UP }, /* ª */ + { 0xBA, AF_ADJUST_UP }, /* º */ + { 0xBF, AF_ADJUST_UP }, /* ¿ */ + + { 0xC0, AF_ADJUST_UP }, /* À */ + { 0xC1, AF_ADJUST_UP }, /* à */ + { 0xC2, AF_ADJUST_UP }, /*  */ + { 0xC3, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* à */ + { 0xC4, AF_ADJUST_UP }, /* Ä */ + { 0xC5, AF_ADJUST_UP }, /* Ã… */ + { 0xC7, AF_IGNORE_CAPITAL_BOTTOM }, /* Ç */ + { 0xC8, AF_ADJUST_UP }, /* È */ + { 0xC9, AF_ADJUST_UP }, /* É */ + { 0xCA, AF_ADJUST_UP }, /* Ê */ + { 0xCB, AF_ADJUST_UP }, /* Ë */ + { 0xCC, AF_ADJUST_UP }, /* ÃŒ */ + { 0xCD, AF_ADJUST_UP }, /* à */ + { 0xCE, AF_ADJUST_UP }, /* ÃŽ */ + { 0xCF, AF_ADJUST_UP }, /* à */ + + { 0xD1, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Ñ */ + { 0xD2, AF_ADJUST_UP }, /* Ã’ */ + { 0xD3, AF_ADJUST_UP }, /* Ó */ + { 0xD4, AF_ADJUST_UP }, /* Ô */ + { 0xD5, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Õ */ + { 0xD6, AF_ADJUST_UP }, /* Ö */ + { 0xD8, AF_IGNORE_CAPITAL_TOP | AF_IGNORE_CAPITAL_BOTTOM }, /* Ø */ + { 0xD9, AF_ADJUST_UP }, /* Ù */ + { 0xDA, AF_ADJUST_UP }, /* Ú */ + { 0xDB, AF_ADJUST_UP }, /* Û */ + { 0xDC, AF_ADJUST_UP }, /* Ü */ + { 0xDD, AF_ADJUST_UP }, /* à */ + + { 0xE0, AF_ADJUST_UP }, /* à */ + { 0xE1, AF_ADJUST_UP }, /* á */ + { 0xE2, AF_ADJUST_UP }, /* â */ + { 0xE3, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* ã */ + { 0xE4, AF_ADJUST_UP }, /* ä */ + { 0xE5, AF_ADJUST_UP }, /* Ã¥ */ + { 0xE7, AF_IGNORE_SMALL_BOTTOM }, /* ç */ + { 0xE8, AF_ADJUST_UP }, /* è */ + { 0xE9, AF_ADJUST_UP }, /* é */ + { 0xEA, AF_ADJUST_UP }, /* ê */ + { 0xEB, AF_ADJUST_UP }, /* ë */ + { 0xEC, AF_ADJUST_UP }, /* ì */ + { 0xED, AF_ADJUST_UP }, /* í */ + { 0xEE, AF_ADJUST_UP }, /* î */ + { 0xEF, AF_ADJUST_UP }, /* ï */ + + { 0xF1, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* ñ */ + { 0xF2, AF_ADJUST_UP }, /* ò */ + { 0xF3, AF_ADJUST_UP }, /* ó */ + { 0xF4, AF_ADJUST_UP }, /* ô */ + { 0xF5, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* õ */ + { 0xF6, AF_ADJUST_UP }, /* ö */ + { 0xF8, AF_IGNORE_SMALL_TOP | AF_IGNORE_SMALL_BOTTOM }, /* ø */ + { 0xF9, AF_ADJUST_UP }, /* ù */ + { 0xFA, AF_ADJUST_UP }, /* ú */ + { 0xFB, AF_ADJUST_UP }, /* û */ + { 0xFC, AF_ADJUST_UP }, /* ü */ + { 0xFD, AF_ADJUST_UP }, /* ý */ + { 0xFF, AF_ADJUST_UP }, /* ÿ */ + + /* Latin Extended-A */ + { 0x100, AF_ADJUST_UP }, /* Ä€ */ + { 0x101, AF_ADJUST_UP }, /* Ä */ + { 0x102, AF_ADJUST_UP }, /* Ä‚ */ + { 0x103, AF_ADJUST_UP }, /* ă */ + { 0x104, AF_IGNORE_CAPITAL_BOTTOM }, /* Ä„ */ + { 0x105, AF_IGNORE_SMALL_BOTTOM }, /* Ä… */ + { 0x106, AF_ADJUST_UP }, /* Ć */ + { 0x107, AF_ADJUST_UP }, /* ć */ + { 0x108, AF_ADJUST_UP }, /* Ĉ */ + { 0x109, AF_ADJUST_UP }, /* ĉ */ + { 0x10A, AF_ADJUST_UP }, /* ÄŠ */ + { 0x10B, AF_ADJUST_UP }, /* Ä‹ */ + { 0x10C, AF_ADJUST_UP }, /* ÄŒ */ + { 0x10D, AF_ADJUST_UP }, /* Ä */ + { 0x10E, AF_ADJUST_UP }, /* ÄŽ */ + + { 0x112, AF_ADJUST_UP }, /* Ä’ */ + { 0x113, AF_ADJUST_UP }, /* Ä“ */ + { 0x114, AF_ADJUST_UP }, /* Ä” */ + { 0x115, AF_ADJUST_UP }, /* Ä• */ + { 0x116, AF_ADJUST_UP }, /* Ä– */ + { 0x117, AF_ADJUST_UP }, /* Ä— */ + { 0x118, AF_IGNORE_CAPITAL_BOTTOM }, /* Ę */ + { 0x119, AF_IGNORE_SMALL_BOTTOM }, /* Ä™ */ + { 0x11A, AF_ADJUST_UP }, /* Äš */ + { 0x11B, AF_ADJUST_UP }, /* Ä› */ + { 0x11C, AF_ADJUST_UP }, /* Äœ */ + { 0x11D, AF_ADJUST_UP }, /* Ä */ + { 0x11E, AF_ADJUST_UP }, /* Äž */ + { 0x11F, AF_ADJUST_UP }, /* ÄŸ */ + + { 0x120, AF_ADJUST_UP }, /* Ä  */ + { 0x121, AF_ADJUST_UP }, /* Ä¡ */ + { 0x122, AF_ADJUST_DOWN }, /* Ä¢ */ + { 0x123, AF_ADJUST_UP }, /* Ä£ */ + { 0x124, AF_ADJUST_UP }, /* Ĥ */ + { 0x125, AF_ADJUST_UP }, /* Ä¥ */ + { 0x128, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Ĩ */ + { 0x129, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Ä© */ + { 0x12A, AF_ADJUST_UP }, /* Ī */ + { 0x12B, AF_ADJUST_UP }, /* Ä« */ + { 0x12C, AF_ADJUST_UP }, /* Ĭ */ + { 0x12D, AF_ADJUST_UP }, /* Ä­ */ + { 0x12E, AF_IGNORE_CAPITAL_BOTTOM }, /* Ä® */ + { 0x12F, AF_ADJUST_UP | AF_IGNORE_SMALL_BOTTOM }, /* į */ + + { 0x130, AF_ADJUST_UP }, /* İ */ + { 0x133, AF_ADJUST_UP }, /* ij */ + { 0x134, AF_ADJUST_UP }, /* Ä´ */ + { 0x135, AF_ADJUST_UP }, /* ĵ */ + { 0x136, AF_ADJUST_DOWN }, /* Ķ */ + { 0x137, AF_ADJUST_DOWN }, /* Ä· */ + { 0x139, AF_ADJUST_UP }, /* Ĺ */ + { 0x13A, AF_ADJUST_UP }, /* ĺ */ + { 0x13B, AF_ADJUST_DOWN }, /* Ä» */ + { 0x13C, AF_ADJUST_DOWN }, /* ļ */ + + { 0x143, AF_ADJUST_UP }, /* Ń */ + { 0x144, AF_ADJUST_UP }, /* Å„ */ + { 0x145, AF_ADJUST_DOWN }, /* Å… */ + { 0x146, AF_ADJUST_DOWN }, /* ņ */ + { 0x147, AF_ADJUST_UP }, /* Ň */ + { 0x148, AF_ADJUST_UP }, /* ň */ + { 0x14C, AF_ADJUST_UP }, /* ÅŒ */ + { 0x14D, AF_ADJUST_UP }, /* Å */ + { 0x14E, AF_ADJUST_UP }, /* ÅŽ */ + { 0x14F, AF_ADJUST_UP }, /* Å */ + + { 0x150, AF_ADJUST_UP }, /* Å */ + { 0x151, AF_ADJUST_UP }, /* Å‘ */ + { 0x154, AF_ADJUST_UP }, /* Å” */ + { 0x155, AF_ADJUST_UP }, /* Å• */ + { 0x156, AF_ADJUST_DOWN }, /* Å– */ + { 0x157, AF_ADJUST_DOWN }, /* Å— */ + { 0x158, AF_ADJUST_UP }, /* Ř */ + { 0x159, AF_ADJUST_UP }, /* Å™ */ + { 0x15A, AF_ADJUST_UP }, /* Åš */ + { 0x15B, AF_ADJUST_UP }, /* Å› */ + { 0x15C, AF_ADJUST_UP }, /* Åœ */ + { 0x15D, AF_ADJUST_UP }, /* Å */ + { 0x15E, AF_IGNORE_CAPITAL_BOTTOM }, /* Åž */ + { 0x15F, AF_IGNORE_SMALL_BOTTOM }, /* ÅŸ */ + + { 0x160, AF_ADJUST_UP }, /* Å  */ + { 0x161, AF_ADJUST_UP }, /* Å¡ */ + { 0x162, AF_IGNORE_CAPITAL_BOTTOM }, /* Å¢ */ + { 0x163, AF_IGNORE_SMALL_BOTTOM }, /* Å£ */ + { 0x164, AF_ADJUST_UP }, /* Ť */ + { 0x168, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Ũ */ + { 0x169, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Å© */ + { 0x16A, AF_ADJUST_UP }, /* Ū */ + { 0x16B, AF_ADJUST_UP }, /* Å« */ + { 0x16C, AF_ADJUST_UP }, /* Ŭ */ + { 0x16D, AF_ADJUST_UP }, /* Å­ */ + { 0x16E, AF_ADJUST_UP }, /* Å® */ + { 0x16F, AF_ADJUST_UP }, /* ů */ + + { 0x170, AF_ADJUST_UP }, /* Ű */ + { 0x171, AF_ADJUST_UP }, /* ű */ + { 0x172, AF_IGNORE_CAPITAL_BOTTOM }, /* Ų */ + { 0x173, AF_IGNORE_SMALL_BOTTOM }, /* ų */ + { 0x174, AF_ADJUST_UP }, /* Å´ */ + { 0x175, AF_ADJUST_UP }, /* ŵ */ + { 0x176, AF_ADJUST_UP }, /* Ŷ */ + { 0x177, AF_ADJUST_UP }, /* Å· */ + { 0x178, AF_ADJUST_UP }, /* Ÿ */ + { 0x179, AF_ADJUST_UP }, /* Ź */ + { 0x17A, AF_ADJUST_UP }, /* ź */ + { 0x17B, AF_ADJUST_UP }, /* Å» */ + { 0x17C, AF_ADJUST_UP }, /* ż */ + { 0x17D, AF_ADJUST_UP }, /* Ž */ + { 0x17E, AF_ADJUST_UP }, /* ž */ + + /* Latin Extended-B */ + { 0x187, AF_IGNORE_CAPITAL_TOP }, /* Ƈ */ + { 0x188, AF_IGNORE_SMALL_TOP }, /* ƈ */ + + { 0x1A0, AF_IGNORE_CAPITAL_TOP }, /* Æ  */ + { 0x1A1, AF_IGNORE_SMALL_TOP }, /* Æ¡ */ + { 0x1A5, AF_IGNORE_SMALL_TOP }, /* Æ¥ */ + { 0x1AB, AF_IGNORE_SMALL_BOTTOM }, /* Æ« */ + { 0x1AE, AF_IGNORE_CAPITAL_BOTTOM }, /* Æ® */ + { 0x1AF, AF_IGNORE_CAPITAL_TOP }, /* Ư */ + + { 0x1B0, AF_IGNORE_SMALL_TOP }, /* ư */ + { 0x1B4, AF_IGNORE_SMALL_TOP }, /* Æ´ */ + + { 0x1C3, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ǃ */ + { 0x1C4, AF_ADJUST_UP }, /* Ç„ */ +#if 0 + { 0x1C5, AF_ADJUST_UP }, /* Ç… */ + { 0x1C6, AF_ADJUST_UP }, /* dž */ + { 0x1C8, AF_ADJUST_UP }, /* Lj */ + { 0x1C9, AF_ADJUST_UP }, /* lj */ + { 0x1CB, AF_ADJUST_UP }, /* Ç‹ */ +#endif + { 0x1CC, AF_ADJUST_UP }, /* ÇŒ */ + { 0x1CD, AF_ADJUST_UP }, /* Ç */ + { 0x1CE, AF_ADJUST_UP }, /* ÇŽ */ + { 0x1CF, AF_ADJUST_UP }, /* Ç */ + + { 0x1D0, AF_ADJUST_UP }, /* Ç */ + { 0x1D1, AF_ADJUST_UP }, /* Ç‘ */ + { 0x1D2, AF_ADJUST_UP }, /* Ç’ */ + { 0x1D3, AF_ADJUST_UP }, /* Ç“ */ + { 0x1D4, AF_ADJUST_UP }, /* Ç” */ + { 0x1D5, AF_ADJUST_UP2 }, /* Ç• */ + { 0x1D6, AF_ADJUST_UP2 }, /* Ç– */ + { 0x1D7, AF_ADJUST_UP2 }, /* Ç— */ + { 0x1D8, AF_ADJUST_UP2 }, /* ǘ */ + { 0x1D9, AF_ADJUST_UP2 }, /* Ç™ */ + { 0x1DA, AF_ADJUST_UP2 }, /* Çš */ + { 0x1DB, AF_ADJUST_UP2 }, /* Ç› */ + { 0x1DC, AF_ADJUST_UP2 }, /* Çœ */ + { 0x1DE, AF_ADJUST_UP2 }, /* Çž */ + { 0x1DF, AF_ADJUST_UP2 }, /* ÇŸ */ + + { 0x1E0, AF_ADJUST_UP2 }, /* Ç  */ + { 0x1E1, AF_ADJUST_UP2 }, /* Ç¡ */ + { 0x1E2, AF_ADJUST_UP }, /* Ç¢ */ + { 0x1E3, AF_ADJUST_UP }, /* Ç£ */ + { 0x1E6, AF_ADJUST_UP }, /* Ǧ */ + { 0x1E7, AF_ADJUST_UP }, /* ǧ */ + { 0x1E8, AF_ADJUST_UP }, /* Ǩ */ + { 0x1E9, AF_ADJUST_UP }, /* Ç© */ + { 0x1EA, AF_IGNORE_CAPITAL_BOTTOM }, /* Ǫ */ + { 0x1EB, AF_IGNORE_SMALL_BOTTOM }, /* Ç« */ + { 0x1EC, AF_ADJUST_UP | AF_IGNORE_CAPITAL_BOTTOM }, /* Ǭ */ + { 0x1ED, AF_ADJUST_UP | AF_IGNORE_SMALL_BOTTOM }, /* Ç­ */ + { 0x1EE, AF_ADJUST_UP }, /* Ç® */ + { 0x1EF, AF_ADJUST_UP }, /* ǯ */ + + { 0x1F0, AF_ADJUST_UP }, /* ǰ */ + { 0x1F4, AF_ADJUST_UP }, /* Ç´ */ + { 0x1F5, AF_ADJUST_UP }, /* ǵ */ + { 0x1F8, AF_ADJUST_UP }, /* Ǹ */ + { 0x1F9, AF_ADJUST_UP }, /* ǹ */ + { 0x1FA, AF_ADJUST_UP2 }, /* Ǻ */ + { 0x1FB, AF_ADJUST_UP2 }, /* Ç» */ + { 0x1FC, AF_ADJUST_UP }, /* Ǽ */ + { 0x1FD, AF_ADJUST_UP }, /* ǽ */ + { 0x1FE, AF_ADJUST_UP }, /* Ǿ */ + { 0x1FF, AF_ADJUST_UP }, /* Ç¿ */ + + { 0x200, AF_ADJUST_UP }, /* È€ */ + { 0x201, AF_ADJUST_UP }, /* È */ + { 0x202, AF_ADJUST_UP }, /* È‚ */ + { 0x203, AF_ADJUST_UP }, /* ȃ */ + { 0x204, AF_ADJUST_UP }, /* È„ */ + { 0x205, AF_ADJUST_UP }, /* È… */ + { 0x206, AF_ADJUST_UP }, /* Ȇ */ + { 0x207, AF_ADJUST_UP }, /* ȇ */ + { 0x208, AF_ADJUST_UP }, /* Ȉ */ + { 0x209, AF_ADJUST_UP }, /* ȉ */ + { 0x20A, AF_ADJUST_UP }, /* ÈŠ */ + { 0x20B, AF_ADJUST_UP }, /* È‹ */ + { 0x20C, AF_ADJUST_UP }, /* ÈŒ */ + { 0x20D, AF_ADJUST_UP }, /* È */ + { 0x20E, AF_ADJUST_UP }, /* ÈŽ */ + { 0x20F, AF_ADJUST_UP }, /* È */ + + { 0x210, AF_ADJUST_UP }, /* È */ + { 0x211, AF_ADJUST_UP }, /* È‘ */ + { 0x212, AF_ADJUST_UP }, /* È’ */ + { 0x213, AF_ADJUST_UP }, /* È“ */ + { 0x214, AF_ADJUST_UP }, /* È” */ + { 0x215, AF_ADJUST_UP }, /* È• */ + { 0x216, AF_ADJUST_UP }, /* È– */ + { 0x217, AF_ADJUST_UP }, /* È— */ + { 0x218, AF_ADJUST_DOWN }, /* Ș */ + { 0x219, AF_ADJUST_DOWN }, /* È™ */ + { 0x21A, AF_ADJUST_DOWN }, /* Èš */ + { 0x21B, AF_ADJUST_DOWN }, /* È› */ + { 0x21E, AF_ADJUST_UP }, /* Èž */ + { 0x21F, AF_ADJUST_UP }, /* ÈŸ */ + + { 0x224, AF_IGNORE_CAPITAL_BOTTOM }, /* Ȥ */ + { 0x225, AF_IGNORE_SMALL_BOTTOM }, /* È¥ */ + { 0x226, AF_ADJUST_UP }, /* Ȧ */ + { 0x227, AF_ADJUST_UP }, /* ȧ */ + { 0x228, AF_IGNORE_CAPITAL_BOTTOM }, /* Ȩ */ + { 0x229, AF_IGNORE_SMALL_BOTTOM }, /* È© */ + { 0x22A, AF_ADJUST_UP2 }, /* Ȫ */ + { 0x22B, AF_ADJUST_UP2 }, /* È« */ + { 0x22C, AF_ADJUST_UP2 }, /* Ȭ */ + { 0x22D, AF_ADJUST_UP2 }, /* È­ */ + { 0x22E, AF_ADJUST_UP }, /* È® */ + { 0x22F, AF_ADJUST_UP }, /* ȯ */ + + { 0x230, AF_ADJUST_UP2 }, /* Ȱ */ + { 0x231, AF_ADJUST_UP2 }, /* ȱ */ + { 0x232, AF_ADJUST_UP }, /* Ȳ */ + { 0x233, AF_ADJUST_UP }, /* ȳ */ + { 0x23A, AF_IGNORE_CAPITAL_TOP | AF_IGNORE_CAPITAL_BOTTOM }, /* Ⱥ */ + { 0x23B, AF_IGNORE_CAPITAL_TOP | AF_IGNORE_CAPITAL_BOTTOM }, /* È» */ + { 0x23F, AF_IGNORE_SMALL_BOTTOM }, /* È¿ */ + + { 0x240, AF_IGNORE_SMALL_BOTTOM }, /* É€ */ + { 0x249, AF_ADJUST_UP }, /* ɉ */ + + /* IPA Extensions */ + { 0x256, AF_IGNORE_SMALL_BOTTOM }, /* É– */ + + { 0x260, AF_IGNORE_SMALL_TOP }, /* É  */ + { 0x267, AF_IGNORE_SMALL_BOTTOM }, /* ɧ */ + { 0x268, AF_ADJUST_UP }, /* ɨ */ + + { 0x272, AF_IGNORE_SMALL_BOTTOM }, /* ɲ */ + { 0x273, AF_IGNORE_SMALL_BOTTOM }, /* ɳ */ + { 0x27B, AF_IGNORE_SMALL_BOTTOM }, /* É» */ + { 0x27D, AF_IGNORE_SMALL_BOTTOM }, /* ɽ */ + + { 0x282, AF_IGNORE_SMALL_BOTTOM }, /* Ê‚ */ + { 0x288, AF_IGNORE_SMALL_BOTTOM }, /* ʈ */ + + { 0x290, AF_IGNORE_SMALL_BOTTOM }, /* Ê */ + { 0x29B, AF_IGNORE_SMALL_TOP }, /* Ê› */ + + { 0x2A0, AF_IGNORE_SMALL_TOP }, /* Ê  */ + + /* Spacing Modifier Letters */ + { 0x2B2, AF_ADJUST_UP }, /* ʲ */ + { 0x2B5, AF_IGNORE_SMALL_BOTTOM }, /* ʵ */ + + /* Greek and Coptic */ + { 0x390, AF_ADJUST_UP2 }, /* Î */ + + { 0x3AA, AF_ADJUST_UP }, /* Ϊ */ + { 0x3AB, AF_ADJUST_UP }, /* Ϋ */ + { 0x3AC, AF_ADJUST_UP }, /* ά */ + { 0x3AD, AF_ADJUST_UP }, /* έ */ + { 0x3AE, AF_ADJUST_UP }, /* ή */ + { 0x3AF, AF_ADJUST_UP }, /* ί */ + + { 0x3B0, AF_ADJUST_UP2 }, /* ΰ */ + + { 0x3CA, AF_ADJUST_UP }, /* ÏŠ */ + { 0x3CB, AF_ADJUST_UP }, /* Ï‹ */ + { 0x3CC, AF_ADJUST_UP }, /* ÏŒ */ + { 0x3CD, AF_ADJUST_UP }, /* Ï */ + { 0x3CE, AF_ADJUST_UP }, /* ÏŽ */ + { 0x3CF, AF_IGNORE_CAPITAL_BOTTOM }, /* Ï */ + + { 0x3D4, AF_ADJUST_UP }, /* Ï” */ + { 0x3D7, AF_IGNORE_SMALL_BOTTOM }, /* Ï— */ + { 0x3D9, AF_IGNORE_SMALL_BOTTOM }, /* Ï™ */ + + { 0x3E2, AF_IGNORE_CAPITAL_BOTTOM }, /* Ï¢ */ + { 0x3E3, AF_IGNORE_SMALL_BOTTOM }, /* Ï£ */ + + { 0x3F3, AF_ADJUST_UP }, /* ϳ */ + + /* Cyrillic */ + { 0x400, AF_ADJUST_UP }, /* Ѐ */ + { 0x401, AF_ADJUST_UP }, /* Ð */ + { 0x403, AF_ADJUST_UP }, /* Ѓ */ + { 0x407, AF_ADJUST_UP }, /* Ї */ + { 0x40C, AF_ADJUST_UP }, /* ÐŒ */ + { 0x40D, AF_ADJUST_UP }, /* Ð */ + { 0x40E, AF_ADJUST_UP }, /* ÐŽ */ + { 0x40F, AF_IGNORE_CAPITAL_BOTTOM }, /* Ð */ + + { 0x419, AF_ADJUST_UP }, /* Й */ + + { 0x426, AF_IGNORE_CAPITAL_BOTTOM }, /* Ц */ + { 0x429, AF_IGNORE_CAPITAL_BOTTOM }, /* Щ */ + + { 0x439, AF_ADJUST_UP }, /* й */ + + { 0x446, AF_IGNORE_SMALL_BOTTOM }, /* ц */ + { 0x449, AF_IGNORE_SMALL_BOTTOM }, /* щ */ + + { 0x450, AF_ADJUST_UP }, /* Ñ */ + { 0x451, AF_ADJUST_UP }, /* Ñ‘ */ + { 0x453, AF_ADJUST_UP }, /* Ñ“ */ + { 0x456, AF_ADJUST_UP }, /* Ñ– */ + { 0x457, AF_ADJUST_UP }, /* Ñ— */ + { 0x458, AF_ADJUST_UP }, /* ј */ + { 0x45C, AF_ADJUST_UP }, /* Ñœ */ + { 0x45D, AF_ADJUST_UP }, /* Ñ */ + { 0x45E, AF_ADJUST_UP }, /* Ñž */ + { 0x45F, AF_IGNORE_SMALL_BOTTOM }, /* ÑŸ */ + + { 0x476, AF_ADJUST_UP }, /* Ѷ */ + { 0x477, AF_ADJUST_UP }, /* Ñ· */ + { 0x47C, AF_ADJUST_UP2 }, /* Ѽ */ + { 0x47D, AF_ADJUST_UP2 }, /* ѽ */ + { 0x47E, AF_ADJUST_UP }, /* Ѿ */ + { 0x47F, AF_ADJUST_UP }, /* Ñ¿ */ + + { 0x480, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò€ */ + { 0x481, AF_IGNORE_SMALL_BOTTOM }, /* Ò */ + { 0x48A, AF_ADJUST_UP | AF_IGNORE_CAPITAL_BOTTOM }, /* ÒŠ */ + { 0x48B, AF_ADJUST_UP | AF_IGNORE_SMALL_BOTTOM }, /* Ò‹ */ + + { 0x490, AF_IGNORE_CAPITAL_TOP }, /* Ò */ + { 0x491, AF_IGNORE_SMALL_TOP }, /* Ò‘ */ + { 0x496, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò– */ + { 0x497, AF_IGNORE_SMALL_BOTTOM }, /* Ò— */ + { 0x498, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò˜ */ + { 0x499, AF_IGNORE_SMALL_BOTTOM }, /* Ò™ */ + { 0x49A, AF_IGNORE_CAPITAL_BOTTOM }, /* Òš */ + { 0x49B, AF_IGNORE_SMALL_BOTTOM }, /* Ò› */ + + { 0x4A2, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò¢ */ + { 0x4A3, AF_IGNORE_SMALL_BOTTOM }, /* Ò£ */ + { 0x4AA, AF_IGNORE_CAPITAL_BOTTOM }, /* Òª */ + { 0x4AB, AF_IGNORE_SMALL_BOTTOM }, /* Ò« */ + { 0x4AC, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò¬ */ + { 0x4AD, AF_IGNORE_SMALL_BOTTOM }, /* Ò­ */ + + { 0x4B2, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò² */ + { 0x4B3, AF_IGNORE_SMALL_BOTTOM }, /* Ò³ */ + { 0x4B4, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò´ */ + { 0x4B5, AF_IGNORE_SMALL_BOTTOM }, /* Òµ */ + { 0x4B6, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò¶ */ + { 0x4B7, AF_IGNORE_SMALL_BOTTOM }, /* Ò· */ + { 0x4BE, AF_IGNORE_CAPITAL_BOTTOM }, /* Ò¾ */ + { 0x4BF, AF_IGNORE_SMALL_BOTTOM }, /* Ò¿ */ + + { 0x4C1, AF_ADJUST_UP }, /* Ó */ + { 0x4C2, AF_ADJUST_UP }, /* Ó‚ */ + { 0x4C5, AF_IGNORE_CAPITAL_BOTTOM }, /* Ó… */ + { 0x4C6, AF_IGNORE_SMALL_BOTTOM }, /* Ó† */ + { 0x4C9, AF_IGNORE_CAPITAL_BOTTOM }, /* Ó‰ */ + { 0x4CA, AF_IGNORE_SMALL_BOTTOM }, /* ÓŠ */ + { 0x4CB, AF_IGNORE_CAPITAL_BOTTOM }, /* Ó‹ */ + { 0x4CC, AF_IGNORE_SMALL_BOTTOM }, /* ÓŒ */ + { 0x4CD, AF_IGNORE_CAPITAL_BOTTOM }, /* Ó */ + { 0x4CE, AF_IGNORE_SMALL_BOTTOM }, /* ÓŽ */ + + { 0x4D0, AF_ADJUST_UP }, /* Ó */ + { 0x4D1, AF_ADJUST_UP }, /* Ó‘ */ + { 0x4D2, AF_ADJUST_UP }, /* Ó’ */ + { 0x4D3, AF_ADJUST_UP }, /* Ó“ */ + { 0x4D6, AF_ADJUST_UP }, /* Ó– */ + { 0x4D7, AF_ADJUST_UP }, /* Ó— */ + { 0x4DA, AF_ADJUST_UP }, /* Óš */ + { 0x4DB, AF_ADJUST_UP }, /* Ó› */ + { 0x4DC, AF_ADJUST_UP }, /* Óœ */ + { 0x4DD, AF_ADJUST_UP }, /* Ó */ + { 0x4DE, AF_ADJUST_UP }, /* Óž */ + { 0x4DF, AF_ADJUST_UP }, /* ÓŸ */ + + { 0x4E2, AF_ADJUST_UP }, /* Ó¢ */ + { 0x4E3, AF_ADJUST_UP }, /* Ó£ */ + { 0x4E4, AF_ADJUST_UP }, /* Ó¤ */ + { 0x4E5, AF_ADJUST_UP }, /* Ó¥ */ + { 0x4E6, AF_ADJUST_UP }, /* Ó¦ */ + { 0x4E7, AF_ADJUST_UP }, /* Ó§ */ + { 0x4EA, AF_ADJUST_UP }, /* Óª */ + { 0x4EB, AF_ADJUST_UP }, /* Ó« */ + { 0x4EC, AF_ADJUST_UP }, /* Ó¬ */ + { 0x4ED, AF_ADJUST_UP }, /* Ó­ */ + { 0x4EE, AF_ADJUST_UP }, /* Ó® */ + { 0x4EF, AF_ADJUST_UP }, /* Ó¯ */ + + { 0x4F0, AF_ADJUST_UP }, /* Ó° */ + { 0x4F1, AF_ADJUST_UP }, /* Ó± */ + { 0x4F2, AF_ADJUST_UP }, /* Ó² */ + { 0x4F3, AF_ADJUST_UP }, /* Ó³ */ + { 0x4F4, AF_ADJUST_UP }, /* Ó´ */ + { 0x4F5, AF_ADJUST_UP }, /* Óµ */ + { 0x4F6, AF_IGNORE_CAPITAL_BOTTOM }, /* Ó¶ */ + { 0x4F7, AF_IGNORE_SMALL_BOTTOM }, /* Ó· */ + { 0x4F8, AF_ADJUST_UP }, /* Ó¸ */ + { 0x4F9, AF_ADJUST_UP }, /* Ó¹ */ + { 0x4FA, AF_IGNORE_CAPITAL_BOTTOM }, /* Óº */ + { 0x4FB, AF_IGNORE_SMALL_BOTTOM }, /* Ó» */ + + /* Cyrillic Supplement */ + { 0x506, AF_IGNORE_CAPITAL_BOTTOM }, /* Ô† */ + { 0x507, AF_IGNORE_SMALL_BOTTOM }, /* Ô‡ */ + + { 0x524, AF_IGNORE_CAPITAL_BOTTOM }, /* Ô¤ */ + { 0x525, AF_IGNORE_SMALL_BOTTOM }, /* Ô¥ */ + { 0x526, AF_IGNORE_CAPITAL_BOTTOM }, /* Ô¦ */ + { 0x527, AF_IGNORE_SMALL_BOTTOM }, /* Ô§ */ + { 0x52E, AF_IGNORE_CAPITAL_BOTTOM }, /* Ô® */ + { 0x52F, AF_IGNORE_SMALL_BOTTOM }, /* Ô¯ */ + + /* Cherokee */ + { 0x13A5, AF_ADJUST_UP }, /* Ꭵ */ + + /* Phonetic Extensions */ + { 0x1D09, AF_ADJUST_DOWN }, /* á´‰ */ + + { 0x1D4E, AF_ADJUST_DOWN }, /* ᵎ */ + + { 0x1D51, AF_IGNORE_SMALL_BOTTOM }, /* ᵑ */ + + { 0x1D62, AF_ADJUST_UP }, /* áµ¢ */ + + /* Phonetic Extensions Supplement */ + { 0x1D80, AF_IGNORE_SMALL_BOTTOM }, /* á¶€ */ + { 0x1D81, AF_IGNORE_SMALL_BOTTOM }, /* á¶ */ + { 0x1D82, AF_IGNORE_SMALL_BOTTOM }, /* á¶‚ */ + { 0x1D84, AF_IGNORE_SMALL_BOTTOM }, /* á¶„ */ + { 0x1D85, AF_IGNORE_SMALL_BOTTOM }, /* á¶… */ + { 0x1D86, AF_IGNORE_SMALL_BOTTOM }, /* ᶆ */ + { 0x1D87, AF_IGNORE_SMALL_BOTTOM }, /* ᶇ */ + { 0x1D89, AF_IGNORE_SMALL_BOTTOM }, /* ᶉ */ + { 0x1D8A, AF_IGNORE_SMALL_BOTTOM }, /* á¶Š */ + { 0x1D8C, AF_IGNORE_SMALL_BOTTOM }, /* á¶Œ */ + { 0x1D8D, AF_IGNORE_SMALL_BOTTOM }, /* á¶ */ + { 0x1D8E, AF_IGNORE_SMALL_BOTTOM }, /* á¶Ž */ + { 0x1D8F, AF_IGNORE_SMALL_BOTTOM }, /* á¶ */ + + { 0x1D90, AF_IGNORE_SMALL_BOTTOM }, /* á¶ */ + { 0x1D91, AF_IGNORE_SMALL_BOTTOM }, /* á¶‘ */ + { 0x1D92, AF_IGNORE_SMALL_BOTTOM }, /* á¶’ */ + { 0x1D93, AF_IGNORE_SMALL_BOTTOM }, /* á¶“ */ + { 0x1D94, AF_IGNORE_SMALL_BOTTOM }, /* á¶” */ + { 0x1D95, AF_IGNORE_SMALL_BOTTOM }, /* á¶• */ + { 0x1D96, AF_ADJUST_UP | AF_IGNORE_SMALL_BOTTOM }, /* á¶– */ + { 0x1D97, AF_IGNORE_SMALL_BOTTOM }, /* á¶— */ + { 0x1D98, AF_IGNORE_SMALL_BOTTOM }, /* ᶘ */ + { 0x1D99, AF_IGNORE_SMALL_BOTTOM }, /* á¶™ */ + { 0x1D9A, AF_IGNORE_SMALL_BOTTOM }, /* á¶š */ + + { 0x1DA4, AF_ADJUST_UP }, /* ᶤ */ + { 0x1DA8, AF_ADJUST_UP }, /* ᶨ */ + { 0x1DA9, AF_IGNORE_SMALL_BOTTOM }, /* á¶© */ + { 0x1DAA, AF_IGNORE_SMALL_BOTTOM }, /* ᶪ */ + { 0x1DAC, AF_IGNORE_SMALL_BOTTOM }, /* ᶬ */ + { 0x1DAE, AF_IGNORE_SMALL_BOTTOM }, /* á¶® */ + { 0x1DAF, AF_IGNORE_SMALL_BOTTOM }, /* ᶯ */ + + { 0x1DB3, AF_IGNORE_SMALL_BOTTOM }, /* á¶³ */ + { 0x1DB5, AF_IGNORE_SMALL_BOTTOM }, /* á¶µ */ + { 0x1DBC, AF_IGNORE_SMALL_BOTTOM }, /* á¶¼ */ + + /* Latin Extended Additional */ + { 0x1E00, AF_ADJUST_DOWN }, /* Ḁ */ + { 0x1E01, AF_ADJUST_DOWN }, /* Ḡ*/ + { 0x1E02, AF_ADJUST_UP }, /* Ḃ */ + { 0x1E03, AF_ADJUST_UP }, /* ḃ */ + { 0x1E04, AF_ADJUST_DOWN }, /* Ḅ */ + { 0x1E05, AF_ADJUST_DOWN }, /* ḅ */ + { 0x1E06, AF_ADJUST_DOWN }, /* Ḇ */ + { 0x1E07, AF_ADJUST_DOWN }, /* ḇ */ + { 0x1E08, AF_ADJUST_UP | AF_IGNORE_CAPITAL_BOTTOM }, /* Ḉ */ + { 0x1E09, AF_ADJUST_UP | AF_IGNORE_SMALL_BOTTOM }, /* ḉ */ + { 0x1E0A, AF_ADJUST_UP }, /* Ḋ */ + { 0x1E0B, AF_ADJUST_UP }, /* ḋ */ + { 0x1E0C, AF_ADJUST_DOWN }, /* Ḍ */ + { 0x1E0D, AF_ADJUST_DOWN }, /* Ḡ*/ + { 0x1E0E, AF_ADJUST_DOWN }, /* Ḏ */ + { 0x1E0F, AF_ADJUST_DOWN }, /* Ḡ*/ + + { 0x1E10, AF_ADJUST_DOWN }, /* Ḡ*/ + { 0x1E11, AF_ADJUST_DOWN }, /* ḑ */ + { 0x1E12, AF_ADJUST_DOWN }, /* Ḓ */ + { 0x1E13, AF_ADJUST_DOWN }, /* ḓ */ + { 0x1E14, AF_ADJUST_UP2 }, /* Ḕ */ + { 0x1E15, AF_ADJUST_UP2 }, /* ḕ */ + { 0x1E16, AF_ADJUST_UP2 }, /* Ḗ */ + { 0x1E17, AF_ADJUST_UP2 }, /* ḗ */ + { 0x1E18, AF_ADJUST_DOWN }, /* Ḙ */ + { 0x1E19, AF_ADJUST_DOWN }, /* ḙ */ + { 0x1E1A, AF_ADJUST_DOWN | AF_ADJUST_TILDE_BOTTOM }, /* Ḛ */ + { 0x1E1B, AF_ADJUST_DOWN | AF_ADJUST_TILDE_BOTTOM }, /* ḛ */ + { 0x1E1C, AF_ADJUST_UP | AF_IGNORE_CAPITAL_BOTTOM }, /* Ḝ */ + { 0x1E1D, AF_ADJUST_UP | AF_IGNORE_SMALL_BOTTOM }, /* Ḡ*/ + { 0x1E1E, AF_ADJUST_UP }, /* Ḟ */ + { 0x1E1F, AF_ADJUST_UP }, /* ḟ */ + + { 0x1E20, AF_ADJUST_UP }, /* Ḡ */ + { 0x1E21, AF_ADJUST_UP }, /* ḡ */ + { 0x1E22, AF_ADJUST_UP }, /* Ḣ */ + { 0x1E23, AF_ADJUST_UP }, /* ḣ */ + { 0x1E24, AF_ADJUST_DOWN }, /* Ḥ */ + { 0x1E25, AF_ADJUST_DOWN }, /* ḥ */ + { 0x1E26, AF_ADJUST_UP }, /* Ḧ */ + { 0x1E27, AF_ADJUST_UP }, /* ḧ */ + { 0x1E28, AF_IGNORE_CAPITAL_BOTTOM }, /* Ḩ */ + { 0x1E29, AF_IGNORE_SMALL_BOTTOM }, /* ḩ */ + { 0x1E2A, AF_ADJUST_DOWN }, /* Ḫ */ + { 0x1E2B, AF_ADJUST_DOWN }, /* ḫ */ + { 0x1E2C, AF_ADJUST_DOWN | AF_ADJUST_TILDE_BOTTOM }, /* Ḭ */ + { 0x1E2D, AF_ADJUST_UP | AF_ADJUST_DOWN | AF_ADJUST_TILDE_BOTTOM }, /* ḭ */ + { 0x1E2E, AF_ADJUST_UP2 }, /* Ḯ */ + { 0x1E2F, AF_ADJUST_UP2 }, /* ḯ */ + + { 0x1E30, AF_ADJUST_UP }, /* Ḱ */ + { 0x1E31, AF_ADJUST_UP }, /* ḱ */ + { 0x1E32, AF_ADJUST_DOWN }, /* Ḳ */ + { 0x1E33, AF_ADJUST_DOWN }, /* ḳ */ + { 0x1E34, AF_ADJUST_DOWN }, /* Ḵ */ + { 0x1E35, AF_ADJUST_DOWN }, /* ḵ */ + { 0x1E36, AF_ADJUST_DOWN }, /* Ḷ */ + { 0x1E37, AF_ADJUST_DOWN }, /* ḷ */ + { 0x1E38, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* Ḹ */ + { 0x1E39, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ḹ */ + { 0x1E3A, AF_ADJUST_DOWN }, /* Ḻ */ + { 0x1E3B, AF_ADJUST_DOWN }, /* ḻ */ + { 0x1E3C, AF_ADJUST_DOWN }, /* Ḽ */ + { 0x1E3D, AF_ADJUST_DOWN }, /* ḽ */ + { 0x1E3E, AF_ADJUST_UP }, /* Ḿ */ + { 0x1E3F, AF_ADJUST_UP }, /* ḿ */ + + { 0x1E40, AF_ADJUST_UP }, /* á¹€ */ + { 0x1E41, AF_ADJUST_UP }, /* á¹ */ + { 0x1E42, AF_ADJUST_DOWN }, /* Ṃ */ + { 0x1E43, AF_ADJUST_DOWN }, /* ṃ */ + { 0x1E44, AF_ADJUST_UP }, /* Ṅ */ + { 0x1E45, AF_ADJUST_UP }, /* á¹… */ + { 0x1E46, AF_ADJUST_DOWN }, /* Ṇ */ + { 0x1E47, AF_ADJUST_DOWN }, /* ṇ */ + { 0x1E48, AF_ADJUST_DOWN }, /* Ṉ */ + { 0x1E49, AF_ADJUST_DOWN }, /* ṉ */ + { 0x1E4A, AF_ADJUST_DOWN }, /* Ṋ */ + { 0x1E4B, AF_ADJUST_DOWN }, /* ṋ */ + { 0x1E4C, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP2 }, /* Ṍ */ + { 0x1E4D, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP2 }, /* á¹ */ + { 0x1E4E, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP2 }, /* Ṏ */ + { 0x1E4F, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP2 }, /* á¹ */ + + { 0x1E50, AF_ADJUST_UP2 }, /* á¹ */ + { 0x1E51, AF_ADJUST_UP2 }, /* ṑ */ + { 0x1E52, AF_ADJUST_UP2 }, /* á¹’ */ + { 0x1E53, AF_ADJUST_UP2 }, /* ṓ */ + { 0x1E54, AF_ADJUST_UP }, /* á¹” */ + { 0x1E55, AF_ADJUST_UP }, /* ṕ */ + { 0x1E56, AF_ADJUST_UP }, /* á¹– */ + { 0x1E57, AF_ADJUST_UP }, /* á¹— */ + { 0x1E58, AF_ADJUST_UP }, /* Ṙ */ + { 0x1E59, AF_ADJUST_UP }, /* á¹™ */ + { 0x1E5A, AF_ADJUST_DOWN }, /* Ṛ */ + { 0x1E5B, AF_ADJUST_DOWN }, /* á¹› */ + { 0x1E5C, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* Ṝ */ + { 0x1E5D, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¹ */ + { 0x1E5E, AF_ADJUST_DOWN }, /* Ṟ */ + { 0x1E5F, AF_ADJUST_DOWN }, /* ṟ */ + + { 0x1E60, AF_ADJUST_UP }, /* á¹  */ + { 0x1E61, AF_ADJUST_UP }, /* ṡ */ + { 0x1E62, AF_ADJUST_DOWN }, /* á¹¢ */ + { 0x1E63, AF_ADJUST_DOWN }, /* á¹£ */ + { 0x1E64, AF_ADJUST_UP }, /* Ṥ */ + { 0x1E65, AF_ADJUST_UP }, /* á¹¥ */ + { 0x1E66, AF_ADJUST_UP }, /* Ṧ */ + { 0x1E67, AF_ADJUST_UP }, /* á¹§ */ + { 0x1E68, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* Ṩ */ + { 0x1E69, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ṩ */ + { 0x1E6A, AF_ADJUST_UP }, /* Ṫ */ + { 0x1E6B, AF_ADJUST_UP }, /* ṫ */ + { 0x1E6C, AF_ADJUST_DOWN }, /* Ṭ */ + { 0x1E6D, AF_ADJUST_DOWN }, /* á¹­ */ + { 0x1E6E, AF_ADJUST_DOWN }, /* á¹® */ + { 0x1E6F, AF_ADJUST_DOWN }, /* ṯ */ + + { 0x1E70, AF_ADJUST_DOWN }, /* á¹° */ + { 0x1E71, AF_ADJUST_DOWN }, /* á¹± */ + { 0x1E72, AF_ADJUST_DOWN }, /* á¹² */ + { 0x1E73, AF_ADJUST_DOWN }, /* á¹³ */ + { 0x1E74, AF_ADJUST_DOWN | AF_ADJUST_TILDE_BOTTOM }, /* á¹´ */ + { 0x1E75, AF_ADJUST_DOWN | AF_ADJUST_TILDE_BOTTOM }, /* á¹µ */ + { 0x1E76, AF_ADJUST_DOWN }, /* á¹¶ */ + { 0x1E77, AF_ADJUST_DOWN }, /* á¹· */ + { 0x1E78, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP2 }, /* Ṹ */ + { 0x1E79, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP2 }, /* á¹¹ */ + { 0x1E7A, AF_ADJUST_UP2 }, /* Ṻ */ + { 0x1E7B, AF_ADJUST_UP2 }, /* á¹» */ + { 0x1E7C, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* á¹¼ */ + { 0x1E7D, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* á¹½ */ + { 0x1E7E, AF_ADJUST_DOWN }, /* á¹¾ */ + { 0x1E7F, AF_ADJUST_DOWN }, /* ṿ */ + + { 0x1E80, AF_ADJUST_UP }, /* Ẁ */ + { 0x1E81, AF_ADJUST_UP }, /* Ạ*/ + { 0x1E82, AF_ADJUST_UP }, /* Ẃ */ + { 0x1E83, AF_ADJUST_UP }, /* ẃ */ + { 0x1E84, AF_ADJUST_UP }, /* Ẅ */ + { 0x1E85, AF_ADJUST_UP }, /* ẅ */ + { 0x1E86, AF_ADJUST_UP }, /* Ẇ */ + { 0x1E87, AF_ADJUST_UP }, /* ẇ */ + { 0x1E88, AF_ADJUST_DOWN }, /* Ẉ */ + { 0x1E89, AF_ADJUST_DOWN }, /* ẉ */ + { 0x1E8A, AF_ADJUST_UP }, /* Ẋ */ + { 0x1E8B, AF_ADJUST_UP }, /* ẋ */ + { 0x1E8C, AF_ADJUST_UP }, /* Ẍ */ + { 0x1E8D, AF_ADJUST_UP }, /* Ạ*/ + { 0x1E8E, AF_ADJUST_UP }, /* Ẏ */ + { 0x1E8F, AF_ADJUST_UP }, /* Ạ*/ + + { 0x1E90, AF_ADJUST_UP }, /* Ạ*/ + { 0x1E91, AF_ADJUST_UP }, /* ẑ */ + { 0x1E92, AF_ADJUST_DOWN }, /* Ẓ */ + { 0x1E93, AF_ADJUST_DOWN }, /* ẓ */ + { 0x1E94, AF_ADJUST_DOWN }, /* Ẕ */ + { 0x1E95, AF_ADJUST_DOWN }, /* ẕ */ + { 0x1E96, AF_ADJUST_DOWN }, /* ẖ */ + { 0x1E97, AF_ADJUST_UP }, /* ẗ */ + { 0x1E98, AF_ADJUST_UP }, /* ẘ */ + { 0x1E99, AF_ADJUST_UP }, /* ẙ */ + { 0x1E9A, AF_ADJUST_UP }, /* ẚ */ + { 0x1E9B, AF_ADJUST_UP }, /* ẛ */ + + { 0x1EA0, AF_ADJUST_DOWN }, /* Ạ */ + { 0x1EA1, AF_ADJUST_DOWN }, /* ạ */ + { 0x1EA2, AF_ADJUST_UP }, /* Ả */ + { 0x1EA3, AF_ADJUST_UP }, /* ả */ + { 0x1EA4, AF_ADJUST_UP2 }, /* Ấ */ + { 0x1EA5, AF_ADJUST_UP2 }, /* ấ */ + { 0x1EA6, AF_ADJUST_UP2 }, /* Ầ */ + { 0x1EA7, AF_ADJUST_UP2 }, /* ầ */ + { 0x1EA8, AF_ADJUST_UP2 }, /* Ẩ */ + { 0x1EA9, AF_ADJUST_UP2 }, /* ẩ */ + { 0x1EAA, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* Ẫ */ + { 0x1EAB, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* ẫ */ + { 0x1EAC, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* Ậ */ + { 0x1EAD, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ậ */ + { 0x1EAE, AF_ADJUST_UP2 }, /* Ắ */ + { 0x1EAF, AF_ADJUST_UP2 }, /* ắ */ + + { 0x1EB0, AF_ADJUST_UP2 }, /* Ằ */ + { 0x1EB1, AF_ADJUST_UP2 }, /* ằ */ + { 0x1EB2, AF_ADJUST_UP2 }, /* Ẳ */ + { 0x1EB3, AF_ADJUST_UP2 }, /* ẳ */ + { 0x1EB4, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* Ẵ */ + { 0x1EB5, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* ẵ */ + { 0x1EB6, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* Ặ */ + { 0x1EB7, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ặ */ + { 0x1EB8, AF_ADJUST_DOWN }, /* Ẹ */ + { 0x1EB9, AF_ADJUST_DOWN }, /* ẹ */ + { 0x1EBA, AF_ADJUST_UP }, /* Ẻ */ + { 0x1EBB, AF_ADJUST_UP }, /* ẻ */ + { 0x1EBC, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Ẽ */ + { 0x1EBD, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* ẽ */ + { 0x1EBE, AF_ADJUST_UP2 }, /* Ế */ + { 0x1EBF, AF_ADJUST_UP2 }, /* ế */ + + { 0x1EC0, AF_ADJUST_UP2 }, /* Ề */ + { 0x1EC1, AF_ADJUST_UP2 }, /* á» */ + { 0x1EC2, AF_ADJUST_UP2 }, /* Ể */ + { 0x1EC3, AF_ADJUST_UP2 }, /* ể */ + { 0x1EC4, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* Ễ */ + { 0x1EC5, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á»… */ + { 0x1EC6, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* Ệ */ + { 0x1EC7, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ệ */ + { 0x1EC8, AF_ADJUST_UP }, /* Ỉ */ + { 0x1EC9, AF_ADJUST_UP }, /* ỉ */ + { 0x1ECA, AF_ADJUST_DOWN }, /* Ị */ + { 0x1ECB, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ị */ + { 0x1ECC, AF_ADJUST_DOWN }, /* Ọ */ + { 0x1ECD, AF_ADJUST_DOWN }, /* á» */ + { 0x1ECE, AF_ADJUST_UP }, /* Ỏ */ + { 0x1ECF, AF_ADJUST_UP }, /* á» */ + + { 0x1ED0, AF_ADJUST_UP2 }, /* á» */ + { 0x1ED1, AF_ADJUST_UP2 }, /* ố */ + { 0x1ED2, AF_ADJUST_UP2 }, /* á»’ */ + { 0x1ED3, AF_ADJUST_UP2 }, /* ồ */ + { 0x1ED4, AF_ADJUST_UP2 }, /* á»” */ + { 0x1ED5, AF_ADJUST_UP2 }, /* ổ */ + { 0x1ED6, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á»– */ + { 0x1ED7, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á»— */ + { 0x1ED8, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* Ộ */ + { 0x1ED9, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á»™ */ + { 0x1EDA, AF_ADJUST_UP | AF_IGNORE_CAPITAL_TOP }, /* Ớ */ + { 0x1EDB, AF_ADJUST_UP | AF_IGNORE_SMALL_TOP }, /* á»› */ + { 0x1EDC, AF_ADJUST_UP | AF_IGNORE_CAPITAL_TOP }, /* Ờ */ + { 0x1EDD, AF_ADJUST_UP | AF_IGNORE_SMALL_TOP }, /* á» */ + { 0x1EDE, AF_ADJUST_UP | AF_IGNORE_CAPITAL_TOP }, /* Ở */ + { 0x1EDF, AF_ADJUST_UP | AF_IGNORE_SMALL_TOP }, /* ở */ + + { 0x1EE0, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP | AF_IGNORE_CAPITAL_TOP }, /* á»  */ + { 0x1EE1, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP | AF_IGNORE_SMALL_TOP }, /* ỡ */ + { 0x1EE2, AF_ADJUST_DOWN | AF_IGNORE_CAPITAL_TOP }, /* Ợ */ + { 0x1EE3, AF_ADJUST_DOWN | AF_IGNORE_SMALL_TOP }, /* ợ */ + { 0x1EE4, AF_ADJUST_DOWN }, /* Ụ */ + { 0x1EE5, AF_ADJUST_DOWN }, /* ụ */ + { 0x1EE6, AF_ADJUST_UP }, /* Ủ */ + { 0x1EE7, AF_ADJUST_UP }, /* á»§ */ + { 0x1EE8, AF_ADJUST_UP | AF_IGNORE_CAPITAL_TOP }, /* Ứ */ + { 0x1EE9, AF_ADJUST_UP | AF_IGNORE_SMALL_TOP }, /* ứ */ + { 0x1EEA, AF_ADJUST_UP | AF_IGNORE_CAPITAL_TOP }, /* Ừ */ + { 0x1EEB, AF_ADJUST_UP | AF_IGNORE_SMALL_TOP }, /* ừ */ + { 0x1EEC, AF_ADJUST_UP | AF_IGNORE_CAPITAL_TOP }, /* Ử */ + { 0x1EED, AF_ADJUST_UP | AF_IGNORE_SMALL_TOP }, /* á»­ */ + { 0x1EEE, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP | AF_IGNORE_CAPITAL_TOP }, /* á»® */ + { 0x1EEF, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP | AF_IGNORE_SMALL_TOP }, /* ữ */ + + { 0x1EF0, AF_ADJUST_DOWN | AF_IGNORE_CAPITAL_TOP }, /* á»° */ + { 0x1EF1, AF_ADJUST_DOWN | AF_IGNORE_SMALL_TOP }, /* á»± */ + { 0x1EF2, AF_ADJUST_UP }, /* Ỳ */ + { 0x1EF3, AF_ADJUST_UP }, /* ỳ */ + { 0x1EF4, AF_ADJUST_DOWN }, /* á»´ */ + { 0x1EF5, AF_ADJUST_DOWN }, /* ỵ */ + { 0x1EF6, AF_ADJUST_UP }, /* á»¶ */ + { 0x1EF7, AF_ADJUST_UP }, /* á»· */ + { 0x1EF8, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* Ỹ */ + { 0x1EF9, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* ỹ */ + + /* Greek Extended */ + { 0x1F00, AF_ADJUST_UP }, /* á¼€ */ + { 0x1F01, AF_ADJUST_UP }, /* á¼ */ + { 0x1F02, AF_ADJUST_UP }, /* ἂ */ + { 0x1F03, AF_ADJUST_UP }, /* ἃ */ + { 0x1F04, AF_ADJUST_UP }, /* ἄ */ + { 0x1F05, AF_ADJUST_UP }, /* á¼… */ + { 0x1F06, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* ἆ */ + { 0x1F07, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* ἇ */ + + { 0x1F10, AF_ADJUST_UP }, /* á¼ */ + { 0x1F11, AF_ADJUST_UP }, /* ἑ */ + { 0x1F12, AF_ADJUST_UP }, /* á¼’ */ + { 0x1F13, AF_ADJUST_UP }, /* ἓ */ + { 0x1F14, AF_ADJUST_UP }, /* á¼” */ + { 0x1F15, AF_ADJUST_UP }, /* ἕ */ + + { 0x1F20, AF_ADJUST_UP }, /* á¼  */ + { 0x1F21, AF_ADJUST_UP }, /* ἡ */ + { 0x1F22, AF_ADJUST_UP }, /* á¼¢ */ + { 0x1F23, AF_ADJUST_UP }, /* á¼£ */ + { 0x1F24, AF_ADJUST_UP }, /* ἤ */ + { 0x1F25, AF_ADJUST_UP }, /* á¼¥ */ + { 0x1F26, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* ἦ */ + { 0x1F27, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á¼§ */ + + { 0x1F30, AF_ADJUST_UP }, /* á¼° */ + { 0x1F31, AF_ADJUST_UP }, /* á¼± */ + { 0x1F32, AF_ADJUST_UP }, /* á¼² */ + { 0x1F33, AF_ADJUST_UP }, /* á¼³ */ + { 0x1F34, AF_ADJUST_UP }, /* á¼´ */ + { 0x1F35, AF_ADJUST_UP }, /* á¼µ */ + { 0x1F36, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á¼¶ */ + { 0x1F37, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á¼· */ + + { 0x1F40, AF_ADJUST_UP }, /* á½€ */ + { 0x1F41, AF_ADJUST_UP }, /* á½ */ + { 0x1F42, AF_ADJUST_UP }, /* ὂ */ + { 0x1F43, AF_ADJUST_UP }, /* ὃ */ + { 0x1F44, AF_ADJUST_UP }, /* ὄ */ + { 0x1F45, AF_ADJUST_UP }, /* á½… */ + + { 0x1F50, AF_ADJUST_UP }, /* á½ */ + { 0x1F51, AF_ADJUST_UP }, /* ὑ */ + { 0x1F52, AF_ADJUST_UP }, /* á½’ */ + { 0x1F53, AF_ADJUST_UP }, /* ὓ */ + { 0x1F54, AF_ADJUST_UP }, /* á½” */ + { 0x1F55, AF_ADJUST_UP }, /* ὕ */ + { 0x1F56, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á½– */ + { 0x1F57, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á½— */ + + { 0x1F60, AF_ADJUST_UP }, /* á½  */ + { 0x1F61, AF_ADJUST_UP }, /* ὡ */ + { 0x1F62, AF_ADJUST_UP }, /* á½¢ */ + { 0x1F63, AF_ADJUST_UP }, /* á½£ */ + { 0x1F64, AF_ADJUST_UP }, /* ὤ */ + { 0x1F65, AF_ADJUST_UP }, /* á½¥ */ + { 0x1F66, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* ὦ */ + { 0x1F67, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á½§ */ + + { 0x1F70, AF_ADJUST_UP }, /* á½° */ + { 0x1F71, AF_ADJUST_UP }, /* á½± */ + { 0x1F72, AF_ADJUST_UP }, /* á½² */ + { 0x1F73, AF_ADJUST_UP }, /* á½³ */ + { 0x1F74, AF_ADJUST_UP }, /* á½´ */ + { 0x1F75, AF_ADJUST_UP }, /* á½µ */ + { 0x1F76, AF_ADJUST_UP }, /* á½¶ */ + { 0x1F77, AF_ADJUST_UP }, /* á½· */ + { 0x1F78, AF_ADJUST_UP }, /* ὸ */ + { 0x1F79, AF_ADJUST_UP }, /* á½¹ */ + { 0x1F7A, AF_ADJUST_UP }, /* ὺ */ + { 0x1F7B, AF_ADJUST_UP }, /* á½» */ + { 0x1F7C, AF_ADJUST_UP }, /* á½¼ */ + { 0x1F7D, AF_ADJUST_UP }, /* á½½ */ + + { 0x1F80, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾€ */ + { 0x1F81, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾ */ + { 0x1F82, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾂ */ + { 0x1F83, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾃ */ + { 0x1F84, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾄ */ + { 0x1F85, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾… */ + { 0x1F86, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* ᾆ */ + { 0x1F87, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* ᾇ */ + { 0x1F88, AF_ADJUST_DOWN }, /* ᾈ */ + { 0x1F89, AF_ADJUST_DOWN }, /* ᾉ */ + { 0x1F8A, AF_ADJUST_DOWN }, /* ᾊ */ + { 0x1F8B, AF_ADJUST_DOWN }, /* ᾋ */ + { 0x1F8C, AF_ADJUST_DOWN }, /* ᾌ */ + { 0x1F8D, AF_ADJUST_DOWN }, /* á¾ */ + { 0x1F8E, AF_ADJUST_DOWN }, /* ᾎ */ + { 0x1F8F, AF_ADJUST_DOWN }, /* á¾ */ + + { 0x1F90, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾ */ + { 0x1F91, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾑ */ + { 0x1F92, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾’ */ + { 0x1F93, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾓ */ + { 0x1F94, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾” */ + { 0x1F95, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾕ */ + { 0x1F96, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* á¾– */ + { 0x1F97, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* á¾— */ + { 0x1F98, AF_ADJUST_DOWN }, /* ᾘ */ + { 0x1F99, AF_ADJUST_DOWN }, /* á¾™ */ + { 0x1F9A, AF_ADJUST_DOWN }, /* ᾚ */ + { 0x1F9B, AF_ADJUST_DOWN }, /* á¾› */ + { 0x1F9C, AF_ADJUST_DOWN }, /* ᾜ */ + { 0x1F9D, AF_ADJUST_DOWN }, /* á¾ */ + { 0x1F9E, AF_ADJUST_DOWN }, /* ᾞ */ + { 0x1F9F, AF_ADJUST_DOWN }, /* ᾟ */ + + { 0x1FA0, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾  */ + { 0x1FA1, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾡ */ + { 0x1FA2, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾¢ */ + { 0x1FA3, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾£ */ + { 0x1FA4, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ᾤ */ + { 0x1FA5, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾¥ */ + { 0x1FA6, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* ᾦ */ + { 0x1FA7, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* á¾§ */ + { 0x1FA8, AF_ADJUST_DOWN }, /* ᾨ */ + { 0x1FA9, AF_ADJUST_DOWN }, /* ᾩ */ + { 0x1FAA, AF_ADJUST_DOWN }, /* ᾪ */ + { 0x1FAB, AF_ADJUST_DOWN }, /* ᾫ */ + { 0x1FAC, AF_ADJUST_DOWN }, /* ᾬ */ + { 0x1FAD, AF_ADJUST_DOWN }, /* á¾­ */ + { 0x1FAE, AF_ADJUST_DOWN }, /* á¾® */ + { 0x1FAF, AF_ADJUST_DOWN }, /* ᾯ */ + + { 0x1FB0, AF_ADJUST_UP }, /* á¾° */ + { 0x1FB1, AF_ADJUST_UP }, /* á¾± */ + { 0x1FB2, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾² */ + { 0x1FB3, AF_ADJUST_DOWN }, /* á¾³ */ + { 0x1FB4, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¾´ */ + { 0x1FB6, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* á¾¶ */ + { 0x1FB7, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* á¾· */ + { 0x1FB8, AF_ADJUST_UP }, /* Ᾰ */ + { 0x1FB9, AF_ADJUST_UP }, /* á¾¹ */ + { 0x1FBC, AF_ADJUST_DOWN }, /* á¾¼ */ + + { 0x1FC2, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¿‚ */ + { 0x1FC3, AF_ADJUST_DOWN }, /* ῃ */ + { 0x1FC4, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¿„ */ + { 0x1FC6, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* ῆ */ + { 0x1FC7, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* ῇ */ + { 0x1FCC, AF_ADJUST_DOWN }, /* ῌ */ + + { 0x1FD0, AF_ADJUST_UP }, /* á¿ */ + { 0x1FD1, AF_ADJUST_UP }, /* á¿‘ */ + { 0x1FD2, AF_ADJUST_UP2 }, /* á¿’ */ + { 0x1FD3, AF_ADJUST_UP2 }, /* á¿“ */ + { 0x1FD6, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* á¿– */ + { 0x1FD7, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á¿— */ + { 0x1FD8, AF_ADJUST_UP }, /* Ῐ */ + { 0x1FD9, AF_ADJUST_UP }, /* á¿™ */ + + { 0x1FE0, AF_ADJUST_UP }, /* á¿  */ + { 0x1FE1, AF_ADJUST_UP }, /* á¿¡ */ + { 0x1FE2, AF_ADJUST_UP2 }, /* á¿¢ */ + { 0x1FE3, AF_ADJUST_UP2 }, /* á¿£ */ + { 0x1FE4, AF_ADJUST_UP }, /* ῤ */ + { 0x1FE5, AF_ADJUST_UP }, /* á¿¥ */ + { 0x1FE6, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* ῦ */ + { 0x1FE7, AF_ADJUST_UP2 | AF_ADJUST_TILDE_TOP }, /* á¿§ */ + { 0x1FE8, AF_ADJUST_UP }, /* Ῠ */ + { 0x1FE9, AF_ADJUST_UP }, /* á¿© */ + { 0x1FF2, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* ῲ */ + { 0x1FF3, AF_ADJUST_DOWN }, /* ῳ */ + { 0x1FF4, AF_ADJUST_UP | AF_ADJUST_DOWN }, /* á¿´ */ + { 0x1FF6, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP }, /* á¿¶ */ + { 0x1FF7, AF_ADJUST_UP | AF_ADJUST_TILDE_TOP | AF_ADJUST_DOWN }, /* á¿· */ + { 0x1FFC, AF_ADJUST_DOWN }, /* ῼ */ + + /* General Punctuation */ + { 0x203C, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ‼ */ + { 0x203D, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ‽ */ + + { 0x2047, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ⇠*/ + { 0x2048, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ∠*/ + { 0x2049, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ≠*/ + + /* Superscripts and Subscripts */ + { 0x2071, AF_ADJUST_UP }, /* â± */ + + /* Currency Symbols */ + { 0x20AB, AF_ADJUST_DOWN }, /* â‚« */ + + { 0x20C0, AF_ADJUST_DOWN }, /* ⃀ */ + + /* Number Forms */ + { 0x2170, AF_ADJUST_UP }, /* â…° */ + { 0x2171, AF_ADJUST_UP }, /* â…± */ + { 0x2172, AF_ADJUST_UP }, /* â…² */ + { 0x2173, AF_ADJUST_UP }, /* â…³ */ + { 0x2175, AF_ADJUST_UP }, /* â…µ */ + { 0x2176, AF_ADJUST_UP }, /* â…¶ */ + { 0x2177, AF_ADJUST_UP }, /* â…· */ + { 0x2178, AF_ADJUST_UP }, /* â…¸ */ + { 0x217A, AF_ADJUST_UP }, /* â…º */ + { 0x217B, AF_ADJUST_UP }, /* â…» */ + + /* Latin Extended-C */ + { 0x2C64, AF_IGNORE_CAPITAL_BOTTOM } , /* Ɽ */ + { 0x2C67, AF_IGNORE_CAPITAL_BOTTOM } , /* â±§ */ + { 0x2C68, AF_IGNORE_SMALL_BOTTOM } , /* ⱨ */ + { 0x2C69, AF_IGNORE_CAPITAL_BOTTOM } , /* Ⱪ */ + { 0x2C6A, AF_IGNORE_SMALL_BOTTOM } , /* ⱪ */ + { 0x2C6B, AF_IGNORE_CAPITAL_BOTTOM } , /* Ⱬ */ + { 0x2C6C, AF_IGNORE_SMALL_BOTTOM } , /* ⱬ */ + { 0x2C6E, AF_IGNORE_CAPITAL_BOTTOM } , /* â±® */ + + { 0x2C7C, AF_ADJUST_UP }, /* â±¼ */ + { 0x2C7E, AF_IGNORE_CAPITAL_BOTTOM } , /* â±¾ */ + { 0x2C7F, AF_IGNORE_CAPITAL_BOTTOM } , /* Ɀ */ + + /* Coptic */ + { 0x2CC2, AF_ADJUST_UP }, /* Ⳃ */ + { 0x2CC3, AF_ADJUST_UP }, /* ⳃ */ + + /* Supplemental Punctuation */ + { 0x2E18, AF_ADJUST_UP }, /* ⸘ */ + + { 0x2E2E, AF_ADJUST_UP | AF_ADJUST_NO_HEIGHT_CHECK }, /* ⸮ */ + + /* Cyrillic Extended-B */ + { 0xA640, AF_IGNORE_CAPITAL_BOTTOM } , /* Ꙁ */ + { 0xA641, AF_IGNORE_SMALL_BOTTOM } , /* ê™ */ + { 0xA642, AF_IGNORE_CAPITAL_BOTTOM } , /* Ꙃ */ + { 0xA643, AF_IGNORE_SMALL_BOTTOM } , /* ꙃ */ + + { 0xA680, AF_IGNORE_CAPITAL_TOP } , /* Ꚁ */ + { 0xA681, AF_IGNORE_SMALL_TOP } , /* êš */ + { 0xA688, AF_IGNORE_CAPITAL_BOTTOM } , /* Ꚉ */ + { 0xA689, AF_IGNORE_SMALL_BOTTOM } , /* ꚉ */ + { 0xA68A, AF_IGNORE_CAPITAL_BOTTOM } , /* Ꚋ */ + { 0xA68B, AF_IGNORE_SMALL_BOTTOM } , /* êš‹ */ + { 0xA68E, AF_IGNORE_CAPITAL_BOTTOM } , /* Ꚏ */ + { 0xA68F, AF_IGNORE_SMALL_BOTTOM } , /* êš */ + + { 0xA690, AF_IGNORE_CAPITAL_BOTTOM } , /* êš */ + { 0xA691, AF_IGNORE_SMALL_BOTTOM } , /* êš‘ */ + { 0xA696, AF_IGNORE_CAPITAL_BOTTOM } , /* êš– */ + { 0xA697, AF_IGNORE_SMALL_BOTTOM } , /* êš— */ + + /* Latin Extended-D */ + { 0xA726, AF_IGNORE_CAPITAL_BOTTOM } , /* Ꜧ */ + { 0xA727, AF_IGNORE_SMALL_BOTTOM } , /* ꜧ */ + + { 0xA756, AF_IGNORE_CAPITAL_BOTTOM } , /* ê– */ + { 0xA758, AF_IGNORE_CAPITAL_BOTTOM } , /* ê˜ */ + + { 0xA771, AF_IGNORE_SMALL_BOTTOM } , /* ê± */ + { 0xA772, AF_IGNORE_SMALL_BOTTOM } , /* ê² */ + { 0xA773, AF_IGNORE_SMALL_BOTTOM } , /* ê³ */ + { 0xA774, AF_IGNORE_SMALL_BOTTOM } , /* ê´ */ + { 0xA776, AF_IGNORE_SMALL_BOTTOM } , /* ê¶ */ + + { 0xA790, AF_IGNORE_CAPITAL_BOTTOM } , /* êž */ + { 0xA791, AF_IGNORE_SMALL_BOTTOM } , /* êž‘ */ + { 0xA794, AF_IGNORE_SMALL_BOTTOM } , /* êž” */ + { 0xA795, AF_IGNORE_SMALL_BOTTOM } , /* êž• */ + + { 0xA7C0, AF_IGNORE_CAPITAL_TOP | AF_IGNORE_CAPITAL_BOTTOM }, /* Ꟁ */ + { 0xA7C1, AF_IGNORE_SMALL_TOP | AF_IGNORE_SMALL_BOTTOM }, /* êŸ */ + { 0xA7C4, AF_IGNORE_CAPITAL_BOTTOM } , /* Ꞔ */ + { 0xA7C5, AF_IGNORE_CAPITAL_BOTTOM } , /* Ʂ */ + { 0xA7C6, AF_IGNORE_CAPITAL_BOTTOM } , /* Ᶎ */ + { 0xA7CC, AF_IGNORE_CAPITAL_TOP | AF_IGNORE_CAPITAL_BOTTOM }, /* Ꟍ */ + { 0xA7CD, AF_IGNORE_SMALL_TOP | AF_IGNORE_SMALL_BOTTOM }, /* êŸ */ + + /* Latin Extended-E */ + { 0xAB3C, AF_IGNORE_SMALL_BOTTOM } , /* ꬼ */ + + { 0xAB46, AF_IGNORE_SMALL_BOTTOM } , /* ê­† */ + + { 0xAB5C, AF_IGNORE_SMALL_BOTTOM } , /* ê­œ */ + + { 0xAB66, AF_IGNORE_SMALL_BOTTOM } , /* ê­¦ */ + { 0xAB67, AF_IGNORE_SMALL_BOTTOM } , /* ê­§ */ + }; + + + FT_LOCAL_DEF( FT_UInt32 ) + af_adjustment_database_lookup( FT_UInt32 codepoint ) + { + /* Binary search for database entry */ + FT_Offset low = 0; + FT_Offset high = AF_ADJUSTMENT_DATABASE_LENGTH - 1; + + + while ( high >= low ) + { + FT_Offset mid = ( low + high ) / 2; + FT_UInt32 mid_codepoint = adjustment_database[mid].codepoint; + + + if ( mid_codepoint < codepoint ) + low = mid + 1; + else if ( mid_codepoint > codepoint ) + high = mid - 1; + else + return adjustment_database[mid].flags; + } + + return 0; + } + + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + + static FT_Error + add_substitute( FT_Int glyph_idx, + size_t value, + FT_UInt32 codepoint, + FT_Hash reverse_map, + FT_Hash subst_map, + FT_Memory memory ) + { + FT_Error error; + + FT_Int first_substitute = (FT_Int)( value & 0xFFFF ); + + FT_UInt used = reverse_map->used; + + + /* + OpenType features like 'unic' map lowercase letter glyphs to uppercase + forms (and vice versa), which could lead to the use of wrong entries + in the adjustment database. For this reason we don't overwrite, + prioritizing cmap entries. + + XXX Note, however, that this cannot cover all cases since there might + be contradictory entries for glyphs not in the cmap. A possible + solution might be to specially mark pairs of related lowercase and + uppercase characters in the adjustment database that have diacritics + on different vertical sides (for example, U+0122 'Ä¢' and U+0123 'Ä£'). + The auto-hinter could then perform a topological analysis to do the + right thing. + */ + error = ft_hash_num_insert_no_overwrite( first_substitute, codepoint, + reverse_map, memory ); + if ( error ) + return error; + + if ( reverse_map->used > used ) + { + size_t* subst = ft_hash_num_lookup( first_substitute, subst_map ); + + + if ( subst ) + { + error = add_substitute( first_substitute, *subst, codepoint, + reverse_map, subst_map, memory ); + if ( error ) + return error; + } + } + + /* The remaining substitutes. */ + if ( value & 0xFFFF0000U ) + { + FT_UInt num_substitutes = value >> 16; + + FT_UInt i; + + + for ( i = 1; i <= num_substitutes; i++ ) + { + FT_Int idx = glyph_idx + (FT_Int)( i << 16 ); + size_t* substitute = ft_hash_num_lookup( idx, subst_map ); + + + used = reverse_map->used; + + error = ft_hash_num_insert_no_overwrite( *substitute, + codepoint, + reverse_map, + memory ); + if ( error ) + return error; + + if ( reverse_map->used > used ) + { + size_t* subst = ft_hash_num_lookup( *substitute, subst_map ); + + + if ( subst ) + { + error = add_substitute( *substitute, *subst, codepoint, + reverse_map, subst_map, memory ); + if ( error ) + return error; + } + } + } + } + + return FT_Err_Ok; + } + +#endif /* FT_CONFIG_OPTION_USE_HARFBUZZ */ + + + /* Construct a 'reverse cmap' (i.e., a mapping from glyph indices to */ + /* character codes) for all glyphs that an input code point could turn */ + /* into. */ + /* */ + /* If HarfBuzz support is not available, this is the direct inversion */ + /* of the cmap table, otherwise the mapping gets extended with data */ + /* from the 'GSUB' table. */ + FT_LOCAL_DEF( FT_Error ) + af_reverse_character_map_new( FT_Hash *map, + AF_StyleMetrics metrics ) + { + FT_Error error; + + AF_FaceGlobals globals = metrics->globals; + FT_Face face = globals->face; + FT_Memory memory = face->memory; + + FT_CharMap old_charmap; + + FT_UInt32 codepoint; + FT_Offset i; + + + FT_TRACE4(( "af_reverse_character_map_new:" + " building reverse character map (style `%s')\n", + af_style_names[metrics->style_class->style] )); + + /* Search for a unicode charmap. */ + /* If there isn't one, create a blank map. */ + + /* Back up `face->charmap` because `find_unicode_charmap` sets it. */ + old_charmap = face->charmap; + + if ( ( error = find_unicode_charmap( face ) ) ) + goto Exit; + + *map = NULL; + if ( FT_QNEW( *map ) ) + goto Exit; + + error = ft_hash_num_init( *map, memory ); + if ( error ) + goto Exit; + + /* Initialize reverse cmap with data directly from the cmap table. */ + for ( i = 0; i < AF_ADJUSTMENT_DATABASE_LENGTH; i++ ) + { + FT_Int cmap_glyph; + + + /* + We cannot restrict `codepoint` to character ranges; we have no + control what data the script-specific portion of the GSUB table + actually holds. + + An example is `arial.ttf` version 7.00; in this font, there are + lookups for Cyrillic (lookup 43), Greek (lookup 44), and Latin + (lookup 45) that map capital letter glyphs to small capital glyphs. + It is tempting to expect that script-specific versions of the 'c2sc' + feature only use script-specific lookups. However, this is not the + case in this font: the feature uses all three lookups regardless of + the script. + + The auto-hinter, while assigning glyphs to styles, uses the first + coverage result it encounters for a particular glyph. For example, + if the coverage for Cyrillic is tested before Latin (as is currently + the case), glyphs without a cmap entry that are covered in 'c2sc' + are treated as Cyrillic. + + If we now look at glyph 3498, which is a small-caps version of the + Latin character 'A grave' (U+00C0, glyph 172), we can see that it is + registered as belonging to a Cyrillic style due to the algorithm + just described. As a result, checking only for characters from the + Latin range would miss this glyph; we thus have to test all + character codes in the database. + */ + codepoint = adjustment_database[i].codepoint; + + cmap_glyph = (FT_Int)FT_Get_Char_Index( face, codepoint ); + if ( cmap_glyph == 0 ) + continue; + + error = ft_hash_num_insert( cmap_glyph, codepoint, *map, memory ); + if ( error ) + goto Exit; + } + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + + if ( ft_hb_enabled( globals ) ) + { + hb_font_t *hb_font; + hb_face_t *hb_face; + + hb_set_t *gsub_lookups; + hb_script_t script; + + unsigned int script_count = 1; + hb_tag_t script_tags[2] = { HB_TAG_NONE, HB_TAG_NONE }; + + FT_Hash subst_map = NULL; + + hb_codepoint_t idx; + FT_UInt hash_idx; + FT_Int glyph_idx; + size_t value; + + + /* No need to check whether HarfBuzz has allocation issues; */ + /* it continues to work in such cases and simply returns */ + /* 'empty' objects that do nothing. */ + + hb_font = globals->hb_font; + hb_face = hb( font_get_face )( hb_font ); + + gsub_lookups = hb( set_create )(); + + script = af_hb_scripts[metrics->style_class->script]; + + hb( ot_tags_from_script_and_language )( script, NULL, + &script_count, script_tags, + NULL, NULL ); + + /* Compute set of all script-specific GSUB lookups. */ + hb( ot_layout_collect_lookups )( hb_face, + HB_OT_TAG_GSUB, + script_tags, NULL, NULL, + gsub_lookups ); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Bool have_idx = FALSE; + + + FT_TRACE4(( " GSUB lookups to check:\n" )); + + FT_TRACE4(( " " )); + idx = HB_SET_VALUE_INVALID; + while ( hb( set_next )( gsub_lookups, &idx ) ) + if ( globals->gsub_lookups_single_alternate[idx] ) + { + have_idx = TRUE; + FT_TRACE4(( " %u", idx )); + } + if ( !have_idx ) + FT_TRACE4(( " (none)" )); + FT_TRACE4(( "\n" )); + + FT_TRACE4(( "\n" )); + } +#endif + + if ( FT_QNEW( subst_map ) ) + goto Exit_HarfBuzz; + + error = ft_hash_num_init( subst_map, memory ); + if ( error ) + goto Exit_HarfBuzz; + + idx = HB_SET_VALUE_INVALID; + while ( hb( set_next )( gsub_lookups, &idx ) ) + { + FT_UInt32 offset = globals->gsub_lookups_single_alternate[idx]; + + + /* Put all substitutions into a single hash table. Note that */ + /* the hash values usually contain more than a single character */ + /* code; this can happen if different 'SingleSubst' subtables */ + /* map a given glyph index to different substitutions, or if */ + /* 'AlternateSubst' subtable entries are present. */ + if ( offset ) + af_map_lookup( globals, subst_map, offset ); + } + + /* + Now iterate over the collected substitution data in `subst_map` + (using recursion to resolve one-to-many mappings) and insert the + data into the reverse cmap. + + As an example, suppose we have the following cmap and substitution + data: + + cmap: X -> a + Y -> b + Z -> c + + substitutions: a -> b + b -> c, d + d -> e + + The reverse map now becomes as follows. + + a -> X + b -> Y + c -> Z (via cmap, ignoring mapping from 'b') + d -> Y (via 'b') + e -> Y (via 'b' and 'd') + */ + + hash_idx = 0; + while ( ft_hash_num_iterator( &hash_idx, + &glyph_idx, + &value, + subst_map ) ) + { + size_t* val; + + + /* Ignore keys that do not point to the first substitute. */ + if ( (FT_UInt)glyph_idx & 0xFFFF0000U ) + continue; + + /* Ignore glyph indices that are not related to accents. */ + val = ft_hash_num_lookup( glyph_idx, *map ); + if ( !val ) + continue; + + codepoint = *val; + + error = add_substitute( glyph_idx, value, codepoint, + *map, subst_map, memory ); + if ( error ) + break; + } + + Exit_HarfBuzz: + hb( set_destroy )( gsub_lookups ); + + ft_hash_num_free( subst_map, memory ); + FT_FREE( subst_map ); + + if ( error ) + goto Exit; + } + +#endif /* FT_CONFIG_OPTION_USE_HARFBUZZ */ + + FT_TRACE4(( " reverse character map built successfully" + " with %u entries\n", ( *map )->used )); + +#ifdef FT_DEBUG_LEVEL_TRACE + + { + FT_UInt cnt; + + + FT_TRACE7(( " gidx code flags\n" )); + /* " XXXXX 0xXXXX XXXXXXXXXXX..." */ + FT_TRACE7(( " ------------------------------\n" )); + + for ( cnt = 0; cnt < globals->glyph_count; cnt++ ) + { + size_t* val; + FT_UInt32 adj_type; + + const char* flag_names[] = + { + "up", /* AF_ADJUST_UP */ + "down", /* AF_ADJUST_DOWN */ + "double up", /* AF_ADJUST_UP2 */ + "double down", /* AF_ADJUST_DOWN2 */ + + "top tilde", /* AF_ADJUST_TILDE_TOP */ + "bottom tilde", /* AF_ADJUST_TILDE_BOTTOM */ + "below-top tilde", /* AF_ADJUST_TILDE_TOP2 */ + "above-bottom tilde", /* AF_ADJUST_TILDE_BOTTOM2 */ + + "ignore capital top", /* AF_IGNORE_CAPITAL_TOP */ + "ignore capital bottom", /* AF_IGNORE_CAPITAL_BOTTOM */ + "ignore small top", /* AF_IGNORE_SMALL_TOP */ + "ignore small bottom", /* AF_IGNORE_SMALL_BOTTOM */ + }; + size_t flag_names_size = sizeof ( flag_names ) / sizeof ( char* ); + + char flag_str[256]; + int need_comma; + + size_t j; + + + val = ft_hash_num_lookup( (FT_Int)cnt, *map ); + if ( !val ) + continue; + codepoint = *val; + + adj_type = af_adjustment_database_lookup( codepoint ); + if ( !adj_type ) + continue; + + flag_str[0] = '\0'; + need_comma = 0; + + for ( j = 0; j < flag_names_size; j++ ) + { + if ( adj_type & (1 << j ) ) + { + if ( !need_comma ) + need_comma = 1; + else + strcat( flag_str, ", " ); + strcat( flag_str, flag_names[j] ); + } + } + + FT_TRACE7(( " %5u 0x%04X %s\n", cnt, codepoint, flag_str )); + } + } + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + + Exit: + face->charmap = old_charmap; + + if ( error ) + { + FT_TRACE4(( " error while building reverse character map." + " Using blank map.\n" )); + + if ( *map ) + ft_hash_num_free( *map, memory ); + + FT_FREE( *map ); + *map = NULL; + return error; + } + + return FT_Err_Ok; + } + + + FT_LOCAL_DEF( FT_Error ) + af_reverse_character_map_done( FT_Hash map, + FT_Memory memory ) + { + if ( map ) + ft_hash_num_free( map, memory ); + FT_FREE( map ); + + return FT_Err_Ok; + } + + +/* END */ diff --git a/modules/freetype2/src/autofit/afadjust.h b/modules/freetype2/src/autofit/afadjust.h @@ -0,0 +1,130 @@ +/**************************************************************************** + * + * afadjust.h + * + * Auto-fitter routines to adjust components based on charcode (header). + * + * Copyright (C) 2023-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Written by Craig White <gerzytet@gmail.com>. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.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 AFADJUST_H_ +#define AFADJUST_H_ + +#include <freetype/fttypes.h> + +#include "afglobal.h" +#include "aftypes.h" + + +FT_BEGIN_HEADER + + /* + * Adjustment type flags. + * + * They also specify topological constraints that the auto-hinter relies + * on. For example, using `AF_ADJUST_UP` implies that we have two + * enclosing contours, one for the base glyph and one for the diacritic + * above, and no other contour inbetween or above. With 'enclosing' it is + * meant that such a contour can contain more inner contours. + * + */ + + /* Find the topmost contour and push it up until its lowest point is */ + /* one pixel above the highest point not enclosed by that contour. */ +#define AF_ADJUST_UP 0x01 + + /* Find the bottommost contour and push it down until its highest point */ + /* is one pixel below the lowest point not enclosed by that contour. */ +#define AF_ADJUST_DOWN 0x02 + + /* Find the contour below the topmost contour and push it up, together */ + /* with the topmost contour, until its lowest point is one pixel above */ + /* the highest point not enclosed by that contour. This flag is */ + /* mutually exclusive with `AF_ADJUST_UP`. */ +#define AF_ADJUST_UP2 0x04 + + /* Find the contour above the bottommost contour and push it down, */ + /* together with the bottommost contour, until its highest point is */ + /* one pixel below the lowest point not enclosed by that contour. */ + /* This flag is mutually exclusive with `AF_ADJUST_DOWN`. */ +#define AF_ADJUST_DOWN2 0x08 + + /* The topmost contour is a tilde. Enlarge it vertically so that it */ + /* stays legible at small sizes, not degenerating to a horizontal line. */ +#define AF_ADJUST_TILDE_TOP 0x10 + + /* The bottommost contour is a tilde. Enlarge it vertically so that it */ + /* stays legible at small sizes, not degenerating to a horizontal line. */ +#define AF_ADJUST_TILDE_BOTTOM 0x20 + + /* The contour below the topmost contour is a tilde. Enlarge it */ + /* vertically so that it stays legible at small sizes, not degenerating */ + /* to a horizontal line. To be used with `AF_ADJUST_UP2` only. */ +#define AF_ADJUST_TILDE_TOP2 0x40 + + /* The contour above the bottommost contour is a tilde. Enlarge it */ + /* vertically so that it stays legible at small sizes, not degenerating */ + /* to a horizontal line. To be used with `AF_ADJUST_DOWN2` only. */ +#define AF_ADJUST_TILDE_BOTTOM2 0x80 + + /* Make the auto-hinter ignore any diacritic (either a separate contour */ + /* or part of the base character outline) that is attached to the top */ + /* of an uppercase base character. */ +#define AF_IGNORE_CAPITAL_TOP 0x100 + + /* Make the auto-hinter ignore any diacritic (either a separate contour */ + /* or part of the base character outline) that is attached to the */ + /* bottom of an uppercase base character. */ +#define AF_IGNORE_CAPITAL_BOTTOM 0x200 + + /* Make the auto-hinter ignore any diacritic (either a separate contour */ + /* or part of the base character outline) that is attached to the top */ + /* of a lowercase base character. */ +#define AF_IGNORE_SMALL_TOP 0x400 + + /* Make the auto-hinter ignore any diacritic (either a separate contour */ + /* or part of the base character outline) that is attached to the */ + /* bottom of a lowercase base character. */ +#define AF_IGNORE_SMALL_BOTTOM 0x800 + + /* By default, the AF_ADJUST_XXX flags are applied only if diacritics */ + /* have a 'small' height (based on some heuristic checks). If this */ + /* flag is set, no such check is performed. */ +#define AF_ADJUST_NO_HEIGHT_CHECK 0x1000 + + /* No adjustment, i.e., no flag is set. */ +#define AF_ADJUST_NONE 0x00 + + + FT_LOCAL( FT_UInt32 ) + af_adjustment_database_lookup( FT_UInt32 codepoint ); + + /* Allocate and populate the reverse character map, */ + /* using the character map within the face. */ + FT_LOCAL( FT_Error ) + af_reverse_character_map_new( FT_Hash *map, + AF_StyleMetrics metrics ); + + /* Free the reverse character map. */ + FT_LOCAL( FT_Error ) + af_reverse_character_map_done( FT_Hash map, + FT_Memory memory ); + + +FT_END_HEADER + +#endif /* AFADJUST_H_ */ + + +/* END */ diff --git a/modules/freetype2/src/autofit/afblue.c b/modules/freetype2/src/autofit/afblue.c @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -467,24 +467,24 @@ af_blue_stringsets[] = { /* */ - { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, { AF_BLUE_STRING_ADLAM_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_ARABIC_BOTTOM, 0 }, { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM, 0 }, - { AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, + { AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_ARMENIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_AVESTAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_AVESTAN_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -508,14 +508,14 @@ { AF_BLUE_STRING_CHAKMA_BOTTOM, 0 }, { AF_BLUE_STRING_CHAKMA_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }, { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CARIAN_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -527,24 +527,24 @@ { AF_BLUE_STRING_CHEROKEE_SMALL, 0 }, { AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_COPTIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_COPTIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, { AF_BLUE_STRING_COPTIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_COPTIC_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_COPTIC_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CYPRIOT_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CYPRIOT_BOTTOM, 0 }, { AF_BLUE_STRING_CYPRIOT_SMALL, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CYPRIOT_SMALL, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, { AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_CYRILLIC_SMALL, 0 }, - { AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_CYRILLIC_SMALL, 0 }, + { AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_DEVANAGARI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_DEVANAGARI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_DEVANAGARI_BASE, AF_BLUE_PROPERTY_LATIN_TOP | @@ -553,12 +553,12 @@ { AF_BLUE_STRING_DEVANAGARI_BASE, 0 }, { AF_BLUE_STRING_DEVANAGARI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, { AF_BLUE_STRING_DESERET_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_ETHIOPIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -578,23 +578,23 @@ { AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, { AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_GOTHIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GOTHIC_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 }, - { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, + { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GREEK_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_GREEK_SMALL, 0 }, - { AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_GREEK_SMALL, 0 }, + { AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_GUJARATI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_GUJARATI_BOTTOM, 0 }, @@ -643,45 +643,45 @@ { AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_LAO_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 }, - { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, + { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_LATIN_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 }, - { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 }, - { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 }, - { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 }, - { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_LISU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_LISU_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, 0 }, - { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -691,12 +691,12 @@ { AF_BLUE_STRING_MYANMAR_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_NKO_BOTTOM, 0 }, + { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_NKO_BOTTOM, 0 }, { AF_BLUE_STRING_NKO_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_NKO_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_NKO_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_OL_CHIKI, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_OL_CHIKI, 0 }, @@ -704,15 +704,15 @@ { AF_BLUE_STRING_OLD_TURKIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_OLD_TURKIC_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_OSAGE_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM, 0 }, - { AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER, 0 }, - { AF_BLUE_STRING_OSAGE_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_OSAGE_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_OSAGE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_OSAGE_SMALL_DESCENDER, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_OSAGE_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM }, + { AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER, 0 }, + { AF_BLUE_STRING_OSAGE_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_OSAGE_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_OSAGE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OSAGE_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_OSMANYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_OSMANYA_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -723,13 +723,13 @@ { AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_SHAVIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_SHAVIAN_BOTTOM, 0 }, - { AF_BLUE_STRING_SHAVIAN_DESCENDER, 0 }, + { AF_BLUE_STRING_SHAVIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_SHAVIAN_BOTTOM, 0 }, + { AF_BLUE_STRING_SHAVIAN_DESCENDER, 0 }, { AF_BLUE_STRING_SHAVIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_SINHALA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_SINHALA_BOTTOM, 0 }, { AF_BLUE_STRING_SINHALA_DESCENDER, 0 }, diff --git a/modules/freetype2/src/autofit/afblue.cin b/modules/freetype2/src/autofit/afblue.cin @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afblue.dat b/modules/freetype2/src/autofit/afblue.dat @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright (C) 2013-2024 by +// Copyright (C) 2013-2025 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, @@ -699,12 +699,12 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: AF_BLUE_STRINGSET_ADLM - { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } { AF_BLUE_STRING_ADLAM_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_ARAB { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -713,14 +713,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_ARMN - { AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM, 0 } - { AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } + { AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_ARMENIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_AVST { AF_BLUE_STRING_AVESTAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -756,14 +756,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_CANS - { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 } { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_CARI { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -781,12 +781,12 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_COPT - { AF_BLUE_STRING_COPTIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_COPTIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } { AF_BLUE_STRING_COPTIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_COPTIC_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_COPTIC_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_CPRT { AF_BLUE_STRING_CYPRIOT_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -796,13 +796,13 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_CYRL - { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } { AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_CYRILLIC_SMALL, 0 } - { AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_CYRILLIC_SMALL, 0 } + { AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_DEVA { AF_BLUE_STRING_DEVANAGARI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -815,12 +815,12 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_DSRT - { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } { AF_BLUE_STRING_DESERET_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_ETHI { AF_BLUE_STRING_ETHIOPIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -848,12 +848,12 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_GLAG - { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } { AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_GOTH { AF_BLUE_STRING_GOTHIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -861,14 +861,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_GREK - { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 } - { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } + { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_GREEK_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_GREEK_SMALL, 0 } - { AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_GREEK_SMALL, 0 } + { AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_GUJR { AF_BLUE_STRING_GUJARATI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | @@ -935,34 +935,34 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_LATN - { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 } - { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } + { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_LATIN_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_LATB - { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 } - { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } + { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 } - { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 } + { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_LATP - { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 } - { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } + { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 } - { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 } + { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_LISU { AF_BLUE_STRING_LISU_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -975,15 +975,15 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_MEDF - { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, 0 } - { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_MONG { AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP } @@ -999,12 +999,12 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_NKOO - { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_NKO_BOTTOM, 0 } + { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_NKO_BOTTOM, 0 } { AF_BLUE_STRING_NKO_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_NKO_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_NKO_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_NONE { AF_BLUE_STRING_MAX, 0 } @@ -1020,15 +1020,15 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_OSGE - { AF_BLUE_STRING_OSAGE_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM, 0 } - { AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER, 0 } - { AF_BLUE_STRING_OSAGE_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_OSAGE_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_OSAGE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_OSAGE_SMALL_DESCENDER, 0 } - { AF_BLUE_STRING_MAX, 0 } + { AF_BLUE_STRING_OSAGE_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM, AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM } + { AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER, 0 } + { AF_BLUE_STRING_OSAGE_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_OSAGE_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_OSAGE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OSAGE_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_OSMA { AF_BLUE_STRING_OSMANYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -1047,13 +1047,13 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_SHAW - { AF_BLUE_STRING_SHAVIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_SHAVIAN_BOTTOM, 0 } - { AF_BLUE_STRING_SHAVIAN_DESCENDER, 0 } + { AF_BLUE_STRING_SHAVIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_SHAVIAN_BOTTOM, 0 } + { AF_BLUE_STRING_SHAVIAN_DESCENDER, 0 } { AF_BLUE_STRING_SHAVIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM, AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_SINH { AF_BLUE_STRING_SINHALA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } diff --git a/modules/freetype2/src/autofit/afblue.h b/modules/freetype2/src/autofit/afblue.h @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -314,14 +314,17 @@ FT_BEGIN_HEADER /* Properties are specific to a writing system. We assume that a given */ /* blue string can't be used in more than a single writing system, which */ /* is a safe bet. */ -#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */ +#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must be value 1 */ #define AF_BLUE_PROPERTY_LATIN_SUB_TOP ( 1U << 1 ) #define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 2 ) #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 3 ) #define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 4 ) -#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */ -#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */ +#define AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM ( 1U << 5 ) +#define AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM ( 1U << 6 ) + +#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must be value 1 */ +#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must be value 2 */ #define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP diff --git a/modules/freetype2/src/autofit/afblue.hin b/modules/freetype2/src/autofit/afblue.hin @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -99,14 +99,17 @@ FT_BEGIN_HEADER /* Properties are specific to a writing system. We assume that a given */ /* blue string can't be used in more than a single writing system, which */ /* is a safe bet. */ -#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */ +#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must be value 1 */ #define AF_BLUE_PROPERTY_LATIN_SUB_TOP ( 1U << 1 ) #define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 2 ) #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 3 ) #define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 4 ) -#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */ -#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */ +#define AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM ( 1U << 5 ) +#define AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM ( 1U << 6 ) + +#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must be value 1 */ +#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must be value 2 */ #define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP diff --git a/modules/freetype2/src/autofit/afcjk.c b/modules/freetype2/src/autofit/afcjk.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (body). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -90,12 +90,8 @@ /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - void* shaper_buf; -#else FT_ULong shaper_buf_; void* shaper_buf = &shaper_buf_; -#endif const char* p; @@ -105,9 +101,8 @@ p = script_class->standard_charstring; -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - shaper_buf = af_shaper_buf_create( face ); -#endif + if ( ft_hb_enabled( metrics->root.globals ) ) + shaper_buf = af_shaper_buf_create( metrics->root.globals ); /* We check a list of standard characters. The first match wins. */ @@ -144,7 +139,7 @@ break; } - af_shaper_buf_destroy( face, shaper_buf ); + af_shaper_buf_destroy( metrics->root.globals, shaper_buf ); if ( !glyph_index ) goto Exit; @@ -152,7 +147,7 @@ if ( !glyph_index ) goto Exit; - FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n", + FT_TRACE5(( "standard character: U+%04lX (glyph index %lu)\n", ch, glyph_index )); error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); @@ -297,12 +292,8 @@ /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - void* shaper_buf; -#else FT_ULong shaper_buf_; void* shaper_buf = &shaper_buf_; -#endif /* we walk over the blue character strings as specified in the */ @@ -313,9 +304,8 @@ FT_TRACE5(( "==========================\n" )); FT_TRACE5(( "\n" )); -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - shaper_buf = af_shaper_buf_create( face ); -#endif + if ( ft_hb_enabled( metrics->root.globals ) ) + shaper_buf = af_shaper_buf_create( metrics->root.globals ); for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { @@ -340,7 +330,7 @@ }; - FT_TRACE5(( "blue zone %d (%s):\n", + FT_TRACE5(( "blue zone %u (%s):\n", axis->blue_count, cjk_blue_name[AF_CJK_IS_HORIZ_BLUE( bs ) | AF_CJK_IS_TOP_BLUE( bs ) ] )); @@ -553,7 +543,7 @@ } /* end for loop */ - af_shaper_buf_destroy( face, shaper_buf ); + af_shaper_buf_destroy( metrics->root.globals, shaper_buf ); FT_TRACE5(( "\n" )); @@ -572,23 +562,20 @@ /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - void* shaper_buf; -#else FT_ULong shaper_buf_; void* shaper_buf = &shaper_buf_; -#endif /* in all supported charmaps, digits have character codes 0x30-0x39 */ const char digits[] = "0 1 2 3 4 5 6 7 8 9"; const char* p; + FT_UNUSED( face ); + p = digits; -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - shaper_buf = af_shaper_buf_create( face ); -#endif + if ( ft_hb_enabled( metrics->root.globals ) ) + shaper_buf = af_shaper_buf_create( metrics->root.globals ); while ( *p ) { @@ -624,7 +611,7 @@ } } - af_shaper_buf_destroy( face, shaper_buf ); + af_shaper_buf_destroy( metrics->root.globals, shaper_buf ); metrics->root.digits_have_same_width = same_width; } @@ -710,7 +697,7 @@ FT_Pos delta1, delta2; - blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); + blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); /* shoot is under shoot for cjk */ delta1 = FT_DivFix( blue->ref.fit, scale ) - blue->shoot.org; @@ -736,7 +723,7 @@ blue->shoot.fit = blue->ref.fit - delta2; - FT_TRACE5(( ">> active cjk blue zone %c%d[%ld/%ld]:\n", + FT_TRACE5(( ">> active cjk blue zone %c%u[%ld/%ld]:\n", ( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V', nn, blue->ref.org, blue->shoot.org )); FT_TRACE5(( " ref: cur=%.2f fit=%.2f\n", @@ -1378,7 +1365,7 @@ } - /* Initalize hinting engine. */ + /* Initialize hinting engine. */ FT_LOCAL_DEF( FT_Error ) af_cjk_hints_init( AF_GlyphHints hints, @@ -2185,7 +2172,7 @@ af_cjk_align_edge_points( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = & hints->axis[dim]; + AF_AxisHints axis = &hints->axis[dim]; AF_Edge edges = axis->edges; AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges ); AF_Edge edge; diff --git a/modules/freetype2/src/autofit/afcjk.h b/modules/freetype2/src/autofit/afcjk.h @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (specification). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afcover.h b/modules/freetype2/src/autofit/afcover.h @@ -4,7 +4,7 @@ * * Auto-fitter coverages (specification only). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afdummy.c b/modules/freetype2/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-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afdummy.h b/modules/freetype2/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-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/aferrors.h b/modules/freetype2/src/autofit/aferrors.h @@ -4,7 +4,7 @@ * * Autofitter error codes (specification only). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afglobal.c b/modules/freetype2/src/autofit/afglobal.c @@ -4,7 +4,7 @@ * * Auto-fitter routines to compute global hinting values (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -22,6 +22,11 @@ #include "afws-decl.h" #include <freetype/internal/ftdebug.h> +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ +# include "afgsub.h" +# include "ft-hb-ft.h" +#endif + /************************************************************************** * @@ -184,7 +189,7 @@ if ( gindex != 0 && gindex < globals->glyph_count && ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = ss; + gstyles[gindex] = ss | AF_HAS_CMAP_ENTRY; for (;;) { @@ -195,7 +200,7 @@ if ( gindex < globals->glyph_count && ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = ss; + gstyles[gindex] = ss | AF_HAS_CMAP_ENTRY; } } @@ -301,7 +306,7 @@ if ( !( count % 10 ) ) FT_TRACE4(( " " )); - FT_TRACE4(( " %d", idx )); + FT_TRACE4(( " %u", idx )); count++; if ( !( count % 10 ) ) @@ -356,8 +361,21 @@ globals->scale_down_factor = 0; #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - globals->hb_font = hb_ft_font_create_( face, NULL ); - globals->hb_buf = hb_buffer_create(); + if ( ft_hb_enabled ( globals ) ) + { + globals->hb_font = ft_hb_ft_font_create( globals ); + globals->hb_buf = hb( buffer_create )(); + + af_parse_gsub( globals ); + } + else + { + globals->hb_font = NULL; + globals->hb_buf = NULL; + + globals->gsub = NULL; + globals->gsub_lookups_single_alternate = NULL; + } #endif error = af_face_globals_compute_style_coverage( globals ); @@ -405,8 +423,14 @@ } #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - hb_font_destroy( globals->hb_font ); - hb_buffer_destroy( globals->hb_buf ); + if ( ft_hb_enabled ( globals ) ) + { + hb( font_destroy )( globals->hb_font ); + hb( buffer_destroy )( globals->hb_buf ); + + FT_FREE( globals->gsub ); + FT_FREE( globals->gsub_lookups_single_alternate ); + } #endif /* no need to free `globals->glyph_styles'; */ diff --git a/modules/freetype2/src/autofit/afglobal.h b/modules/freetype2/src/autofit/afglobal.h @@ -5,7 +5,7 @@ * Auto-fitter routines to compute global hinting values * (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -73,15 +73,17 @@ FT_BEGIN_HEADER /* default script for OpenType; ignored if HarfBuzz isn't used */ #define AF_SCRIPT_DEFAULT AF_SCRIPT_LATN - /* a bit mask for AF_DIGIT and AF_NONBASE */ -#define AF_STYLE_MASK 0x3FFF + /* a bit mask for AF_DIGIT, AF_NONBASE, and AF_HAS_CMAP_ENTRY */ +#define AF_STYLE_MASK 0x1FFF /* an uncovered glyph */ #define AF_STYLE_UNASSIGNED AF_STYLE_MASK - /* if this flag is set, we have an ASCII digit */ + /* if this flag is set, we have an ASCII digit */ #define AF_DIGIT 0x8000U /* if this flag is set, we have a non-base character */ #define AF_NONBASE 0x4000U + /* if this flag is set, the glyph has a (direct) cmap entry */ +#define AF_HAS_CMAP_ENTRY 0x2000U /* `increase-x-height' property */ #define AF_PROP_INCREASE_X_HEIGHT_MIN 6 @@ -111,6 +113,11 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ hb_font_t* hb_font; hb_buffer_t* hb_buf; /* for feature comparison */ + + /* The GSUB table. */ + FT_Byte* gsub; + /* Lookup offsets, with only SingleSubst and AlternateSubst non-NULL. */ + FT_UInt32* gsub_lookups_single_alternate; #endif /* per-face auto-hinter properties */ diff --git a/modules/freetype2/src/autofit/afgsub.c b/modules/freetype2/src/autofit/afgsub.c @@ -0,0 +1,693 @@ +/**************************************************************************** + * + * afgsub.c + * + * Auto-fitter routines to parse the GSUB table (body). + * + * Copyright (C) 2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + + +#include <freetype/freetype.h> +#include <freetype/tttables.h> +#include <freetype/tttags.h> + +#include <freetype/internal/ftstream.h> + +#include "afglobal.h" +#include "afgsub.h" +#include "aftypes.h" + + + /*********************************/ + /******** ********/ + /******** GSUB validation ********/ + /******** ********/ + /*********************************/ + + + static FT_Bool + af_validate_coverage( FT_Byte* table, + FT_Byte* table_limit, + FT_UInt *num_glyphs ) + { + FT_UInt format; + + FT_Byte* p = table; + FT_UInt count = 0; + + + if ( table_limit < p + 4 ) + return FALSE; + + format = FT_NEXT_USHORT( p ); + if ( format == 1 ) + { + FT_UInt glyphCount = FT_NEXT_USHORT( p ); + + + /* We don't validate glyph IDs. */ + if ( table_limit < p + glyphCount * 2 ) + return FALSE; + + count += glyphCount; + } + else if ( format == 2 ) + { + FT_UInt rangeCount = FT_NEXT_USHORT( p ); + FT_Byte* limit = p + rangeCount * 6; + + + if ( table_limit < limit ) + return FALSE; + + while ( p < limit ) + { + FT_UInt startGlyphID = FT_NEXT_USHORT( p ); + FT_UInt endGlyphID = FT_NEXT_USHORT( p ); + + + if ( startGlyphID > endGlyphID ) + return FALSE; + + count += endGlyphID - startGlyphID + 1; + + /* We don't validate coverage indices. */ + p += 2; + } + } + else + return FALSE; + + if ( num_glyphs ) + *num_glyphs = count; + + return TRUE; + } + + + static FT_Bool + af_validate_single_subst1( FT_Byte* table, + FT_Byte* table_limit ) + { + FT_Byte* coverage; + + + /* Subtable format is already checked. */ + + /* The four bytes for the coverage table offset */ + /* and the glyph ID delta are already checked. */ + coverage = table + FT_PEEK_USHORT( table + 2 ); + if ( !af_validate_coverage( coverage, table_limit, NULL ) ) + return FALSE; + + /* We don't validate glyph IDs. */ + + return TRUE; + } + + + static FT_Bool + af_validate_single_subst2( FT_Byte* table, + FT_Byte* table_limit ) + { + FT_Byte* coverage; + FT_UInt glyphCount; + FT_UInt num_glyphs; + + /* Subtable format is already checked. */ + FT_Byte* p = table + 2; + + + /* The four bytes for the coverage table offset */ + /* and `glyphCount` are already checked. */ + coverage = table + FT_NEXT_USHORT( p ); + if ( !af_validate_coverage( coverage, table_limit, &num_glyphs ) ) + return FALSE; + + glyphCount = FT_NEXT_USHORT( p ); + /* We don't validate glyph IDs. */ + if ( table_limit < p + glyphCount * 2 ) + return FALSE; + + if ( glyphCount != num_glyphs ) + return FALSE; + + return TRUE; + } + + + static FT_Bool + af_validate_alternate( FT_Byte* table, + FT_Byte* table_limit ) + { + FT_Byte* coverage; + FT_UInt alternateSetCount; + FT_UInt num_glyphs; + + /* Subtable format is already checked. */ + FT_Byte* p = table + 2; + FT_Byte* limit; + + + /* The four bytes for the coverage table offset */ + /* and `alternateSetCount` are already checked. */ + coverage = table + FT_NEXT_USHORT( p ); + if ( !af_validate_coverage( coverage, table_limit, &num_glyphs ) ) + return FALSE; + + alternateSetCount = FT_NEXT_USHORT( p ); + limit = p + alternateSetCount * 2; + if ( table_limit < limit ) + return FALSE; + + if ( alternateSetCount != num_glyphs ) + return FALSE; + + while ( p < limit ) + { + FT_Byte* alternate_set; + FT_UInt glyphCount; + + + alternate_set = table + FT_NEXT_USHORT( p ); + if ( table_limit < alternate_set + 2 ) + return FALSE; + + glyphCount = FT_PEEK_USHORT( alternate_set ); + /* We don't validate glyph IDs. */ + if ( table_limit < alternate_set + 2 + glyphCount * 2 ) + return FALSE; + } + + return TRUE; + } + + + /* Validate 'SingleSubst' and 'AlternateSubst' lookup tables. */ + static FT_Bool + af_validate_lookup_table( FT_Byte* table, + FT_Byte* table_limit ) + { + FT_UInt lookupType; + FT_UInt real_lookupType = 0; + FT_UInt subtableCount; + + FT_Byte* p = table; + FT_Byte* limit; + + + if ( table_limit < p + 6 ) + return FALSE; + + lookupType = FT_NEXT_USHORT( p ); + + p += 2; /* Skip `lookupFlag`. */ + + subtableCount = FT_NEXT_USHORT( p ); + limit = p + subtableCount * 2; + if ( table_limit < limit ) + return FALSE; + + while ( p < limit ) + { + FT_Byte* subtable = table + FT_NEXT_USHORT( p ); + FT_UInt format; + + + if ( lookupType == 7 ) + { + /* Substitution extension. */ + FT_Byte* q = subtable; + + + if ( table_limit < q + 8 ) + return FALSE; + + if ( FT_NEXT_USHORT( q ) != 1 ) /* format */ + return FALSE; + + if ( real_lookupType == 0 ) + real_lookupType = FT_NEXT_USHORT( q ); + else if ( real_lookupType != FT_NEXT_USHORT( q ) ) + return FALSE; + + subtable += FT_PEEK_ULONG( q ); + } + else + real_lookupType = lookupType; + + /* Ensure the first six bytes of all subtable formats. */ + if ( table_limit < subtable + 6 ) + return FALSE; + + format = FT_PEEK_USHORT( subtable ); + + if ( real_lookupType == 1 ) + { + if ( format == 1 ) + { + if ( !af_validate_single_subst1( subtable, table_limit ) ) + return FALSE; + } + else if ( format == 2 ) + { + if ( !af_validate_single_subst2( subtable, table_limit ) ) + return FALSE; + } + else + return FALSE; + } + else if ( real_lookupType == 3 ) + { + if ( format == 1 ) + { + if ( !af_validate_alternate( subtable, table_limit ) ) + return FALSE; + } + else + return FALSE; + } + else + return FALSE; + } + + return TRUE; + } + + + FT_LOCAL_DEF( void ) + af_parse_gsub( AF_FaceGlobals globals ) + { + FT_Error error = FT_Err_Ok; + + FT_Face face = globals->face; + FT_Memory memory = face->memory; + + FT_ULong gsub_length; + FT_Byte* gsub; + FT_Byte* gsub_limit; + + FT_UInt32* gsub_lookups_single_alternate; + + FT_UInt lookupListOffset; + FT_Byte* lookup_list; + FT_UInt lookupCount; + + FT_UInt idx; + + FT_Byte* p; + FT_Byte* limit; + + + globals->gsub = NULL; + globals->gsub_lookups_single_alternate = NULL; + + /* No error if we can't load or parse GSUB data. */ + + gsub = NULL; + gsub_lookups_single_alternate = NULL; + + gsub_length = 0; + if ( FT_Load_Sfnt_Table( face, TTAG_GSUB, 0, NULL, &gsub_length ) ) + goto Fail; + + if ( FT_QALLOC( gsub, gsub_length ) ) + goto Fail; + + if ( FT_Load_Sfnt_Table( face, TTAG_GSUB, 0, gsub, &gsub_length ) ) + goto Fail; + + if ( gsub_length < 10 ) + goto Fail; + + lookupListOffset = FT_PEEK_USHORT( gsub + 8 ); + if ( gsub_length < lookupListOffset + 2 ) + goto Fail; + + lookupCount = FT_PEEK_USHORT( gsub + lookupListOffset ); + if ( gsub_length < lookupListOffset + 2 + lookupCount * 2 ) + goto Fail; + + if ( FT_NEW_ARRAY( gsub_lookups_single_alternate, lookupCount ) ) + goto Fail; + + gsub_limit = gsub + gsub_length; + lookup_list = gsub + lookupListOffset; + p = lookup_list + 2; + limit = p + lookupCount * 2; + idx = 0; + while ( p < limit ) + { + FT_UInt lookupOffset = FT_NEXT_USHORT( p ); + + + if ( af_validate_lookup_table( lookup_list + lookupOffset, + gsub_limit ) ) + { + /* We store offsets relative to the start of the GSUB table. */ + gsub_lookups_single_alternate[idx] = lookupListOffset + lookupOffset; + } + + idx++; + } + + globals->gsub = gsub; + globals->gsub_lookups_single_alternate = gsub_lookups_single_alternate; + + return; + + Fail: + FT_FREE( gsub ); + FT_FREE( gsub_lookups_single_alternate ); + } + + + /*********************************/ + /******** ********/ + /******** GSUB access ********/ + /******** ********/ + /*********************************/ + + + static FT_UInt + af_coverage_format( FT_Byte* coverage ) + { + return FT_PEEK_USHORT( coverage ); + } + + + static FT_Byte* + af_coverage_start( FT_Byte* coverage ) + { + return coverage + 4; + } + + + static FT_Byte* + af_coverage_limit( FT_Byte* coverage ) + { + if ( af_coverage_format( coverage ) == 1 ) + { + FT_UInt glyphCount = FT_PEEK_USHORT( coverage + 2 ); + + + return af_coverage_start( coverage ) + glyphCount * 2; + } + else + { + FT_UInt rangeCount = FT_PEEK_USHORT( coverage + 2 ); + + + return af_coverage_start( coverage ) + rangeCount * 6; + } + } + + + typedef struct AF_CoverageIteratorRec_* AF_CoverageIterator; + + typedef struct AF_CoverageIteratorRec_ + { + FT_UInt format; + + FT_Byte* p; + FT_Byte* limit; + + FT_UInt16 glyph; + FT_UInt16 glyph_limit; + + } AF_CoverageIteratorRec; + + + static FT_Bool + af_coverage_iterator( AF_CoverageIterator iter, + FT_UInt16* glyph ) + { + if ( iter->p >= iter->limit ) + return FALSE; + + if ( iter->format == 1 ) + *glyph = FT_NEXT_USHORT( iter->p ); + else + { + if ( iter->glyph > iter->glyph_limit ) + { + iter->glyph = FT_NEXT_USHORT( iter->p ); + iter->glyph_limit = FT_NEXT_USHORT( iter->p ); + + iter->p += 2; + } + + *glyph = iter->glyph++; + } + + return TRUE; + } + + + static AF_CoverageIteratorRec + af_coverage_iterator_init( FT_Byte* coverage ) + { + AF_CoverageIteratorRec iterator; + + + iterator.format = af_coverage_format( coverage ); + iterator.p = af_coverage_start( coverage ); + iterator.limit = af_coverage_limit( coverage ); + iterator.glyph = 1; + iterator.glyph_limit = 0; + + return iterator; + } + + + /* + Because we merge all single and alternate substitution mappings into + one, large hash, we need the possibility to have multiple glyphs as + values. We utilize that we have 32bit integers but only 16bit glyph + indices, using the following scheme. + + If glyph G maps to a single substitute S, the entry in the map is + + G -> S + + If glyph G maps to multiple substitutes S1, S2, ..., Sn, we do + + G -> S1 + ((n - 1) << 16) + G + (1 << 16) -> S2 + G + (2 << 16) -> S3 + ... + G + ((n - 1) << 16) -> Sn + */ + static FT_Error + af_hash_insert( FT_UInt16 glyph, + FT_UInt16 substitute, + FT_Hash map, + FT_Memory memory ) + { + FT_Error error; + + size_t* value = ft_hash_num_lookup( glyph, map ); + + + if ( !value ) + { + error = ft_hash_num_insert( glyph, substitute, map, memory ); + if ( error ) + return error; + } + else + { + /* Get number of substitutes, increased by one... */ + FT_UInt mask = ( (FT_UInt)*value & 0xFFFF0000U ) + 0x10000U; + + + /* ... which becomes the new key mask. */ + error = ft_hash_num_insert( (FT_Int)( glyph | mask ), + substitute, + map, + memory ); + if ( error ) + return error; + + /* Update number of substitutes. */ + *value += 0x10000U; + } + + return FT_Err_Ok; + } + + + static FT_Error + af_map_single_subst1( FT_Hash map, + FT_Byte* table, + FT_Memory memory ) + { + FT_Error error; + + FT_Byte* coverage = table + FT_PEEK_USHORT( table + 2 ); + FT_UInt deltaGlyphID = FT_PEEK_USHORT( table + 4 ); + + AF_CoverageIteratorRec iterator = af_coverage_iterator_init( coverage ); + + FT_UInt16 glyph; + + + while ( af_coverage_iterator( &iterator, &glyph ) ) + { + /* `deltaGlyphID` requires modulo 65536 arithmetic. */ + FT_UInt16 subst = (FT_UInt16)( ( glyph + deltaGlyphID ) % 0x10000U ); + + + error = af_hash_insert( glyph, subst, map, memory ); + if ( error ) + return error; + } + + return FT_Err_Ok; + } + + + static FT_Error + af_map_single_subst2( FT_Hash map, + FT_Byte* table, + FT_Memory memory ) + { + FT_Error error; + + FT_Byte* coverage = table + FT_PEEK_USHORT( table + 2 ); + + AF_CoverageIteratorRec iterator = af_coverage_iterator_init( coverage ); + + FT_UInt16 glyph; + FT_Byte* p = table + 6; + + + while ( af_coverage_iterator( &iterator, &glyph ) ) + { + FT_UInt16 subst = FT_NEXT_USHORT( p ); + + + error = af_hash_insert( glyph, subst, map, memory ); + if ( error ) + return error; + } + + return FT_Err_Ok; + } + + + static FT_Error + af_map_alternate( FT_Hash map, + FT_Byte* table, + FT_Memory memory ) + { + FT_Error error; + + FT_Byte* coverage = table + FT_PEEK_USHORT( table + 2 ); + + AF_CoverageIteratorRec iterator = af_coverage_iterator_init( coverage ); + + FT_UInt16 glyph; + FT_Byte* p = table + 6; + + + while ( af_coverage_iterator( &iterator, &glyph ) ) + { + FT_Byte* alternate_set = table + FT_NEXT_USHORT( p ); + + FT_Byte* q = alternate_set; + FT_UInt glyphCount = FT_NEXT_USHORT( q ); + + FT_UInt i; + + + for ( i = 0; i < glyphCount; i++ ) + { + FT_UInt16 subst = FT_NEXT_USHORT( q ); + + + error = af_hash_insert( glyph, subst, map, memory ); + if ( error ) + return error; + } + } + + return FT_Err_Ok; + } + + + /* Map 'SingleSubst' and 'AlternateSubst' lookup tables. */ + FT_LOCAL_DEF( FT_Error ) + af_map_lookup( AF_FaceGlobals globals, + FT_Hash map, + FT_UInt32 lookup_offset ) + { + FT_Face face = globals->face; + FT_Memory memory = face->memory; + + FT_Byte* table = globals->gsub + lookup_offset; + + FT_UInt lookupType = FT_PEEK_USHORT( table ); + FT_UInt subtableCount = FT_PEEK_USHORT( table + 4 ); + + FT_Byte* p = table + 6; + FT_Byte* limit = p + subtableCount * 2; + + + while ( p < limit ) + { + FT_Error error; + + FT_UInt real_lookupType = lookupType; + + FT_Byte* subtable = table + FT_NEXT_USHORT( p ); + + + if ( lookupType == 7 ) + { + FT_Byte* q = subtable + 2; + + + real_lookupType = FT_NEXT_USHORT( q ); + subtable += FT_PEEK_ULONG( q ); + } + + if ( real_lookupType == 1 ) + { + FT_UInt format = FT_PEEK_USHORT( subtable ); + + + error = ( format == 1 ) + ? af_map_single_subst1( map, subtable, memory ) + : af_map_single_subst2( map, subtable, memory ); + } + else + error = af_map_alternate( map, subtable, memory ); + + if ( error ) + return error; + } + + return FT_Err_Ok; + } + + +#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ + +/* ANSI C doesn't like empty source files */ +typedef int afgsub_dummy_; + +#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ + +/* END */ diff --git a/modules/freetype2/src/autofit/afgsub.h b/modules/freetype2/src/autofit/afgsub.h @@ -0,0 +1,38 @@ +/**************************************************************************** + * + * afgsub.h + * + * Auto-fitter routines to parse the GSUB table (header). + * + * Copyright (C) 2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.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 AFGSUB_H_ +#define AFGSUB_H_ + +#include "afglobal.h" + + +FT_BEGIN_HEADER + + FT_LOCAL( void ) + af_parse_gsub( AF_FaceGlobals globals ); + + FT_LOCAL( FT_Error ) + af_map_lookup( AF_FaceGlobals globals, + FT_Hash map, + FT_UInt32 lookup_offset ); + +FT_END_HEADER + +#endif /* AFGSUB_H_ */ + +/* END */ diff --git a/modules/freetype2/src/autofit/afhints.c b/modules/freetype2/src/autofit/afhints.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -840,6 +840,10 @@ if ( hints->contours != hints->embedded.contours ) FT_FREE( hints->contours ); + if ( hints->contour_y_minima != hints->embedded.contour_y_minima ) + FT_FREE( hints->contour_y_minima ); + if ( hints->contour_y_maxima != hints->embedded.contour_y_maxima ) + FT_FREE( hints->contour_y_maxima ); hints->max_contours = 0; hints->num_contours = 0; @@ -896,19 +900,30 @@ { if ( !hints->contours ) { - hints->contours = hints->embedded.contours; + hints->contours = hints->embedded.contours; + hints->contour_y_minima = hints->embedded.contour_y_minima; + hints->contour_y_maxima = hints->embedded.contour_y_maxima; + hints->max_contours = AF_CONTOURS_EMBEDDED; } } else if ( new_max > old_max ) { if ( hints->contours == hints->embedded.contours ) - hints->contours = NULL; + { + hints->contours = NULL; + hints->contour_y_minima = NULL; + hints->contour_y_maxima = NULL; + } new_max = ( new_max + 3 ) & ~3; /* round up to a multiple of 4 */ if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) ) goto Exit; + if ( FT_RENEW_ARRAY( hints->contour_y_minima, old_max, new_max ) ) + goto Exit; + if ( FT_RENEW_ARRAY( hints->contour_y_maxima, old_max, new_max ) ) + goto Exit; hints->max_contours = new_max; } @@ -1324,7 +1339,7 @@ af_glyph_hints_align_edge_points( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = & hints->axis[dim]; + AF_AxisHints axis = &hints->axis[dim]; AF_Segment segments = axis->segments; AF_Segment segment_limit = FT_OFFSET( segments, axis->num_segments ); AF_Segment seg; diff --git a/modules/freetype2/src/autofit/afhints.h b/modules/freetype2/src/autofit/afhints.h @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -222,6 +222,9 @@ FT_BEGIN_HEADER /* the distance to the next point is very small */ #define AF_FLAG_NEAR ( 1U << 5 ) + /* prevent the auto-hinter from adding such a point to a segment */ +#define AF_FLAG_IGNORE ( 1U << 6 ) + /* edge hint flags */ #define AF_EDGE_NORMAL 0 @@ -229,6 +232,7 @@ FT_BEGIN_HEADER #define AF_EDGE_SERIF ( 1U << 1 ) #define AF_EDGE_DONE ( 1U << 2 ) #define AF_EDGE_NEUTRAL ( 1U << 3 ) /* edge aligns to a neutral blue zone */ +#define AF_EDGE_NO_BLUE ( 1U << 4 ) /* do not align edge to blue zone */ typedef struct AF_PointRec_* AF_Point; @@ -303,6 +307,7 @@ FT_BEGIN_HEADER } AF_EdgeRec; + #define AF_SEGMENTS_EMBEDDED 18 /* number of embedded segments */ #define AF_EDGES_EMBEDDED 12 /* number of embedded edges */ @@ -346,9 +351,11 @@ FT_BEGIN_HEADER FT_Int num_points; /* number of used points */ AF_Point points; /* points array */ - FT_Int max_contours; /* number of allocated contours */ - FT_Int num_contours; /* number of used contours */ - AF_Point* contours; /* contours array */ + FT_Int max_contours; /* number of allocated contours */ + FT_Int num_contours; /* number of used contours */ + AF_Point* contours; /* contours array */ + FT_Pos* contour_y_minima; /* array with y maxima of contours */ + FT_Pos* contour_y_maxima; /* array with y minima of contours */ AF_AxisHintsRec axis[AF_DIMENSION_MAX]; @@ -357,11 +364,13 @@ FT_BEGIN_HEADER /* implementations */ AF_StyleMetrics metrics; - /* Two arrays to avoid allocation penalty. */ + /* Some arrays to avoid allocation penalty. */ /* The `embedded' structure must be the last element! */ struct { AF_Point contours[AF_CONTOURS_EMBEDDED]; + FT_Pos contour_y_minima[AF_CONTOURS_EMBEDDED]; + FT_Pos contour_y_maxima[AF_CONTOURS_EMBEDDED]; AF_PointRec points[AF_POINTS_EMBEDDED]; } embedded; diff --git a/modules/freetype2/src/autofit/afindic.c b/modules/freetype2/src/autofit/afindic.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for Indic writing system (body). * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 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/modules/freetype2/src/autofit/afindic.h b/modules/freetype2/src/autofit/afindic.h @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for Indic writing system * (specification). * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 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/modules/freetype2/src/autofit/aflatin.c b/modules/freetype2/src/autofit/aflatin.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for latin writing system (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -22,6 +22,7 @@ #include "afglobal.h" #include "aflatin.h" #include "aferrors.h" +#include "afadjust.h" /************************************************************************** @@ -81,12 +82,8 @@ /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - void* shaper_buf; -#else FT_ULong shaper_buf_; void* shaper_buf = &shaper_buf_; -#endif const char* p; @@ -97,9 +94,9 @@ p = script_class->standard_charstring; -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - shaper_buf = af_shaper_buf_create( face ); -#endif + if ( ft_hb_enabled ( metrics->root.globals ) ) + shaper_buf = af_shaper_buf_create( metrics->root.globals ); + /* * We check a list of standard characters to catch features like * `c2sc' (small caps from caps) that don't contain lowercase letters @@ -140,7 +137,7 @@ break; } - af_shaper_buf_destroy( face, shaper_buf ); + af_shaper_buf_destroy( metrics->root.globals, shaper_buf ); if ( !glyph_index ) { @@ -149,7 +146,7 @@ goto Exit; } - FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n", + FT_TRACE5(( "standard character: U+%04lX (glyph index %lu)\n", ch, glyph_index )); error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); @@ -334,12 +331,8 @@ /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - void* shaper_buf; -#else FT_ULong shaper_buf_; void* shaper_buf = &shaper_buf_; -#endif /* we walk over the blue character strings as specified in the */ @@ -349,9 +342,8 @@ FT_TRACE5(( "============================\n" )); FT_TRACE5(( "\n" )); -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - shaper_buf = af_shaper_buf_create( face ); -#endif + if ( ft_hb_enabled ( metrics->root.globals ) ) + shaper_buf = af_shaper_buf_create( metrics->root.globals ); for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { @@ -367,7 +359,7 @@ FT_Bool have_flag = 0; - FT_TRACE5(( "blue zone %d", axis->blue_count )); + FT_TRACE5(( "blue zone %u", axis->blue_count )); if ( bs->properties ) { @@ -407,6 +399,20 @@ FT_TRACE5(( "long" )); } + if ( AF_LATIN_IS_CAPITAL_BOTTOM_BLUE( bs ) ) + { + if ( have_flag ) + FT_TRACE5(( ", " )); + FT_TRACE5(( "capital bottom" )); + } + + if ( AF_LATIN_IS_SMALL_BOTTOM_BLUE( bs ) ) + { + if ( have_flag ) + FT_TRACE5(( ", " )); + FT_TRACE5(( "small bottom" )); + } + FT_TRACE5(( ")" )); } @@ -454,9 +460,9 @@ } if ( AF_LATIN_IS_TOP_BLUE( bs ) ) - best_y_extremum = FT_INT_MIN; + best_y_extremum = FT_LONG_MIN; else - best_y_extremum = FT_INT_MAX; + best_y_extremum = FT_LONG_MAX; /* iterate over all glyph elements of the character cluster */ /* and get the data of the `biggest' one */ @@ -487,7 +493,7 @@ if ( num_idx == 1 ) FT_TRACE5(( " U+%04lX contains no (usable) outlines\n", ch )); else - FT_TRACE5(( " component %d of cluster starting with U+%04lX" + FT_TRACE5(( " component %u of cluster starting with U+%04lX" " contains no (usable) outlines\n", i, ch )); #endif continue; @@ -825,7 +831,7 @@ if ( num_idx == 1 ) FT_TRACE5(( " U+%04lX: best_y = %5ld", ch, best_y )); else - FT_TRACE5(( " component %d of cluster starting with U+%04lX:" + FT_TRACE5(( " component %u of cluster starting with U+%04lX:" " best_y = %5ld", i, ch, best_y )); #endif @@ -879,8 +885,8 @@ } /* end for loop */ - if ( !( best_y_extremum == FT_INT_MIN || - best_y_extremum == FT_INT_MAX ) ) + if ( !( best_y_extremum == FT_LONG_MIN || + best_y_extremum == FT_LONG_MAX ) ) { if ( best_round ) rounds[num_rounds++] = best_y_extremum; @@ -959,6 +965,10 @@ blue->flags |= AF_LATIN_BLUE_SUB_TOP; if ( AF_LATIN_IS_NEUTRAL_BLUE( bs ) ) blue->flags |= AF_LATIN_BLUE_NEUTRAL; + if ( AF_LATIN_IS_CAPITAL_BOTTOM_BLUE( bs ) ) + blue->flags |= AF_LATIN_BLUE_BOTTOM; + if ( AF_LATIN_IS_SMALL_BOTTOM_BLUE( bs ) ) + blue->flags |= AF_LATIN_BLUE_BOTTOM_SMALL; /* * The following flag is used later to adjust the y and x scales @@ -973,7 +983,7 @@ } /* end for loop */ - af_shaper_buf_destroy( face, shaper_buf ); + af_shaper_buf_destroy( metrics->root.globals, shaper_buf ); if ( axis->blue_count ) { @@ -1070,23 +1080,20 @@ /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - void* shaper_buf; -#else FT_ULong shaper_buf_; void* shaper_buf = &shaper_buf_; -#endif /* in all supported charmaps, digits have character codes 0x30-0x39 */ const char digits[] = "0 1 2 3 4 5 6 7 8 9"; const char* p; + FT_UNUSED( face ); + p = digits; -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - shaper_buf = af_shaper_buf_create( face ); -#endif + if ( ft_hb_enabled ( metrics->root.globals ) ) + shaper_buf = af_shaper_buf_create( metrics->root.globals ); while ( *p ) { @@ -1122,7 +1129,7 @@ } } - af_shaper_buf_destroy( face, shaper_buf ); + af_shaper_buf_destroy( metrics->root.globals, shaper_buf ); metrics->root.digits_have_same_width = same_width; } @@ -1155,6 +1162,9 @@ af_latin_metrics_check_digits( metrics, face ); } + af_reverse_character_map_new( &metrics->root.reverse_charmap, + &metrics->root ); + Exit: face->charmap = oldmap; return error; @@ -1263,7 +1273,7 @@ max_height = FT_MAX( max_height, -Axis->blues[nn].descender ); } - dist = FT_MulFix( max_height, new_scale - scale ); + dist = FT_MulFix( max_height, new_scale - scale ); if ( -128 < dist && dist < 128 ) { @@ -1466,13 +1476,13 @@ AF_LatinBlue blue = &axis->blues[nn]; - FT_TRACE5(( " reference %d: %ld scaled to %.2f%s\n", + FT_TRACE5(( " reference %u: %ld scaled to %.2f%s\n", nn, blue->ref.org, (double)blue->ref.fit / 64, ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? "" : " (inactive)" )); - FT_TRACE5(( " overshoot %d: %ld scaled to %.2f%s\n", + FT_TRACE5(( " overshoot %u: %ld scaled to %.2f%s\n", nn, blue->shoot.org, (double)blue->shoot.fit / 64, @@ -1484,6 +1494,17 @@ } + FT_CALLBACK_DEF( void ) + af_latin_metrics_done( AF_StyleMetrics metrics_ ) + { + AF_LatinMetrics metrics = (AF_LatinMetrics)metrics_; + + + af_reverse_character_map_done( metrics->root.reverse_charmap, + metrics->root.globals->face->memory ); + } + + /* Scale global values in both directions. */ FT_LOCAL_DEF( void ) @@ -1617,7 +1638,8 @@ FT_Pos prev_max_on_coord = max_on_coord; - if ( FT_ABS( last->out_dir ) == major_dir && + if ( !( point->flags & AF_FLAG_IGNORE ) && + FT_ABS( last->out_dir ) == major_dir && FT_ABS( point->out_dir ) == major_dir ) { /* we are already on an edge, try to locate its start */ @@ -1676,13 +1698,17 @@ max_on_coord = v; } - if ( point->out_dir != segment_dir || point == last ) + if ( point->flags & AF_FLAG_IGNORE || + point->out_dir != segment_dir || + point == last ) { /* check whether the new segment's start point is identical to */ /* the previous segment's end point; for example, this might */ /* happen for spikes */ - if ( !prev_segment || segment->first != prev_segment->last ) + if ( point->flags & AF_FLAG_IGNORE || + !prev_segment || + segment->first != prev_segment->last ) { /* points are different: we are just leaving an edge, thus */ /* record a new segment */ @@ -1842,7 +1868,8 @@ /* if we are not on an edge, check whether the major direction */ /* coincides with the current point's `out' direction, or */ /* whether we have a single-point contour */ - if ( !on_edge && + if ( !( point->flags & AF_FLAG_IGNORE ) && + !on_edge && ( FT_ABS( point->out_dir ) == major_dir || point == point->prev ) ) { @@ -2521,6 +2548,9 @@ FT_Pos best_dist; /* initial threshold */ + if ( edge->flags & AF_EDGE_NO_BLUE ) + continue; + /* compute the initial threshold as a fraction of the EM size */ /* (the value 40 is heuristic) */ best_dist = FT_MulFix( metrics->units_per_em / 40, scale ); @@ -2610,7 +2640,7 @@ } - /* Initalize hinting engine. */ + /* Initialize hinting engine. */ static FT_Error af_latin_hints_init( AF_GlyphHints hints, @@ -2737,247 +2767,1433 @@ } - /* Compute the snapped width of a given stem, ignoring very thin ones. */ - /* There is a lot of voodoo in this function; changing the hard-coded */ - /* parameters influence the whole hinting process. */ +#undef FT_COMPONENT +#define FT_COMPONENT afadjust - static FT_Pos - af_latin_compute_stem_width( AF_GlyphHints hints, - AF_Dimension dim, - FT_Pos width, - FT_Pos base_delta, - FT_UInt base_flags, - FT_UInt stem_flags ) + + static void + af_move_contour_vertically( AF_Point contour, + FT_Int movement ) { - AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics; - AF_LatinAxis axis = &metrics->axis[dim]; - FT_Pos dist = width; - FT_Int sign = 0; - FT_Int vertical = ( dim == AF_DIMENSION_VERT ); + AF_Point point = contour; + AF_Point first_point = point; - if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || - axis->extra_light ) - return width; + if ( point ) + { + do + { + point->y += movement; + point = point->next; - if ( dist < 0 ) + } while ( point != first_point ); + } + } + + + /* Move all contours higher than `limit` by `delta`. */ + static void + af_move_contours_up( AF_GlyphHints hints, + FT_Pos limit, + FT_Pos delta ) + { + FT_Int contour; + + + for ( contour = 0; contour < hints->num_contours; contour++ ) { - dist = -width; - sign = 1; + FT_Pos min_y = hints->contour_y_minima[contour]; + FT_Pos max_y = hints->contour_y_maxima[contour]; + + + if ( min_y < max_y && + min_y > limit ) + af_move_contour_vertically( hints->contours[contour], + delta ); } + } - if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || - ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) + + static void + af_move_contours_down( AF_GlyphHints hints, + FT_Pos limit, + FT_Pos delta ) + { + FT_Int contour; + + + for ( contour = 0; contour < hints->num_contours; contour++ ) { - /* smooth hinting process: very lightly quantize the stem width */ + FT_Pos min_y = hints->contour_y_minima[contour]; + FT_Pos max_y = hints->contour_y_maxima[contour]; - /* leave the widths of serifs alone */ - if ( ( stem_flags & AF_EDGE_SERIF ) && - vertical && - ( dist < 3 * 64 ) ) - goto Done_Width; - else if ( base_flags & AF_EDGE_ROUND ) - { - if ( dist < 80 ) - dist = 64; - } - else if ( dist < 56 ) - dist = 56; + if ( min_y < max_y && + max_y < limit ) + af_move_contour_vertically( hints->contours[contour], + -delta ); + } + } - if ( axis->width_count > 0 ) - { - FT_Pos delta; + /* Compute vertical extrema of all contours and store them in the */ + /* `contour_y_minima` and `contour_y_maxima` arrays of `hints`. */ + static void + af_compute_vertical_extrema( AF_GlyphHints hints ) + { + FT_Int contour; - /* compare to standard width */ - delta = dist - axis->widths[0].cur; - if ( delta < 0 ) - delta = -delta; + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos min_y = FT_LONG_MAX; + FT_Pos max_y = FT_LONG_MIN; - if ( delta < 40 ) - { - dist = axis->widths[0].cur; - if ( dist < 48 ) - dist = 48; + AF_Point first_point = hints->contours[contour]; + AF_Point point = first_point; - goto Done_Width; - } - if ( dist < 3 * 64 ) - { - delta = dist & 63; - dist &= -64; + if ( !first_point || first_point->next->next == first_point ) + goto End_loop; - if ( delta < 10 ) - dist += delta; + do + { + if ( point->y < min_y ) + min_y = point->y; + if ( point->y > max_y ) + max_y = point->y; - else if ( delta < 32 ) - dist += 10; + point = point->next; - else if ( delta < 54 ) - dist += 54; + } while ( point != first_point ); - else - dist += delta; - } - else - { - /* A stem's end position depends on two values: the start */ - /* position and the stem length. The former gets usually */ - /* rounded to the grid, while the latter gets rounded also if it */ - /* exceeds a certain length (see below in this function). This */ - /* `double rounding' can lead to a great difference to the */ - /* original, unhinted position; this normally doesn't matter for */ - /* large PPEM values, but for small sizes it can easily make */ - /* outlines collide. For this reason, we adjust the stem length */ - /* by a small amount depending on the PPEM value in case the */ - /* former and latter rounding both point into the same */ - /* direction. */ + End_loop: + hints->contour_y_minima[contour] = min_y; + hints->contour_y_maxima[contour] = max_y; + } + } - FT_Pos bdelta = 0; + static FT_Int + af_find_highest_contour( AF_GlyphHints hints ) + { + FT_Int highest_contour = 0; + FT_Pos highest_min_y = FT_LONG_MAX; + FT_Pos highest_max_y = FT_LONG_MIN; - if ( ( ( width > 0 ) && ( base_delta > 0 ) ) || - ( ( width < 0 ) && ( base_delta < 0 ) ) ) - { - FT_UInt ppem = metrics->root.scaler.face->size->metrics.x_ppem; + FT_Int contour; - if ( ppem < 10 ) - bdelta = base_delta; - else if ( ppem < 30 ) - bdelta = ( base_delta * (FT_Pos)( 30 - ppem ) ) / 20; + /* At this point we have one 'lower' (usually the base glyph) */ + /* and one 'upper' object (usually the diacritic glyph). If */ + /* there are more contours, they must be enclosed within either */ + /* 'lower' or 'upper'. To find this enclosing 'upper' contour */ + /* it is thus sufficient to search for the contour with the */ + /* highest y maximum value. */ + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos current_min_y = hints->contour_y_minima[contour]; + FT_Pos current_max_y = hints->contour_y_maxima[contour]; - if ( bdelta < 0 ) - bdelta = -bdelta; - } - dist = ( dist - bdelta + 32 ) & ~63; - } + /* If we have two contours with the same maximum value, take */ + /* the one that has a smaller height. */ + if ( current_max_y > highest_max_y || + ( current_max_y == highest_max_y && + current_min_y > highest_min_y ) ) + { + highest_min_y = current_min_y; + highest_max_y = current_max_y; + highest_contour = contour; } } - else - { - /* strong hinting process: snap the stem width to integer pixels */ - FT_Pos org_dist = dist; + return highest_contour; + } - dist = af_latin_snap_width( axis->widths, axis->width_count, dist ); + static FT_Int + af_find_second_highest_contour( AF_GlyphHints hints ) + { + FT_Int highest_contour; + FT_Pos highest_min_y; - if ( vertical ) - { - /* in the case of vertical hinting, always round */ - /* the stem heights to integer pixels */ + FT_Int second_highest_contour = 0; + FT_Pos second_highest_max_y = FT_LONG_MIN; - if ( dist >= 64 ) - dist = ( dist + 16 ) & ~63; - else - dist = 64; - } - else - { - if ( AF_LATIN_HINTS_DO_MONO( hints ) ) - { - /* monochrome horizontal hinting: snap widths to integer pixels */ - /* with a different threshold */ + FT_Int contour; - if ( dist < 64 ) - dist = 64; - else - dist = ( dist + 32 ) & ~63; - } - else - { - /* for horizontal anti-aliased hinting, we adopt a more subtle */ - /* approach: we strengthen small stems, round stems whose size */ - /* is between 1 and 2 pixels to an integer, otherwise nothing */ - if ( dist < 48 ) - dist = ( dist + 64 ) >> 1; + if ( hints->num_contours < 3 ) + return 0; - else if ( dist < 128 ) - { - /* We only round to an integer width if the corresponding */ - /* distortion is less than 1/4 pixel. Otherwise this */ - /* makes everything worse since the diagonals, which are */ - /* not hinted, appear a lot bolder or thinner than the */ - /* vertical stems. */ + highest_contour = af_find_highest_contour( hints ); + highest_min_y = hints->contour_y_minima[highest_contour]; - FT_Pos delta; + /* Search the contour with the largest vertical maximum that has a */ + /* vertical minimum lower than the vertical minimum of the topmost */ + /* contour. */ + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos current_min_y; + FT_Pos current_max_y; - dist = ( dist + 22 ) & ~63; - delta = dist - org_dist; - if ( delta < 0 ) - delta = -delta; + if ( contour == highest_contour ) + continue; - if ( delta >= 16 ) - { - dist = org_dist; - if ( dist < 48 ) - dist = ( dist + 64 ) >> 1; - } - } - else - /* round otherwise to prevent color fringes in LCD mode */ - dist = ( dist + 32 ) & ~63; - } + current_min_y = hints->contour_y_minima[contour]; + current_max_y = hints->contour_y_maxima[contour]; + + if ( current_max_y > second_highest_max_y && + current_min_y < highest_min_y ) + { + second_highest_max_y = current_max_y; + second_highest_contour = contour; } } - Done_Width: - if ( sign ) - dist = -dist; - - return dist; + return second_highest_contour; } - /* Align one stem edge relative to the previous stem edge. */ - - static void - af_latin_align_linked_edge( AF_GlyphHints hints, - AF_Dimension dim, - AF_Edge base_edge, - AF_Edge stem_edge ) + static FT_Int + af_find_lowest_contour( AF_GlyphHints hints ) { - FT_Pos dist, base_delta; - FT_Pos fitted_width; + FT_Int lowest_contour = 0; + FT_Pos lowest_min_y = FT_LONG_MAX; + FT_Pos lowest_max_y = FT_LONG_MIN; + FT_Int contour; - dist = stem_edge->opos - base_edge->opos; - base_delta = base_edge->pos - base_edge->opos; - fitted_width = af_latin_compute_stem_width( hints, dim, - dist, base_delta, - base_edge->flags, - stem_edge->flags ); + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos current_min_y = hints->contour_y_minima[contour]; + FT_Pos current_max_y = hints->contour_y_maxima[contour]; - stem_edge->pos = base_edge->pos + fitted_width; + if ( current_min_y < lowest_min_y || + ( current_min_y == lowest_min_y && + current_max_y < lowest_max_y ) ) + { + lowest_min_y = current_min_y; + lowest_max_y = current_max_y; + lowest_contour = contour; + } + } - FT_TRACE5(( " LINK: edge %td (opos=%.2f) linked to %.2f," - " dist was %.2f, now %.2f\n", - stem_edge - hints->axis[dim].edges, - (double)stem_edge->opos / 64, (double)stem_edge->pos / 64, - (double)dist / 64, (double)fitted_width / 64 )); + return lowest_contour; } - /* Shift the coordinates of the `serif' edge by the same amount */ - /* as the corresponding `base' edge has been moved already. */ - - static void - af_latin_align_serif_edge( AF_GlyphHints hints, - AF_Edge base, - AF_Edge serif ) + static FT_Int + af_find_second_lowest_contour( AF_GlyphHints hints ) { - FT_UNUSED( hints ); + FT_Int lowest_contour; + FT_Pos lowest_max_y; - serif->pos = base->pos + ( serif->opos - base->opos ); + FT_Int second_lowest_contour = 0; + FT_Pos second_lowest_min_y = FT_LONG_MAX; + + FT_Int contour; + + + if ( hints->num_contours < 3 ) + return 0; + + lowest_contour = af_find_lowest_contour( hints ); + lowest_max_y = hints->contour_y_maxima[lowest_contour]; + + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos current_min_y; + FT_Pos current_max_y; + + + if ( contour == lowest_contour ) + continue; + + current_min_y = hints->contour_y_minima[contour]; + current_max_y = hints->contour_y_maxima[contour]; + + if ( current_min_y < second_lowest_min_y && + current_max_y > lowest_max_y ) + { + second_lowest_min_y = current_min_y; + second_lowest_contour = contour; + } + } + + return second_lowest_contour; + } + + + /* While aligning edges to blue zones, make the auto-hinter */ + /* ignore the ones that are higher than `pos`. */ + static void + af_prevent_top_blue_alignment( AF_GlyphHints hints, + FT_Pos pos ) + { + AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; + + AF_Edge edges = axis->edges; + AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges ); + AF_Edge edge; + + + for ( edge = edges; edge < edge_limit; edge++ ) + if ( edge->pos > pos ) + edge->flags |= AF_EDGE_NO_BLUE; + } + + + static void + af_prevent_bottom_blue_alignment( AF_GlyphHints hints, + FT_Pos pos ) + { + AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; + + AF_Edge edges = axis->edges; + AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges ); + AF_Edge edge; + + + for ( edge = edges; edge < edge_limit; edge++ ) + if ( edge->pos < pos ) + edge->flags |= AF_EDGE_NO_BLUE; + } + + + static void + af_latin_get_base_glyph_blues( AF_GlyphHints hints, + FT_Bool is_capital, + AF_LatinBlue* top, + AF_LatinBlue* bottom ) + { + AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics; + AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; + + FT_UInt top_flag; + FT_UInt bottom_flag; + + FT_UInt i; + + + top_flag = is_capital ? AF_LATIN_BLUE_TOP + : AF_LATIN_BLUE_ADJUSTMENT; + top_flag |= AF_LATIN_BLUE_ACTIVE; + + for ( i = 0; i < axis->blue_count; i++ ) + if ( ( axis->blues[i].flags & top_flag ) == top_flag ) + break; + if ( i < axis->blue_count ) + *top = &axis->blues[i]; + + bottom_flag = is_capital ? AF_LATIN_BLUE_BOTTOM + : AF_LATIN_BLUE_BOTTOM_SMALL; + bottom_flag |= AF_LATIN_BLUE_ACTIVE; + + for ( i = 0; i < axis->blue_count; i++ ) + if ( ( axis->blues[i].flags & bottom_flag ) == bottom_flag ) + break; + if ( i < axis->blue_count ) + *bottom = &axis->blues[i]; + } + + + /* Make the auto-hinter ignore top blue zones while aligning edges. */ + /* This affects everything that is higher than a vertical position */ + /* based on the lowercase or uppercase top and bottom blue zones */ + /* (depending on `is_capital`). */ + static void + af_latin_ignore_top( AF_GlyphHints hints, + AF_LatinBlue top_blue, + AF_LatinBlue bottom_blue ) + { + FT_Pos base_glyph_height; + FT_Pos limit; + + + /* Ignore blue zones that are higher than a heuristic threshold */ + /* (value 7 corresponds to approx. 14%, which should be sufficient */ + /* to exceed the height of uppercase serifs. We also add a quarter */ + /* of a pixel as a safety measure. */ + base_glyph_height = top_blue->shoot.cur - bottom_blue->shoot.cur; + limit = top_blue->shoot.cur + base_glyph_height / 7 + 16; + + af_prevent_top_blue_alignment( hints, limit ); + } + + + static void + af_latin_ignore_bottom( AF_GlyphHints hints, + AF_LatinBlue top_blue, + AF_LatinBlue bottom_blue ) + { + FT_Pos base_glyph_height; + FT_Pos limit; + + + base_glyph_height = top_blue->shoot.cur - bottom_blue->shoot.cur; + limit = bottom_blue->shoot.cur - base_glyph_height / 7 - 16; + + af_prevent_bottom_blue_alignment( hints, limit ); + } + + + static void + af_touch_contour( AF_GlyphHints hints, + FT_Int contour ) + { + AF_Point first_point = hints->contours[contour]; + AF_Point p = first_point; + + + do + { + p = p->next; + + p->flags |= AF_FLAG_IGNORE; + if ( !( p->flags & AF_FLAG_CONTROL ) ) + p->flags |= AF_FLAG_TOUCH_Y; + + } while ( p != first_point ); + } + + + static void + af_touch_top_contours( AF_GlyphHints hints, + FT_Int limit_contour ) + { + FT_Pos limit = hints->contour_y_minima[limit_contour]; + + FT_Int contour; + + + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos min_y = hints->contour_y_minima[contour]; + FT_Pos max_y = hints->contour_y_maxima[contour]; + + + if ( min_y < max_y && + min_y >= limit ) + af_touch_contour( hints, contour ); + } + } + + + static void + af_touch_bottom_contours( AF_GlyphHints hints, + FT_Int limit_contour ) + { + FT_Pos limit = hints->contour_y_minima[limit_contour]; + + FT_Int contour; + + + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos min_y = hints->contour_y_minima[contour]; + FT_Pos max_y = hints->contour_y_maxima[contour]; + + + if ( min_y < max_y && + max_y <= limit ) + af_touch_contour( hints, contour ); + } + } + + + /* Stretch tilde vertically, if necessary, and return the height */ + /* difference between the original and the stretched outline. */ + static FT_Pos + af_latin_stretch_top_tilde( AF_GlyphHints hints, + FT_Int tilde_contour ) + { + AF_Point p = hints->contours[tilde_contour]; + AF_Point first_point = p; + + FT_Pos min_y = hints->contour_y_minima[tilde_contour]; + FT_Pos max_y = hints->contour_y_maxima[tilde_contour]; + + FT_Pos min_measurement = FT_LONG_MAX; + FT_Bool measurement_taken = FALSE; + + FT_Pos height; + FT_Pos extremum_threshold; + FT_Pos target_height; + + + if ( min_y == max_y ) + return 0; + + FT_TRACE4(( "af_latin_stretch_top_tilde: min y: %ld, max y: %ld\n", + min_y, max_y )); + + height = SUB_LONG( max_y, min_y ); + extremum_threshold = height / 8; /* Value 8 is heuristic. */ + + /* Find points that are local vertical round extrema, and which */ + /* do not coincide with the vertical extreme values (i.e., we */ + /* search for the 'other' wiggles in the tilde), then measure the */ + /* distance to the vertical extreme values. Try to find the one */ + /* with the smallest distance. */ + /* */ + /* The algorithm only works for tilde shapes that don't deviate */ + /* from the standard shape too much. In particular, the wiggles */ + /* must be round extrema. */ + do + { + p = p->next; + + if ( !( p->flags & AF_FLAG_CONTROL ) && + p->prev->y == p->y && p->next->y == p->y && + p->y != min_y && p->y != max_y && + p->prev->flags & AF_FLAG_CONTROL && + p->next->flags & AF_FLAG_CONTROL ) + { + /* This point could be a candidate. Find the next and previous */ + /* on-curve points, and make sure they are both either above or */ + /* below the point, then make the measurement. */ + AF_Point prev_on = p->prev; + AF_Point next_on = p->next; + + FT_Pos measurement; + + + while ( prev_on->flags & AF_FLAG_CONTROL ) + prev_on = prev_on->prev; + while ( next_on->flags & AF_FLAG_CONTROL ) + next_on = next_on->next; + + if ( next_on->y > p->y && prev_on->y > p->y ) + measurement = p->y - min_y; + else if ( next_on->y < p->y && prev_on->y < p->y ) + measurement = max_y - p->y; + else + continue; + + /* Ignore hits that are too near to a vertical extremum. */ + if ( measurement < extremum_threshold ) + continue; + + if ( !measurement_taken || measurement < min_measurement ) + { + measurement_taken = TRUE; + min_measurement = measurement; + } + } + + } while ( p != first_point ); + + if ( !measurement_taken ) + min_measurement = 0; + + FT_TRACE4(( "af_latin_stretch_top_tilde: min measurement %ld\n", + min_measurement )); + + /* To preserve the stretched shape we prevent that the tilde */ + /* gets auto-hinted; we do this for all contours equal or */ + /* above the vertical minimum of `tilde_contour`. */ + af_touch_top_contours( hints, tilde_contour ); + + /* XXX This is an important element of the algorithm; */ + /* we need a description. */ + target_height = min_measurement + 64; + if ( height >= target_height ) + return 0; + + /* Do the scaling. */ + p = first_point; + do + { + p = p->next; + /* We adjust the height of the diacritic only, which means */ + /* we are never dealing with large numbers and can thus avoid */ + /* `FT_MulFix`. */ + p->y = ( ( p->y - min_y ) * target_height / height ) + min_y; + + } while ( p != first_point ); + + return target_height - height; + } + + + static FT_Pos + af_latin_stretch_bottom_tilde( AF_GlyphHints hints, + FT_Int tilde_contour ) + { + AF_Point p = hints->contours[tilde_contour]; + AF_Point first_point = p; + + FT_Pos min_y = hints->contour_y_minima[tilde_contour]; + FT_Pos max_y = hints->contour_y_maxima[tilde_contour]; + + FT_Pos min_measurement = FT_LONG_MAX; + FT_Bool measurement_taken = FALSE; + + FT_Pos height; + FT_Pos extremum_threshold; + FT_Pos target_height; + + + if ( min_y == max_y ) + return 0; + + FT_TRACE4(( "af_latin_stretch_bottom_tilde: min y: %ld, max y: %ld\n", + min_y, max_y )); + + height = SUB_LONG( max_y, min_y ); + extremum_threshold = height / 8; + + do + { + p = p->next; + + if ( !( p->flags & AF_FLAG_CONTROL ) && + p->prev->y == p->y && p->next->y == p->y && + p->y != min_y && p->y != max_y && + p->prev->flags & AF_FLAG_CONTROL && + p->next->flags & AF_FLAG_CONTROL ) + { + AF_Point prev_on = p->prev; + AF_Point next_on = p->next; + + FT_Pos measurement; + + + while ( prev_on->flags & AF_FLAG_CONTROL ) + prev_on = prev_on->prev; + while ( next_on->flags & AF_FLAG_CONTROL ) + next_on = next_on->next; + + if ( next_on->y > p->y && prev_on->y > p->y ) + measurement = p->y - min_y; + else if ( next_on->y < p->y && prev_on->y < p->y ) + measurement = max_y - p->y; + else + continue; + + if ( measurement < extremum_threshold ) + continue; + + if ( !measurement_taken || measurement < min_measurement ) + { + measurement_taken = TRUE; + min_measurement = measurement; + } + } + + } while ( p != first_point ); + + if ( !measurement_taken ) + min_measurement = 0; + + FT_TRACE4(( "af_latin_stretch_bottom_tilde: min measurement %ld\n", + min_measurement )); + + af_touch_bottom_contours( hints, tilde_contour ); + + target_height = min_measurement + 64; + if ( height >= target_height ) + return 0; + + p = first_point; + do + { + p = p->next; + p->y = ( ( p->y - max_y ) * target_height / height ) + max_y; + + } while ( p != first_point ); + + return target_height - height; + } + + + /* + As part of `af_latin_stretch_top_tilde`, normally all points in the + tilde are marked as touched, so the existing grid fitting will leave the + tilde misaligned with the grid. + + This function moves the tilde contour down to be grid-fitted. We assume + that if moving the tilde down would cause it to touch or overlap another + countour, the vertical adjustment step will fix it. + + Because the vertical adjustment step comes after all other grid-fitting + steps, the top edge of the contour under the tilde is usually aligned + with a horizontal grid line. The vertical gap enforced by the vertical + adjustment is exactly one pixel, so if the top edge of the contour below + the tilde is on a grid line, the resulting tilde contour will also be + grid-aligned. + + But in cases where the gap is already big enough so that the vertical + adjustment does nothing, this function ensures that even without the + intervention of the vertical adjustment step, the tilde will be + grid-aligned. + + Return the vertical alignment amount. + */ + static FT_Pos + af_latin_align_top_tilde( AF_GlyphHints hints, + FT_Int tilde_contour ) + { + AF_Point p = hints->contours[tilde_contour]; + AF_Point first_point = p; + + FT_Pos min_y = p->y; + FT_Pos max_y = p->y; + + FT_Pos min_y_rounded; + FT_Pos delta; + FT_Pos height; + + + /* Find vertical extrema of the (now stretched) tilde contour. */ + do + { + p = p->next; + if ( p->y < min_y ) + min_y = p->y; + if ( p->y > max_y ) + max_y = p->y; + + } while ( p != first_point ); + + /* Align bottom of the tilde to the grid. */ + min_y_rounded = FT_PIX_ROUND( min_y ); + delta = min_y_rounded - min_y; + height = max_y - min_y; + + /* If the tilde is less than 3 pixels tall, snap the center of it */ + /* to the grid instead of the bottom to improve readability. */ + if ( height < 64 * 3 ) + delta += ( FT_PIX_ROUND( height ) - height ) / 2; + + af_move_contour_vertically( first_point, delta ); + + return delta; + } + + + static FT_Pos + af_latin_align_bottom_tilde( AF_GlyphHints hints, + FT_Int tilde_contour ) + { + AF_Point p = hints->contours[tilde_contour]; + AF_Point first_point = p; + + FT_Pos min_y = p->y; + FT_Pos max_y = p->y; + + FT_Pos max_y_rounded; + FT_Pos delta; + FT_Pos height; + + + do + { + p = p->next; + if ( p->y < min_y ) + min_y = p->y; + if ( p->y > max_y ) + max_y = p->y; + + } while ( p != first_point ); + + max_y_rounded = FT_PIX_ROUND( max_y ); + delta = max_y_rounded - max_y; + height = max_y - min_y; + + if ( height < 64 * 3 ) + delta -= ( FT_PIX_ROUND( height ) - height ) / 2; + + af_move_contour_vertically( first_point, delta ); + + return delta; + } + + + /* Return 1 if the given contour overlaps horizontally with the bounding */ + /* box of all other contours combined. This is a helper for function */ + /* `af_glyph_hints_apply_vertical_separation_adjustments`. */ + static FT_Bool + af_check_contour_horizontal_overlap( AF_GlyphHints hints, + FT_Int contour_index ) + { + FT_Pos contour_max_x = FT_LONG_MIN; + FT_Pos contour_min_x = FT_LONG_MAX; + FT_Pos others_max_x = FT_LONG_MIN; + FT_Pos others_min_x = FT_LONG_MAX; + + FT_Int contour; + + FT_Bool horizontal_overlap; + + + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + AF_Point first_point = hints->contours[contour]; + AF_Point p = first_point; + + + /* Ignore dimensionless contours (i.e., contours with only one or */ + /* two points). */ + if ( first_point->next->next == first_point ) + continue; + + do + { + p = p->next; + + if ( contour == contour_index ) + { + if ( p->x < contour_min_x ) + contour_min_x = p->x; + if ( p->x > contour_max_x ) + contour_max_x = p->x; + } + else + { + if ( p->x < others_min_x ) + others_min_x = p->x; + if ( p->x > others_max_x ) + others_max_x = p->x; + } + } while ( p != first_point ); + } + + horizontal_overlap = + ( others_min_x <= contour_max_x && contour_max_x <= others_max_x ) || + ( others_min_x <= contour_min_x && contour_min_x <= others_max_x ) || + ( contour_max_x >= others_max_x && contour_min_x <= others_min_x ); + + return horizontal_overlap; + } + + + static void + af_glyph_hints_apply_vertical_separation_adjustments( + AF_GlyphHints hints, + AF_Dimension dim, + FT_UInt glyph_index, + FT_Pos accent_height_limit, + FT_Hash reverse_charmap ) + { + FT_Bool adjust_top = FALSE; + FT_Bool adjust_below_top = FALSE; + + FT_Bool adjust_bottom = FALSE; + FT_Bool adjust_above_bottom = FALSE; + + size_t* val; + FT_UInt32 adj_type = AF_ADJUST_NONE; + + + FT_TRACE4(( "Entering" + " af_glyph_hints_apply_vertical_separation_adjustments\n" )); + + if ( dim != AF_DIMENSION_VERT ) + return; + + val = ft_hash_num_lookup( (FT_Int)glyph_index, reverse_charmap ); + if ( val ) + { + FT_UInt codepoint = *val; + + + adj_type = af_adjustment_database_lookup( codepoint ); + + if ( adj_type ) + { + adjust_top = !!( adj_type & AF_ADJUST_UP ); + adjust_below_top = !!( adj_type & AF_ADJUST_UP2 ); + + adjust_bottom = !!( adj_type & AF_ADJUST_DOWN ); + adjust_above_bottom = !!( adj_type & AF_ADJUST_DOWN2 ); + } + } + + if ( ( ( adjust_top || adjust_bottom ) && + hints->num_contours >= 2 ) || + ( ( adjust_below_top || adjust_above_bottom ) && + hints->num_contours >= 3 ) ) + { + /* Recompute vertical extrema, this time acting on already */ + /* auto-hinted outlines. */ + af_compute_vertical_extrema( hints ); + } + + if ( ( adjust_top && hints->num_contours >= 2 ) || + ( adjust_below_top && hints->num_contours >= 3 ) ) + { + FT_Int high_contour; + FT_Pos high_min_y; + FT_Pos high_max_y; + FT_Pos high_height; + + FT_Int tilde_contour; + FT_Pos tilde_min_y; + FT_Pos tilde_max_y; + FT_Pos tilde_height; + + FT_Int contour; + FT_Bool horizontal_overlap; + + FT_Pos min_distance = 64; + FT_Pos adjustment_amount; + FT_Pos calculated_amount; + FT_Pos centering_adjustment = 0; + FT_Pos pos; + + FT_Bool is_top_tilde = !!( adj_type & AF_ADJUST_TILDE_TOP ); + FT_Bool is_below_top_tilde = !!( adj_type & AF_ADJUST_TILDE_TOP2 ); + + + FT_TRACE4(( "af_glyph_hints_apply_vertical_separation_adjustments:\n" + " Applying vertical adjustment: %s\n", + adjust_top ? "AF_ADJUST_TOP" : "AF_ADJUST_TOP2" )); + + high_contour = adjust_below_top + ? af_find_second_highest_contour( hints ) + : af_find_highest_contour( hints ); + + /* Check for a horizontal overlap between the high contour and the */ + /* rest. If there is no overlap, do not adjust. */ + horizontal_overlap = + af_check_contour_horizontal_overlap( hints, high_contour ); + if ( !horizontal_overlap ) + { + FT_TRACE4(( " High contour does not horizontally overlap" + " with other contours.\n" + " Skipping adjustment.\n" )); + return; + } + + high_min_y = hints->contour_y_minima[high_contour]; + high_max_y = hints->contour_y_maxima[high_contour]; + high_height = high_max_y - high_min_y; + + if ( high_height > accent_height_limit ) + { + FT_TRACE4(( " High contour height (%.2f) exceeds accent height" + " limit (%.2f).\n" + " Skipping adjustment.\n", + (double)high_height / 64, + (double)accent_height_limit / 64 )); + return; + } + + /* If the difference between the vertical minimum of the high */ + /* contour and the vertical maximum of another contour is less */ + /* than a pixel, shift up the high contour to make the distance */ + /* one pixel. */ + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos min_y; + FT_Pos max_y; + FT_Pos distance; + + + if ( contour == high_contour ) + continue; + + min_y = hints->contour_y_minima[contour]; + max_y = hints->contour_y_maxima[contour]; + + /* We also check that the y minimum of the 'other' contour */ + /* is below the high contour to avoid potential false hits */ + /* with contours enclosed in the high one. */ + distance = high_min_y - max_y; + if ( distance < 64 && + distance < min_distance && + min_y < high_min_y ) + min_distance = distance; + } + + adjustment_amount = 64 - min_distance; + + if ( is_top_tilde || is_below_top_tilde ) + { + tilde_contour = adjust_top + ? high_contour + : ( is_below_top_tilde + ? high_contour + : af_find_highest_contour( hints ) ); + + tilde_min_y = hints->contour_y_minima[tilde_contour]; + tilde_max_y = hints->contour_y_maxima[tilde_contour]; + tilde_height = tilde_max_y - tilde_min_y; + + /* The vertical separation adjustment potentially undoes a */ + /* tilde center alignment. If it would grid-align a tilde */ + /* less than 3 pixels in height, shift additionally to */ + /* re-center the tilde. */ + + pos = high_min_y + adjustment_amount; + if ( adjust_below_top && is_top_tilde ) + pos += high_height; + + if ( pos % 64 == 0 && tilde_height < 3 * 64 ) + { + centering_adjustment = ( FT_PIX_ROUND( tilde_height ) - + tilde_height ) / 2; + + FT_TRACE4(( " Additional tilde centering adjustment: %ld\n", + centering_adjustment )); + } + } + + if ( ( adjust_top && is_top_tilde ) || + ( adjust_below_top && is_below_top_tilde ) ) + calculated_amount = adjustment_amount + centering_adjustment; + else + calculated_amount = adjustment_amount; + + /* allow a delta of 2/64px to handle rounding differences */ + FT_TRACE4(( " Calculated adjustment amount: %ld%s\n", + calculated_amount, + ( calculated_amount < -2 || + ( adjustment_amount > 66 && calculated_amount > 66 ) ) + ? " (out of range [-2;66], not adjusting)" : "" )); + + if ( calculated_amount != 0 && + calculated_amount >= -2 && + ( calculated_amount <= 66 || adjustment_amount <= 66 ) ) + { + /* Value 8 is heuristic. */ + FT_Pos height_delta = high_height / 8; + FT_Pos min_y_limit = high_min_y - height_delta; + + + FT_TRACE4(( " Pushing high contour %ld units up\n", + calculated_amount )); + + /* While we use only a single contour (the 'high' one) for */ + /* computing `adjustment_amount`, we apply it to all contours */ + /* that are (approximately) in the same vertical range or */ + /* higher. This covers, for example, the inner contour of */ + /* the Czech ring accent or the second acute accent in the */ + /* Hungarian double acute accent. */ + af_move_contours_up( hints, min_y_limit, adjustment_amount ); + + if ( adjust_below_top && is_top_tilde ) + { + FT_TRACE4(( " Pushing top tilde %ld units up\n", + centering_adjustment )); + + af_move_contours_up( hints, + min_y_limit + high_height, + centering_adjustment ); + } + } + } + + if ( ( adjust_bottom && hints->num_contours >= 2 ) || + ( adjust_above_bottom && hints->num_contours >= 3 ) ) + { + FT_Int low_contour; + FT_Pos low_min_y; + FT_Pos low_max_y; + FT_Pos low_height; + + FT_Int tilde_contour; + FT_Pos tilde_min_y; + FT_Pos tilde_max_y; + FT_Pos tilde_height; + + FT_Int contour; + FT_Bool horizontal_overlap; + + FT_Pos min_distance = 64; + FT_Pos adjustment_amount; + FT_Pos calculated_amount; + FT_Pos centering_adjustment = 0; + FT_Pos pos; + + FT_Bool is_bottom_tilde = + !!( adj_type & AF_ADJUST_TILDE_BOTTOM ); + FT_Bool is_above_bottom_tilde = + !!( adj_type & AF_ADJUST_TILDE_BOTTOM2 ); + + + FT_TRACE4(( "af_glyph_hints_apply_vertical_separation_adjustments:\n" + " Applying vertical adjustment: %s\n", + adjust_bottom ? "AF_ADJUST_DOWN": "AF_ADJUST_DOWN2" )); + + low_contour = adjust_above_bottom + ? af_find_second_lowest_contour( hints ) + : af_find_lowest_contour( hints ); + + horizontal_overlap = + af_check_contour_horizontal_overlap( hints, low_contour ); + if ( !horizontal_overlap ) + { + FT_TRACE4(( " Low contour does not horizontally overlap" + " with other contours.\n" + " Skipping adjustment.\n" )); + return; + } + + low_min_y = hints->contour_y_minima[low_contour]; + low_max_y = hints->contour_y_maxima[low_contour]; + low_height = low_max_y - low_min_y; + + if ( low_height > accent_height_limit ) + { + FT_TRACE4(( " Low contour height (%.2f) exceeds accent height" + " limit (%.2f).\n" + " Skipping adjustment.\n", + (double)low_height / 64, + (double)accent_height_limit / 64 )); + return; + } + + for ( contour = 0; contour < hints->num_contours; contour++ ) + { + FT_Pos min_y; + FT_Pos max_y; + FT_Pos distance; + + + if ( contour == low_contour ) + continue; + + min_y = hints->contour_y_minima[contour]; + max_y = hints->contour_y_maxima[contour]; + + distance = min_y - low_max_y; + if ( distance < 64 && + distance < min_distance && + max_y > low_max_y ) + min_distance = distance; + } + + adjustment_amount = 64 - min_distance; + + if ( is_bottom_tilde || is_above_bottom_tilde ) + { + tilde_contour = adjust_bottom + ? low_contour + : ( is_above_bottom_tilde + ? low_contour + : af_find_lowest_contour( hints ) ); + + tilde_min_y = hints->contour_y_minima[tilde_contour]; + tilde_max_y = hints->contour_y_maxima[tilde_contour]; + tilde_height = tilde_max_y - tilde_min_y; + + pos = low_max_y - adjustment_amount; + if ( adjust_above_bottom && is_bottom_tilde ) + pos -= low_height; + + if ( pos % 64 == 0 && tilde_height < 3 * 64 ) + { + centering_adjustment = ( FT_PIX_ROUND( tilde_height ) - + tilde_height ) / 2; + + FT_TRACE4(( " Additional tilde centering adjustment: %ld\n", + centering_adjustment )); + } + } + + if ( ( adjust_bottom && is_bottom_tilde ) || + ( adjust_above_bottom && is_above_bottom_tilde ) ) + calculated_amount = adjustment_amount + centering_adjustment; + else + calculated_amount = adjustment_amount; + + FT_TRACE4(( " Calculated adjustment amount: %ld%s\n", + calculated_amount, + ( calculated_amount < -2 || + ( adjustment_amount > 66 && calculated_amount > 66 ) ) + ? " (out of range [-2;66], not adjusting)" : "" )); + + if ( calculated_amount != 0 && + calculated_amount >= -2 && + ( calculated_amount <= 66 || adjustment_amount <= 66 ) ) + { + FT_Pos height_delta = low_height / 8; + FT_Pos max_y_limit = low_max_y + height_delta; + + + FT_TRACE4(( " Pushing low contour %ld units down\n", + calculated_amount )); + + af_move_contours_down( hints, max_y_limit, adjustment_amount ); + + if ( adjust_above_bottom && is_bottom_tilde ) + { + FT_TRACE4(( " Pushing bottom tilde %ld units down\n", + centering_adjustment )); + + af_move_contours_down( hints, + max_y_limit - low_height, + centering_adjustment ); + } + } + } + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( !( ( ( adjust_top || adjust_bottom ) && + hints->num_contours >= 2 ) || + ( ( adjust_below_top || adjust_above_bottom ) && + hints->num_contours >= 3 ) ) ) + FT_TRACE4(( "af_glyph_hints_apply_vertical_separation_adjustments:\n" + " No vertical adjustment applied\n" )); +#endif + + FT_TRACE4(( "Exiting" + " af_glyph_hints_apply_vertical_separation_adjustments\n" )); + } + + +#undef FT_COMPONENT +#define FT_COMPONENT aflatin + + + /* Compute the snapped width of a given stem, ignoring very thin ones. */ + /* There is a lot of voodoo in this function; changing the hard-coded */ + /* parameters influence the whole hinting process. */ + + static FT_Pos + af_latin_compute_stem_width( AF_GlyphHints hints, + AF_Dimension dim, + FT_Pos width, + FT_Pos base_delta, + FT_UInt base_flags, + FT_UInt stem_flags ) + { + AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics; + AF_LatinAxis axis = &metrics->axis[dim]; + FT_Pos dist = width; + FT_Int sign = 0; + FT_Int vertical = ( dim == AF_DIMENSION_VERT ); + + + if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || + axis->extra_light ) + return width; + + if ( dist < 0 ) + { + dist = -width; + sign = 1; + } + + if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || + ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) + { + /* smooth hinting process: very lightly quantize the stem width */ + + /* leave the widths of serifs alone */ + if ( ( stem_flags & AF_EDGE_SERIF ) && + vertical && + ( dist < 3 * 64 ) ) + goto Done_Width; + + else if ( base_flags & AF_EDGE_ROUND ) + { + if ( dist < 80 ) + dist = 64; + } + else if ( dist < 56 ) + dist = 56; + + if ( axis->width_count > 0 ) + { + FT_Pos delta; + + + /* compare to standard width */ + delta = dist - axis->widths[0].cur; + + if ( delta < 0 ) + delta = -delta; + + if ( delta < 40 ) + { + dist = axis->widths[0].cur; + if ( dist < 48 ) + dist = 48; + + goto Done_Width; + } + + if ( dist < 3 * 64 ) + { + delta = dist & 63; + dist &= -64; + + if ( delta < 10 ) + dist += delta; + + else if ( delta < 32 ) + dist += 10; + + else if ( delta < 54 ) + dist += 54; + + else + dist += delta; + } + else + { + /* A stem's end position depends on two values: the start */ + /* position and the stem length. The former gets usually */ + /* rounded to the grid, while the latter gets rounded also if it */ + /* exceeds a certain length (see below in this function). This */ + /* `double rounding' can lead to a great difference to the */ + /* original, unhinted position; this normally doesn't matter for */ + /* large PPEM values, but for small sizes it can easily make */ + /* outlines collide. For this reason, we adjust the stem length */ + /* by a small amount depending on the PPEM value in case the */ + /* former and latter rounding both point into the same */ + /* direction. */ + + FT_Pos bdelta = 0; + + + if ( ( ( width > 0 ) && ( base_delta > 0 ) ) || + ( ( width < 0 ) && ( base_delta < 0 ) ) ) + { + FT_UInt ppem = metrics->root.scaler.face->size->metrics.x_ppem; + + + if ( ppem < 10 ) + bdelta = base_delta; + else if ( ppem < 30 ) + bdelta = ( base_delta * (FT_Pos)( 30 - ppem ) ) / 20; + + if ( bdelta < 0 ) + bdelta = -bdelta; + } + + dist = ( dist - bdelta + 32 ) & ~63; + } + } + } + else + { + /* strong hinting process: snap the stem width to integer pixels */ + + FT_Pos org_dist = dist; + + + dist = af_latin_snap_width( axis->widths, axis->width_count, dist ); + + if ( vertical ) + { + /* in the case of vertical hinting, always round */ + /* the stem heights to integer pixels */ + + if ( dist >= 64 ) + dist = ( dist + 16 ) & ~63; + else + dist = 64; + } + else + { + if ( AF_LATIN_HINTS_DO_MONO( hints ) ) + { + /* monochrome horizontal hinting: snap widths to integer pixels */ + /* with a different threshold */ + + if ( dist < 64 ) + dist = 64; + else + dist = ( dist + 32 ) & ~63; + } + else + { + /* for horizontal anti-aliased hinting, we adopt a more subtle */ + /* approach: we strengthen small stems, round stems whose size */ + /* is between 1 and 2 pixels to an integer, otherwise nothing */ + + if ( dist < 48 ) + dist = ( dist + 64 ) >> 1; + + else if ( dist < 128 ) + { + /* We only round to an integer width if the corresponding */ + /* distortion is less than 1/4 pixel. Otherwise this */ + /* makes everything worse since the diagonals, which are */ + /* not hinted, appear a lot bolder or thinner than the */ + /* vertical stems. */ + + FT_Pos delta; + + + dist = ( dist + 22 ) & ~63; + delta = dist - org_dist; + if ( delta < 0 ) + delta = -delta; + + if ( delta >= 16 ) + { + dist = org_dist; + if ( dist < 48 ) + dist = ( dist + 64 ) >> 1; + } + } + else + /* round otherwise to prevent color fringes in LCD mode */ + dist = ( dist + 32 ) & ~63; + } + } + } + + Done_Width: + if ( sign ) + dist = -dist; + + return dist; + } + + + /* Align one stem edge relative to the previous stem edge. */ + + static void + af_latin_align_linked_edge( AF_GlyphHints hints, + AF_Dimension dim, + AF_Edge base_edge, + AF_Edge stem_edge ) + { + FT_Pos dist, base_delta; + FT_Pos fitted_width; + + + dist = stem_edge->opos - base_edge->opos; + base_delta = base_edge->pos - base_edge->opos; + + fitted_width = af_latin_compute_stem_width( hints, dim, + dist, base_delta, + base_edge->flags, + stem_edge->flags ); + + + stem_edge->pos = base_edge->pos + fitted_width; + + FT_TRACE5(( " LINK: edge %td (opos=%.2f) linked to %.2f," + " dist was %.2f, now %.2f\n", + stem_edge - hints->axis[dim].edges, + (double)stem_edge->opos / 64, (double)stem_edge->pos / 64, + (double)dist / 64, (double)fitted_width / 64 )); + } + + + /* Shift the coordinates of the `serif' edge by the same amount */ + /* as the corresponding `base' edge has been moved already. */ + + static void + af_latin_align_serif_edge( AF_GlyphHints hints, + AF_Edge base, + AF_Edge serif ) + { + FT_UNUSED( hints ); + + serif->pos = base->pos + ( serif->opos - base->opos ); } @@ -2998,13 +4214,15 @@ af_latin_hint_edges( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = &hints->axis[dim]; - AF_Edge edges = axis->edges; - AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges ); - FT_PtrDist n_edges; - AF_Edge edge; - AF_Edge anchor = NULL; - FT_Int has_serifs = 0; + AF_AxisHints axis = &hints->axis[dim]; + + AF_Edge edges = axis->edges; + AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges ); + AF_Edge edge; + FT_PtrDist n_edges; + + AF_Edge anchor = NULL; + FT_Bool has_non_stem_edges = 0; AF_StyleClass style_class = hints->metrics->style_class; AF_ScriptClass script_class = af_script_classes[style_class->script]; @@ -3131,7 +4349,7 @@ edge2 = edge->link; if ( !edge2 ) { - has_serifs++; + has_non_stem_edges = TRUE; continue; } @@ -3408,7 +4626,7 @@ } } - if ( has_serifs || !anchor ) + if ( has_non_stem_edges || !anchor ) { /* * now hint the remaining edges (serifs and single) in order @@ -3426,9 +4644,75 @@ if ( edge->serif ) { + AF_Edge e, top, bottom; + FT_Pos min_pos, max_pos; + + + /* Check whether we have a real serif -- if there are */ + /* other edges with overlapping (or enclosed) segments */ + /* between the primary and serif edge, we have not. */ + /* */ + /* Such a situation might happen if an accent is very */ + /* near to its base glyph (for example, Vietnamese */ + /* uppercase letters with two accents in `arial.ttf`), */ + /* and the segment detection algorithm classifies the */ + /* top of the accent incorrectly as a serif. */ delta = edge->serif->opos - edge->opos; if ( delta < 0 ) + { delta = -delta; + + top = edge; + bottom = edge->serif; + } + else + { + top = edge->serif; + bottom = edge; + } + + if ( delta < 64 + 32 ) + { + /* take care of outline orientation while computing extrema */ + min_pos = FT_MIN( FT_MIN( FT_MIN( top->first->first->v, + top->first->last->v ), + FT_MIN( top->last->first->v, + top->last->last->v ) ), + FT_MIN( FT_MIN( bottom->first->first->v, + bottom->first->last->v ), + FT_MIN( bottom->last->first->v, + bottom->last->last->v ) ) ); + max_pos = FT_MAX( FT_MAX( FT_MAX( top->first->first->v, + top->first->last->v ), + FT_MAX( top->last->first->v, + top->last->last->v ) ), + FT_MAX( FT_MAX( bottom->first->first->v, + bottom->first->last->v ), + FT_MAX( bottom->last->first->v, + bottom->last->last->v ) ) ); + + for ( e = bottom + 1; e < top; e++ ) + { + FT_Pos e_min = FT_MIN( FT_MIN( e->first->first->v, + e->first->last->v ), + FT_MIN( e->last->first->v, + e->last->last->v ) ); + FT_Pos e_max = FT_MAX( FT_MAX( e->first->first->v, + e->first->last->v ), + FT_MAX( e->last->first->v, + e->last->last->v ) ); + + if ( !( ( e_min < min_pos && e_max < min_pos ) || + ( e_min > max_pos && e_max > max_pos ) ) ) + { + delta = 1000; /* not a real serif */ + break; + } + } + + if ( delta == 1000 ) + continue; + } } if ( delta < 64 + 16 ) @@ -3562,6 +4846,8 @@ AF_LatinAxis axis; + FT_Pos accent_height_limit = 0; + error = af_glyph_hints_reload( hints, outline ); if ( error ) @@ -3581,11 +4867,172 @@ if ( AF_HINTS_DO_VERTICAL( hints ) ) { + size_t* val; + + FT_Int top_tilde_contour = 0; + FT_Int bottom_tilde_contour = 0; + + FT_Int below_top_tilde_contour = 0; + FT_Int above_bottom_tilde_contour = 0; + + AF_LatinBlue capital_top_blue = NULL; + AF_LatinBlue capital_bottom_blue = NULL; + + AF_LatinBlue small_top_blue = NULL; + AF_LatinBlue small_bottom_blue = NULL; + + FT_Bool have_flags = FALSE; + + FT_Bool is_top_tilde = FALSE; + FT_Bool is_bottom_tilde = FALSE; + + FT_Bool is_below_top_tilde = FALSE; + FT_Bool is_above_bottom_tilde = FALSE; + + FT_Bool ignore_capital_top = FALSE; + FT_Bool ignore_capital_bottom = FALSE; + + FT_Bool ignore_small_top = FALSE; + FT_Bool ignore_small_bottom = FALSE; + + FT_Bool do_height_check = TRUE; + + FT_Pos limit; + FT_Pos y_offset; + + + val = ft_hash_num_lookup( (FT_Int)glyph_index, + metrics->root.reverse_charmap ); + if ( val ) + { + FT_UInt codepoint = *val; + FT_UInt32 adj_type = af_adjustment_database_lookup( codepoint ); + + + if ( adj_type ) + { + have_flags = !!adj_type; + + is_top_tilde = !!( adj_type & AF_ADJUST_TILDE_TOP ); + is_bottom_tilde = !!( adj_type & AF_ADJUST_TILDE_BOTTOM ); + + is_below_top_tilde = !!( adj_type & AF_ADJUST_TILDE_TOP2 ); + is_above_bottom_tilde = !!( adj_type & AF_ADJUST_TILDE_BOTTOM2 ); + + ignore_capital_top = !!( adj_type & AF_IGNORE_CAPITAL_TOP ); + ignore_capital_bottom = !!( adj_type & AF_IGNORE_CAPITAL_BOTTOM ); + + ignore_small_top = !!( adj_type & AF_IGNORE_SMALL_TOP ); + ignore_small_bottom = !!( adj_type & AF_IGNORE_SMALL_BOTTOM ); + + do_height_check = !( adj_type & AF_ADJUST_NO_HEIGHT_CHECK ); + } + } + + if ( is_top_tilde || is_bottom_tilde || + is_below_top_tilde || is_above_bottom_tilde ) + af_compute_vertical_extrema( hints ); + + /* Process inner tilde glyphs first. */ + if ( is_below_top_tilde ) + { + below_top_tilde_contour = af_find_second_highest_contour( hints ); + + y_offset = af_latin_stretch_top_tilde( + hints, below_top_tilde_contour ); + y_offset += af_latin_align_top_tilde( + hints, below_top_tilde_contour ); + + limit = hints->contour_y_minima[below_top_tilde_contour]; + af_move_contours_up( hints, limit, y_offset ); + } + if ( is_above_bottom_tilde ) + { + above_bottom_tilde_contour = af_find_second_lowest_contour( hints ); + + y_offset = af_latin_stretch_bottom_tilde( + hints, above_bottom_tilde_contour ); + y_offset -= af_latin_align_bottom_tilde( + hints, above_bottom_tilde_contour ); + + limit = hints->contour_y_maxima[above_bottom_tilde_contour]; + af_move_contours_down( hints, limit, y_offset ); + } + + if ( is_top_tilde ) + { + top_tilde_contour = af_find_highest_contour( hints ); + + (void)af_latin_stretch_top_tilde( hints, top_tilde_contour ); + (void)af_latin_align_top_tilde( hints, top_tilde_contour ); + } + if ( is_bottom_tilde ) + { + bottom_tilde_contour = af_find_lowest_contour( hints ); + + (void)af_latin_stretch_bottom_tilde( hints, bottom_tilde_contour ); + (void)af_latin_align_bottom_tilde( hints, bottom_tilde_contour ); + } + axis = &metrics->axis[AF_DIMENSION_VERT]; error = af_latin_hints_detect_features( hints, axis->width_count, axis->widths, AF_DIMENSION_VERT ); + + if ( have_flags ) + { + af_latin_get_base_glyph_blues( hints, + TRUE, + &capital_top_blue, + &capital_bottom_blue ); + af_latin_get_base_glyph_blues( hints, + FALSE, + &small_top_blue, + &small_bottom_blue ); + + if ( do_height_check ) + { + /* Set a heuristic limit for the accent height so that */ + /* `af_glyph_hints_apply_vertical_separation_adjustments` */ + /* can correctly ignore the case where an accent is */ + /* unexpectedly not the highest (or lowest) contour. */ + + /* Either 2/3 of the lowercase blue zone height... */ + if ( small_top_blue && small_bottom_blue ) + accent_height_limit = 2 * ( small_top_blue->shoot.cur - + small_bottom_blue->shoot.cur ) / 3; + /* or 1/2 of the uppercase blue zone height... */ + else if ( capital_top_blue && capital_bottom_blue ) + accent_height_limit = ( capital_top_blue->shoot.cur - + capital_bottom_blue->shoot.cur ) / 2; + /* or half of the standard PostScript ascender value (8/10) */ + /* of the EM value, scaled. */ + else + accent_height_limit = FT_MulFix( metrics->units_per_em * 4 / 10, + metrics->root.scaler.y_scale ); + } + } + + if ( capital_top_blue && capital_bottom_blue ) + { + if ( ignore_capital_top ) + af_latin_ignore_top( hints, + capital_top_blue, capital_bottom_blue ); + if ( ignore_capital_bottom ) + af_latin_ignore_bottom( hints, + capital_top_blue, capital_bottom_blue ); + } + if ( small_top_blue && small_bottom_blue ) + { + if ( ignore_small_top ) + af_latin_ignore_top( hints, + small_top_blue, small_bottom_blue ); + if ( ignore_small_bottom ) + af_latin_ignore_bottom( hints, + small_top_blue, small_bottom_blue ); + } + if ( error ) goto Exit; @@ -3604,6 +5051,12 @@ af_glyph_hints_align_edge_points( hints, (AF_Dimension)dim ); af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim ); af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim ); + af_glyph_hints_apply_vertical_separation_adjustments( + hints, + (AF_Dimension)dim, + glyph_index, + accent_height_limit, + metrics->root.reverse_charmap ); } } @@ -3632,7 +5085,7 @@ (AF_WritingSystem_InitMetricsFunc) af_latin_metrics_init, /* style_metrics_init */ (AF_WritingSystem_ScaleMetricsFunc)af_latin_metrics_scale, /* style_metrics_scale */ - (AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */ + (AF_WritingSystem_DoneMetricsFunc) af_latin_metrics_done, /* style_metrics_done */ (AF_WritingSystem_GetStdWidthsFunc)af_latin_get_standard_widths, /* style_metrics_getstdw */ (AF_WritingSystem_InitHintsFunc) af_latin_hints_init, /* style_hints_init */ diff --git a/modules/freetype2/src/autofit/aflatin.h b/modules/freetype2/src/autofit/aflatin.h @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for latin writing system * (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -61,17 +61,26 @@ FT_BEGIN_HEADER ( (b)->properties & AF_BLUE_PROPERTY_LATIN_X_HEIGHT ) #define AF_LATIN_IS_LONG_BLUE( b ) \ ( (b)->properties & AF_BLUE_PROPERTY_LATIN_LONG ) +#define AF_LATIN_IS_CAPITAL_BOTTOM_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM ) +#define AF_LATIN_IS_SMALL_BOTTOM_BLUE( b ) \ + ( (b)->properties & AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM ) #define AF_LATIN_MAX_WIDTHS 16 -#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */ -#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */ -#define AF_LATIN_BLUE_SUB_TOP ( 1U << 2 ) /* we have a subscript top */ - /* blue zone */ -#define AF_LATIN_BLUE_NEUTRAL ( 1U << 3 ) /* we have neutral blue zone */ -#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 4 ) /* used for scale adjustment */ - /* optimization */ +#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */ +#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */ +#define AF_LATIN_BLUE_SUB_TOP ( 1U << 2 ) /* we have a subscript */ + /* top blue zone */ +#define AF_LATIN_BLUE_NEUTRAL ( 1U << 3 ) /* we have a neutral blue */ + /* zone */ +#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 4 ) /* used for scale adjustm. */ + /* optimization */ +#define AF_LATIN_BLUE_BOTTOM ( 1U << 5 ) /* we have a capital */ + /* letter bottom blue zone */ +#define AF_LATIN_BLUE_BOTTOM_SMALL ( 1U << 6 ) /* we have a small letter */ + /* bottom blue zone */ typedef struct AF_LatinBlueRec_ diff --git a/modules/freetype2/src/autofit/afloader.c b/modules/freetype2/src/autofit/afloader.c @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afloader.h b/modules/freetype2/src/autofit/afloader.h @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afmodule.c b/modules/freetype2/src/autofit/afmodule.c @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -146,7 +146,7 @@ if ( !af_style_classes[ss] ) { - FT_TRACE2(( "af_property_set: Invalid value %d for property `%s'\n", + FT_TRACE2(( "af_property_set: Invalid value %u for property `%s'\n", *fallback_script, property_name )); return FT_THROW( Invalid_Argument ); } @@ -412,6 +412,11 @@ module->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4; module->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4; +#if defined( FT_CONFIG_OPTION_USE_HARFBUZZ ) && \ + defined( FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC ) + ft_hb_funcs_init( module ); +#endif + return FT_Err_Ok; } @@ -421,6 +426,11 @@ { FT_UNUSED( ft_module ); +#if defined( FT_CONFIG_OPTION_USE_HARFBUZZ ) && \ + defined( FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC ) + ft_hb_funcs_done( (AF_Module)ft_module ); +#endif + #ifdef FT_DEBUG_AUTOFIT if ( af_debug_hints_rec_->memory ) af_glyph_hints_done( af_debug_hints_rec_ ); diff --git a/modules/freetype2/src/autofit/afmodule.h b/modules/freetype2/src/autofit/afmodule.h @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (specification). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -22,6 +22,7 @@ #include <freetype/internal/ftobjs.h> #include <freetype/ftmodapi.h> +#include "ft-hb.h" FT_BEGIN_HEADER @@ -40,6 +41,11 @@ FT_BEGIN_HEADER FT_Bool no_stem_darkening; FT_Int darken_params[8]; +#if defined( FT_CONFIG_OPTION_USE_HARFBUZZ ) && \ + defined( FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC ) + ft_hb_funcs_t* hb_funcs; +#endif + } AF_ModuleRec, *AF_Module; diff --git a/modules/freetype2/src/autofit/afranges.c b/modules/freetype2/src/autofit/afranges.c @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (body). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -73,9 +73,11 @@ { AF_UNIRANGE_REC( 0x0600, 0x06FF ), /* Arabic */ AF_UNIRANGE_REC( 0x0750, 0x07FF ), /* Arabic Supplement */ + AF_UNIRANGE_REC( 0x0870, 0x089F ), /* Arabic Extended-B */ AF_UNIRANGE_REC( 0x08A0, 0x08FF ), /* Arabic Extended-A */ AF_UNIRANGE_REC( 0xFB50, 0xFDFF ), /* Arabic Presentation Forms-A */ AF_UNIRANGE_REC( 0xFE70, 0xFEFF ), /* Arabic Presentation Forms-B */ + AF_UNIRANGE_REC( 0x10EC0, 0x10EFF ), /* Arabic Extended-C */ AF_UNIRANGE_REC( 0x1EE00, 0x1EEFF ), /* Arabic Mathematical Alphabetic Symbols */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -90,8 +92,9 @@ AF_UNIRANGE_REC( 0x06DF, 0x06E4 ), AF_UNIRANGE_REC( 0x06E7, 0x06E8 ), AF_UNIRANGE_REC( 0x06EA, 0x06ED ), - AF_UNIRANGE_REC( 0x08D4, 0x08E1 ), - AF_UNIRANGE_REC( 0x08D3, 0x08FF ), + AF_UNIRANGE_REC( 0x0897, 0x089F ), + AF_UNIRANGE_REC( 0x08CA, 0x08E1 ), + AF_UNIRANGE_REC( 0x08E3, 0x08FF ), AF_UNIRANGE_REC( 0xFBB2, 0xFBC1 ), AF_UNIRANGE_REC( 0xFE70, 0xFE70 ), AF_UNIRANGE_REC( 0xFE72, 0xFE72 ), @@ -101,6 +104,7 @@ AF_UNIRANGE_REC( 0xFE7A, 0xFE7A ), AF_UNIRANGE_REC( 0xFE7C, 0xFE7C ), AF_UNIRANGE_REC( 0xFE7E, 0xFE7E ), + AF_UNIRANGE_REC( 0x10EFD, 0x10EFF ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -198,8 +202,9 @@ const AF_Script_UniRangeRec af_cans_uniranges[] = { - AF_UNIRANGE_REC( 0x1400, 0x167F ), /* Unified Canadian Aboriginal Syllabics */ - AF_UNIRANGE_REC( 0x18B0, 0x18FF ), /* Unified Canadian Aboriginal Syllabics Extended */ + AF_UNIRANGE_REC( 0x1400, 0x167F ), /* Unified Canadian Aboriginal Syllabics */ + AF_UNIRANGE_REC( 0x18B0, 0x18FF ), /* Unified Canadian Aboriginal Syllabics Extended */ + AF_UNIRANGE_REC( 0x11AB0, 0x11ABF ), /* Unified Canadian Aboriginal Syllabics Extended-A */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -259,6 +264,9 @@ }; + /* TODO: Split off data for new 'cyrb' (subscript) and 'cyrp' */ + /* (superscript) groups (mainly from the Extended-D block), */ + /* in analogy to 'latb' and 'latp'? */ const AF_Script_UniRangeRec af_cyrl_uniranges[] = { AF_UNIRANGE_REC( 0x0400, 0x04FF ), /* Cyrillic */ @@ -266,6 +274,7 @@ AF_UNIRANGE_REC( 0x2DE0, 0x2DFF ), /* Cyrillic Extended-A */ AF_UNIRANGE_REC( 0xA640, 0xA69F ), /* Cyrillic Extended-B */ AF_UNIRANGE_REC( 0x1C80, 0x1C8F ), /* Cyrillic Extended-C */ + AF_UNIRANGE_REC( 0x1E030, 0x1E08F ), /* Cyrillic Extended-D */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -285,15 +294,16 @@ const AF_Script_UniRangeRec af_deva_uniranges[] = { - AF_UNIRANGE_REC( 0x0900, 0x093B ), /* Devanagari */ + AF_UNIRANGE_REC( 0x0900, 0x093B ), /* Devanagari */ /* omitting U+093C nukta */ - AF_UNIRANGE_REC( 0x093D, 0x0950 ), /* ... continued */ + AF_UNIRANGE_REC( 0x093D, 0x0950 ), /* ... continued */ /* omitting U+0951 udatta, U+0952 anudatta */ - AF_UNIRANGE_REC( 0x0953, 0x0963 ), /* ... continued */ + AF_UNIRANGE_REC( 0x0953, 0x0963 ), /* ... continued */ /* omitting U+0964 danda, U+0965 double danda */ - AF_UNIRANGE_REC( 0x0966, 0x097F ), /* ... continued */ - AF_UNIRANGE_REC( 0x20B9, 0x20B9 ), /* (new) Rupee sign */ - AF_UNIRANGE_REC( 0xA8E0, 0xA8FF ), /* Devanagari Extended */ + AF_UNIRANGE_REC( 0x0966, 0x097F ), /* ... continued */ + AF_UNIRANGE_REC( 0x20B9, 0x20B9 ), /* (new) Rupee sign */ + AF_UNIRANGE_REC( 0xA8E0, 0xA8FF ), /* Devanagari Extended */ + AF_UNIRANGE_REC( 0x11B00, 0x11B5F ), /* Devanagari Extended-A */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -329,6 +339,7 @@ AF_UNIRANGE_REC( 0x1380, 0x139F ), /* Ethiopic Supplement */ AF_UNIRANGE_REC( 0x2D80, 0x2DDF ), /* Ethiopic Extended */ AF_UNIRANGE_REC( 0xAB00, 0xAB2F ), /* Ethiopic Extended-A */ + AF_UNIRANGE_REC( 0x1E7E0, 0x1E7FF ), /* Ethiopic Extended-B */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -534,7 +545,7 @@ { AF_UNIRANGE_REC( 0x0EB1, 0x0EB1 ), AF_UNIRANGE_REC( 0x0EB4, 0x0EBC ), - AF_UNIRANGE_REC( 0x0EC8, 0x0ECD ), + AF_UNIRANGE_REC( 0x0EC8, 0x0ECE ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -567,12 +578,15 @@ AF_UNIRANGE_REC( 0x2C7E, 0x2C7F ), /* ... continued */ AF_UNIRANGE_REC( 0x2E00, 0x2E7F ), /* Supplemental Punctuation */ AF_UNIRANGE_REC( 0xA720, 0xA76F ), /* Latin Extended-D */ - AF_UNIRANGE_REC( 0xA771, 0xA7F7 ), /* ... continued */ + AF_UNIRANGE_REC( 0xA771, 0xA7F0 ), /* ... continued */ + AF_UNIRANGE_REC( 0xA7F2, 0xA7F7 ), /* ... continued */ AF_UNIRANGE_REC( 0xA7FA, 0xA7FF ), /* ... continued */ AF_UNIRANGE_REC( 0xAB30, 0xAB5B ), /* Latin Extended-E */ - AF_UNIRANGE_REC( 0xAB60, 0xAB6F ), /* ... continued */ + AF_UNIRANGE_REC( 0xAB60, 0xAB68 ), /* ... continued */ + AF_UNIRANGE_REC( 0xAB6A, 0xAB6F ), /* ... continued */ AF_UNIRANGE_REC( 0xFB00, 0xFB06 ), /* Alphab. Present. Forms (Latin Ligs) */ AF_UNIRANGE_REC( 0x1D400, 0x1D7FF ), /* Mathematical Alphanumeric Symbols */ + AF_UNIRANGE_REC( 0x1DF00, 0x1DFFF ), /* Latin Extended-G */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -588,7 +602,7 @@ AF_UNIRANGE_REC( 0x02B9, 0x02DF ), AF_UNIRANGE_REC( 0x02E5, 0x02FF ), AF_UNIRANGE_REC( 0x0300, 0x036F ), - AF_UNIRANGE_REC( 0x1AB0, 0x1ABE ), + AF_UNIRANGE_REC( 0x1AB0, 0x1AEB ), AF_UNIRANGE_REC( 0x1DC0, 0x1DFF ), AF_UNIRANGE_REC( 0x2017, 0x2017 ), AF_UNIRANGE_REC( 0x203E, 0x203E ), @@ -625,8 +639,11 @@ AF_UNIRANGE_REC( 0x2070, 0x207F ), /* superscript digits and letters */ AF_UNIRANGE_REC( 0x2C7D, 0x2C7D ), /* modifier letter capital v */ AF_UNIRANGE_REC( 0xA770, 0xA770 ), /* modifier letter us */ + AF_UNIRANGE_REC( 0xA7F1, 0xA7F1 ), /* modifier letter capital s */ AF_UNIRANGE_REC( 0xA7F8, 0xA7F9 ), /* more modifier letters */ AF_UNIRANGE_REC( 0xAB5C, 0xAB5F ), /* more modifier letters */ + AF_UNIRANGE_REC( 0xAB69, 0xAB69 ), /* modifier letter small turned w */ + AF_UNIRANGE_REC( 0x10780, 0x107FB ), /* Latin Extended-F */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -638,7 +655,8 @@ const AF_Script_UniRangeRec af_lisu_uniranges[] = { - AF_UNIRANGE_REC( 0xA4D0, 0xA4FF ), /* Lisu */ + AF_UNIRANGE_REC( 0xA4D0, 0xA4FF ), /* Lisu */ + AF_UNIRANGE_REC( 0x11FB0, 0x11FBF ), /* Lisu Supplement */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -696,6 +714,7 @@ AF_UNIRANGE_REC( 0x1000, 0x109F ), /* Myanmar */ AF_UNIRANGE_REC( 0xA9E0, 0xA9FF ), /* Myanmar Extended-B */ AF_UNIRANGE_REC( 0xAA60, 0xAA7F ), /* Myanmar Extended-A */ + AF_UNIRANGE_REC( 0x116D0, 0x116FF ), /* Myanmar Extended-C */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -836,6 +855,7 @@ const AF_Script_UniRangeRec af_sinh_nonbase_uniranges[] = { + AF_UNIRANGE_REC( 0x0D81, 0x0D81 ), AF_UNIRANGE_REC( 0x0DCA, 0x0DCA ), AF_UNIRANGE_REC( 0x0DD2, 0x0DD6 ), AF_UNIRANGE_REC( 0, 0 ) @@ -859,7 +879,8 @@ const AF_Script_UniRangeRec af_taml_uniranges[] = { - AF_UNIRANGE_REC( 0x0B80, 0x0BFF ), /* Tamil */ + AF_UNIRANGE_REC( 0x0B80, 0x0BFF ), /* Tamil */ + AF_UNIRANGE_REC( 0x11FC0, 0x11FFF ), /* Tamil Supplement */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -899,6 +920,7 @@ { AF_UNIRANGE_REC( 0x0C00, 0x0C00 ), AF_UNIRANGE_REC( 0x0C04, 0x0C04 ), + AF_UNIRANGE_REC( 0x0C3C, 0x0C3C ), AF_UNIRANGE_REC( 0x0C3E, 0x0C40 ), AF_UNIRANGE_REC( 0x0C46, 0x0C56 ), AF_UNIRANGE_REC( 0x0C62, 0x0C63 ), @@ -992,6 +1014,7 @@ AF_UNIRANGE_REC( 0xA806, 0xA806 ), AF_UNIRANGE_REC( 0xA80B, 0xA80B ), AF_UNIRANGE_REC( 0xA825, 0xA826 ), + AF_UNIRANGE_REC( 0xA82C, 0xA82C ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -1048,15 +1071,21 @@ AF_UNIRANGE_REC( 0xFE10, 0xFE1F ), /* Vertical forms */ AF_UNIRANGE_REC( 0xFE30, 0xFE4F ), /* CJK Compatibility Forms */ AF_UNIRANGE_REC( 0xFF00, 0xFFEF ), /* Halfwidth and Fullwidth Forms */ + AF_UNIRANGE_REC( 0x1AFF0, 0x1AFFF ), /* Kana Extended-B */ AF_UNIRANGE_REC( 0x1B000, 0x1B0FF ), /* Kana Supplement */ AF_UNIRANGE_REC( 0x1B100, 0x1B12F ), /* Kana Extended-A */ + AF_UNIRANGE_REC( 0x1B130, 0x1B16F ), /* Small Kana Extension */ AF_UNIRANGE_REC( 0x1D300, 0x1D35F ), /* Tai Xuan Hing Symbols */ AF_UNIRANGE_REC( 0x20000, 0x2A6DF ), /* CJK Unified Ideographs Extension B */ AF_UNIRANGE_REC( 0x2A700, 0x2B73F ), /* CJK Unified Ideographs Extension C */ AF_UNIRANGE_REC( 0x2B740, 0x2B81F ), /* CJK Unified Ideographs Extension D */ AF_UNIRANGE_REC( 0x2B820, 0x2CEAF ), /* CJK Unified Ideographs Extension E */ AF_UNIRANGE_REC( 0x2CEB0, 0x2EBEF ), /* CJK Unified Ideographs Extension F */ + AF_UNIRANGE_REC( 0x2EBF0, 0x2EE5D ), /* CJK Unified Ideographs Extension I */ AF_UNIRANGE_REC( 0x2F800, 0x2FA1F ), /* CJK Compatibility Ideographs Supplement */ + AF_UNIRANGE_REC( 0x30000, 0x3134A ), /* CJK Unified Ideographs Extension G */ + AF_UNIRANGE_REC( 0x31350, 0x323AF ), /* CJK Unified Ideographs Extension H */ + AF_UNIRANGE_REC( 0x323B0, 0x33479 ), /* CJK Unified Ideographs Extension J */ AF_UNIRANGE_REC( 0, 0 ) }; diff --git a/modules/freetype2/src/autofit/afranges.h b/modules/freetype2/src/autofit/afranges.h @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (specification). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afscript.h b/modules/freetype2/src/autofit/afscript.h @@ -4,7 +4,7 @@ * * Auto-fitter scripts (specification only). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afshaper.c b/modules/freetype2/src/autofit/afshaper.c @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (body). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -22,8 +22,8 @@ #include "aftypes.h" #include "afshaper.h" -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ /************************************************************************** * @@ -89,17 +89,18 @@ #define SCRIPT( s, S, d, h, H, ss ) h, - static const hb_script_t scripts[] = + FT_LOCAL_ARRAY_DEF( hb_script_t ) + af_hb_scripts[] = { #include "afscript.h" }; - FT_Error - af_shaper_get_coverage( AF_FaceGlobals globals, - AF_StyleClass style_class, - FT_UShort* gstyles, - FT_Bool default_script ) + static FT_Error + af_shaper_get_coverage_hb( AF_FaceGlobals globals, + AF_StyleClass style_class, + FT_UShort* gstyles, + FT_Bool default_script ) { hb_face_t* face; @@ -124,10 +125,10 @@ if ( !globals || !style_class || !gstyles ) return FT_THROW( Invalid_Argument ); - face = hb_font_get_face( globals->hb_font ); + face = hb( font_get_face )( globals->hb_font ); coverage_tags = coverages[style_class->coverage]; - script = scripts[style_class->script]; + script = af_hb_scripts[style_class->script]; /* Convert a HarfBuzz script tag into the corresponding OpenType */ /* tag or tags -- some Indic scripts like Devanagari have an old */ @@ -137,19 +138,19 @@ hb_tag_t tags[3]; - hb_ot_tags_from_script_and_language( script, - HB_LANGUAGE_INVALID, - &tags_count, - tags, - NULL, - NULL ); + hb( ot_tags_from_script_and_language )( script, + HB_LANGUAGE_INVALID, + &tags_count, + tags, + NULL, + NULL ); script_tags[0] = tags_count > 0 ? tags[0] : HB_TAG_NONE; script_tags[1] = tags_count > 1 ? tags[1] : HB_TAG_NONE; script_tags[2] = tags_count > 2 ? tags[2] : HB_TAG_NONE; } - /* If the second tag is HB_OT_TAG_DEFAULT_SCRIPT, change that to */ - /* HB_TAG_NONE except for the default script. */ + /* If the second tag is HB_OT_TAG_DEFAULT_SCRIPT, change that to */ + /* HB_TAG_NONE except for the default script. */ if ( default_script ) { if ( script_tags[0] == HB_TAG_NONE ) @@ -170,15 +171,15 @@ goto Exit; } - gsub_lookups = hb_set_create(); - hb_ot_layout_collect_lookups( face, - HB_OT_TAG_GSUB, - script_tags, - NULL, - coverage_tags, - gsub_lookups ); + gsub_lookups = hb( set_create )(); + hb( ot_layout_collect_lookups )( face, + HB_OT_TAG_GSUB, + script_tags, + NULL, + coverage_tags, + gsub_lookups ); - if ( hb_set_is_empty( gsub_lookups ) ) + if ( hb( set_is_empty )( gsub_lookups ) ) goto Exit; /* nothing to do */ FT_TRACE4(( "GSUB lookups (style `%s'):\n", @@ -189,22 +190,22 @@ count = 0; #endif - gsub_glyphs = hb_set_create(); - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); ) + gsub_glyphs = hb( set_create )(); + for ( idx = HB_SET_VALUE_INVALID; hb( set_next )( gsub_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE4(( " %d", idx )); + FT_TRACE4(( " %u", idx )); count++; #endif /* get output coverage of GSUB feature */ - hb_ot_layout_lookup_collect_glyphs( face, - HB_OT_TAG_GSUB, - idx, - NULL, - NULL, - NULL, - gsub_glyphs ); + hb( ot_layout_lookup_collect_glyphs )( face, + HB_OT_TAG_GSUB, + idx, + NULL, + NULL, + NULL, + gsub_glyphs ); } #ifdef FT_DEBUG_LEVEL_TRACE @@ -218,34 +219,34 @@ af_style_names[style_class->style] )); FT_TRACE4(( " " )); - gpos_lookups = hb_set_create(); - hb_ot_layout_collect_lookups( face, - HB_OT_TAG_GPOS, - script_tags, - NULL, - coverage_tags, - gpos_lookups ); + gpos_lookups = hb( set_create )(); + hb( ot_layout_collect_lookups )( face, + HB_OT_TAG_GPOS, + script_tags, + NULL, + coverage_tags, + gpos_lookups ); #ifdef FT_DEBUG_LEVEL_TRACE count = 0; #endif - gpos_glyphs = hb_set_create(); - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); ) + gpos_glyphs = hb( set_create )(); + for ( idx = HB_SET_VALUE_INVALID; hb( set_next )( gpos_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE4(( " %d", idx )); + FT_TRACE4(( " %u", idx )); count++; #endif /* get input coverage of GPOS feature */ - hb_ot_layout_lookup_collect_glyphs( face, - HB_OT_TAG_GPOS, - idx, - NULL, - gpos_glyphs, - NULL, - NULL ); + hb( ot_layout_lookup_collect_glyphs )( face, + HB_OT_TAG_GPOS, + idx, + NULL, + gpos_glyphs, + NULL, + NULL ); } #ifdef FT_DEBUG_LEVEL_TRACE @@ -281,14 +282,14 @@ GET_UTF8_CHAR( ch, p ); - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, - &idx ); ) + for ( idx = HB_SET_VALUE_INVALID; hb( set_next )( gsub_lookups, + &idx ); ) { hb_codepoint_t gidx = FT_Get_Char_Index( globals->face, ch ); - if ( hb_ot_layout_lookup_would_substitute( face, idx, - &gidx, 1, 1 ) ) + if ( hb( ot_layout_lookup_would_substitute )( face, idx, + &gidx, 1, 1 ) ) { found = 1; break; @@ -352,14 +353,14 @@ * */ if ( style_class->coverage != AF_COVERAGE_DEFAULT ) - hb_set_subtract( gsub_glyphs, gpos_glyphs ); + hb( set_subtract )( gsub_glyphs, gpos_glyphs ); #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE4(( " glyphs without GPOS data (`*' means already assigned)" )); count = 0; #endif - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_glyphs, &idx ); ) + for ( idx = HB_SET_VALUE_INVALID; hb( set_next )( gsub_glyphs, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE if ( !( count % 10 ) ) @@ -368,7 +369,7 @@ FT_TRACE4(( " " )); } - FT_TRACE4(( " %d", idx )); + FT_TRACE4(( " %u", idx )); count++; #endif @@ -397,10 +398,10 @@ #endif Exit: - hb_set_destroy( gsub_lookups ); - hb_set_destroy( gsub_glyphs ); - hb_set_destroy( gpos_lookups ); - hb_set_destroy( gpos_glyphs ); + hb( set_destroy )( gsub_lookups ); + hb( set_destroy )( gsub_glyphs ); + hb( set_destroy )( gpos_lookups ); + hb( set_destroy )( gpos_glyphs ); return FT_Err_Ok; } @@ -437,31 +438,33 @@ }; - void* - af_shaper_buf_create( FT_Face face ) + static void* + af_shaper_buf_create_hb( AF_FaceGlobals globals ) { - FT_UNUSED( face ); + FT_UNUSED( globals ); - return (void*)hb_buffer_create(); + return (void*)hb( buffer_create )(); } - void - af_shaper_buf_destroy( FT_Face face, - void* buf ) + static void + af_shaper_buf_destroy_hb( AF_FaceGlobals globals, + void* buf ) { - FT_UNUSED( face ); + FT_UNUSED( globals ); - hb_buffer_destroy( (hb_buffer_t*)buf ); + hb( buffer_destroy )( (hb_buffer_t*)buf ); } - const char* - af_shaper_get_cluster( const char* p, - AF_StyleMetrics metrics, - void* buf_, - unsigned int* count ) + static const char* + af_shaper_get_cluster_hb( const char* p, + AF_StyleMetrics metrics, + void* buf_, + unsigned int* count ) { + AF_FaceGlobals globals = metrics->globals; + AF_StyleClass style_class; const hb_feature_t* feature; FT_Int upem; @@ -472,6 +475,8 @@ hb_font_t* font; hb_codepoint_t dummy; + FT_UNUSED( globals ); + upem = (FT_Int)metrics->globals->face->units_per_EM; style_class = metrics->style_class; @@ -480,7 +485,7 @@ font = metrics->globals->hb_font; /* we shape at a size of units per EM; this means font units */ - hb_font_set_scale( font, upem, upem ); + hb( font_set_scale )( font, upem, upem ); while ( *p == ' ' ) p++; @@ -492,15 +497,15 @@ len = (int)( q - p ); /* feed character(s) to the HarfBuzz buffer */ - hb_buffer_clear_contents( buf ); - hb_buffer_add_utf8( buf, p, len, 0, len ); + hb( buffer_clear_contents )( buf ); + hb( buffer_add_utf8 )( buf, p, len, 0, len ); /* we let HarfBuzz guess the script and writing direction */ - hb_buffer_guess_segment_properties( buf ); + hb( buffer_guess_segment_properties )( buf ); /* shape buffer, which means conversion from character codes to */ /* glyph indices, possibly applying a feature */ - hb_shape( font, buf, feature, feature ? 1 : 0 ); + hb( shape )( font, buf, feature, feature ? 1 : 0 ); if ( feature ) { @@ -517,13 +522,13 @@ /* glyph indices; otherwise the affected glyph or glyphs aren't */ /* available at all in the feature */ - hb_buffer_clear_contents( hb_buf ); - hb_buffer_add_utf8( hb_buf, p, len, 0, len ); - hb_buffer_guess_segment_properties( hb_buf ); - hb_shape( font, hb_buf, NULL, 0 ); + hb( buffer_clear_contents )( hb_buf ); + hb( buffer_add_utf8 )( hb_buf, p, len, 0, len ); + hb( buffer_guess_segment_properties )( hb_buf ); + hb( shape )( font, hb_buf, NULL, 0 ); - ginfo = hb_buffer_get_glyph_infos( buf, &gcount ); - hb_ginfo = hb_buffer_get_glyph_infos( hb_buf, &hb_gcount ); + ginfo = hb( buffer_get_glyph_infos )( buf, &gcount ); + hb_ginfo = hb( buffer_get_glyph_infos )( hb_buf, &hb_gcount ); if ( gcount == hb_gcount ) { @@ -537,12 +542,12 @@ if ( i == gcount ) { /* both buffers have identical glyph indices */ - hb_buffer_clear_contents( buf ); + hb( buffer_clear_contents )( buf ); } } } - *count = hb_buffer_get_length( buf ); + *count = hb( buffer_get_length )( buf ); #ifdef FT_DEBUG_LEVEL_TRACE if ( feature && *count > 1 ) @@ -554,23 +559,25 @@ } - FT_ULong - af_shaper_get_elem( AF_StyleMetrics metrics, - void* buf_, - unsigned int idx, - FT_Long* advance, - FT_Long* y_offset ) + static FT_ULong + af_shaper_get_elem_hb( AF_StyleMetrics metrics, + void* buf_, + unsigned int idx, + FT_Long* advance, + FT_Long* y_offset ) { + AF_FaceGlobals globals = metrics->globals; + hb_buffer_t* buf = (hb_buffer_t*)buf_; hb_glyph_info_t* ginfo; hb_glyph_position_t* gpos; unsigned int gcount; - FT_UNUSED( metrics ); + FT_UNUSED( globals ); - ginfo = hb_buffer_get_glyph_infos( buf, &gcount ); - gpos = hb_buffer_get_glyph_positions( buf, &gcount ); + ginfo = hb( buffer_get_glyph_infos )( buf, &gcount ); + gpos = hb( buffer_get_glyph_positions )( buf, &gcount ); if ( idx >= gcount ) return 0; @@ -584,14 +591,14 @@ } -#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ +#endif /* FT_CONFIG_OPTION_USE_HARFBUZZ */ - FT_Error - af_shaper_get_coverage( AF_FaceGlobals globals, - AF_StyleClass style_class, - FT_UShort* gstyles, - FT_Bool default_script ) + static FT_Error + af_shaper_get_coverage_nohb( AF_FaceGlobals globals, + AF_StyleClass style_class, + FT_UShort* gstyles, + FT_Bool default_script ) { FT_UNUSED( globals ); FT_UNUSED( style_class ); @@ -602,29 +609,29 @@ } - void* - af_shaper_buf_create( FT_Face face ) + static void* + af_shaper_buf_create_nohb( AF_FaceGlobals globals ) { - FT_UNUSED( face ); + FT_UNUSED( globals ); return NULL; } - void - af_shaper_buf_destroy( FT_Face face, - void* buf ) + static void + af_shaper_buf_destroy_nohb( AF_FaceGlobals globals, + void* buf ) { - FT_UNUSED( face ); + FT_UNUSED( globals ); FT_UNUSED( buf ); } - const char* - af_shaper_get_cluster( const char* p, - AF_StyleMetrics metrics, - void* buf_, - unsigned int* count ) + static const char* + af_shaper_get_cluster_nohb( const char* p, + AF_StyleMetrics metrics, + void* buf_, + unsigned int* count ) { FT_Face face = metrics->globals->face; FT_ULong ch, dummy = 0; @@ -656,12 +663,12 @@ } - FT_ULong - af_shaper_get_elem( AF_StyleMetrics metrics, - void* buf_, - unsigned int idx, - FT_Long* advance, - FT_Long* y_offset ) + static FT_ULong + af_shaper_get_elem_nohb( AF_StyleMetrics metrics, + void* buf_, + unsigned int idx, + FT_Long* advance, + FT_Long* y_offset ) { FT_Face face = metrics->globals->face; FT_ULong glyph_index = *(FT_ULong*)buf_; @@ -684,7 +691,90 @@ } -#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ + /********************************************************************/ + + FT_Error + af_shaper_get_coverage( AF_FaceGlobals globals, + AF_StyleClass style_class, + FT_UShort* gstyles, + FT_Bool default_script ) + { +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + if ( ft_hb_enabled( globals ) ) + return af_shaper_get_coverage_hb( globals, + style_class, + gstyles, + default_script ); + else +#endif + return af_shaper_get_coverage_nohb( globals, + style_class, + gstyles, + default_script ); + } + + + void* + af_shaper_buf_create( AF_FaceGlobals globals ) + { +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + if ( ft_hb_enabled( globals ) ) + return af_shaper_buf_create_hb( globals ); + else +#endif + return af_shaper_buf_create_nohb( globals ); + } + + + void + af_shaper_buf_destroy( AF_FaceGlobals globals, + void* buf ) + { +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + if ( ft_hb_enabled( globals ) ) + af_shaper_buf_destroy_hb( globals, buf ); + else +#endif + af_shaper_buf_destroy_nohb( globals, buf ); + } + + + const char* + af_shaper_get_cluster( const char* p, + AF_StyleMetrics metrics, + void* buf_, + unsigned int* count ) + { +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + if ( ft_hb_enabled( metrics->globals ) ) + return af_shaper_get_cluster_hb( p, metrics, buf_, count ); + else +#endif + return af_shaper_get_cluster_nohb( p, metrics, buf_, count ); + } + + + FT_ULong + af_shaper_get_elem( AF_StyleMetrics metrics, + void* buf_, + unsigned int idx, + FT_Long* advance, + FT_Long* y_offset ) + { +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + if ( ft_hb_enabled( metrics->globals ) ) + return af_shaper_get_elem_hb( metrics, + buf_, + idx, + advance, + y_offset ); +#endif + return af_shaper_get_elem_nohb( metrics, + buf_, + idx, + advance, + y_offset ); + } /* END */ diff --git a/modules/freetype2/src/autofit/afshaper.h b/modules/freetype2/src/autofit/afshaper.h @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (specification). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -23,17 +23,14 @@ #include <freetype/freetype.h> -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - -#include <hb.h> -#include <hb-ot.h> -#include "ft-hb.h" +FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + FT_LOCAL_ARRAY( hb_script_t ) + af_hb_scripts[]; #endif -FT_BEGIN_HEADER - FT_Error af_shaper_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, @@ -42,11 +39,11 @@ FT_BEGIN_HEADER void* - af_shaper_buf_create( FT_Face face ); + af_shaper_buf_create( AF_FaceGlobals globals ); void - af_shaper_buf_destroy( FT_Face face, - void* buf ); + af_shaper_buf_destroy( AF_FaceGlobals globals, + void* buf ); const char* af_shaper_get_cluster( const char* p, diff --git a/modules/freetype2/src/autofit/afstyles.h b/modules/freetype2/src/autofit/afstyles.h @@ -4,7 +4,7 @@ * * Auto-fitter styles (specification only). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -50,36 +50,36 @@ AF_COVERAGE_ ## C ) #undef META_STYLE_LATIN -#define META_STYLE_LATIN( s, S, ds ) \ - STYLE_LATIN( s, S, c2cp, C2CP, ds, \ +#define META_STYLE_LATIN( s, S, ds ) \ + STYLE_LATIN( s, S, c2cp, C2CP, ds, \ "petite capitals from capitals", \ - PETITE_CAPITALS_FROM_CAPITALS ) \ - STYLE_LATIN( s, S, c2sc, C2SC, ds, \ + PETITE_CAPITALS_FROM_CAPITALS ) \ + STYLE_LATIN( s, S, c2sc, C2SC, ds, \ "small capitals from capitals", \ - SMALL_CAPITALS_FROM_CAPITALS ) \ - STYLE_LATIN( s, S, ordn, ORDN, ds, \ - "ordinals", \ - ORDINALS ) \ - STYLE_LATIN( s, S, pcap, PCAP, ds, \ - "petite capitals", \ - PETITE_CAPITALS ) \ - STYLE_LATIN( s, S, sinf, SINF, ds, \ - "scientific inferiors", \ - SCIENTIFIC_INFERIORS ) \ - STYLE_LATIN( s, S, smcp, SMCP, ds, \ - "small capitals", \ - SMALL_CAPITALS ) \ - STYLE_LATIN( s, S, subs, SUBS, ds, \ - "subscript", \ - SUBSCRIPT ) \ - STYLE_LATIN( s, S, sups, SUPS, ds, \ - "superscript", \ - SUPERSCRIPT ) \ - STYLE_LATIN( s, S, titl, TITL, ds, \ - "titling", \ - TITLING ) \ - STYLE_LATIN( s, S, dflt, DFLT, ds, \ - "default", \ + SMALL_CAPITALS_FROM_CAPITALS ) \ + STYLE_LATIN( s, S, ordn, ORDN, ds, \ + "ordinals", \ + ORDINALS ) \ + STYLE_LATIN( s, S, pcap, PCAP, ds, \ + "petite capitals", \ + PETITE_CAPITALS ) \ + STYLE_LATIN( s, S, sinf, SINF, ds, \ + "scientific inferiors", \ + SCIENTIFIC_INFERIORS ) \ + STYLE_LATIN( s, S, smcp, SMCP, ds, \ + "small capitals", \ + SMALL_CAPITALS ) \ + STYLE_LATIN( s, S, subs, SUBS, ds, \ + "subscript", \ + SUBSCRIPT ) \ + STYLE_LATIN( s, S, sups, SUPS, ds, \ + "superscript", \ + SUPERSCRIPT ) \ + STYLE_LATIN( s, S, titl, TITL, ds, \ + "titling", \ + TITLING ) \ + STYLE_LATIN( s, S, dflt, DFLT, ds, \ + "default", \ DEFAULT ) diff --git a/modules/freetype2/src/autofit/aftypes.h b/modules/freetype2/src/autofit/aftypes.h @@ -4,7 +4,7 @@ * * Auto-fitter types (specification only). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -35,6 +35,7 @@ #include <freetype/freetype.h> #include <freetype/ftoutln.h> +#include <freetype/internal/fthash.h> #include <freetype/internal/ftobjs.h> #include <freetype/internal/ftdebug.h> @@ -406,6 +407,7 @@ extern void* af_debug_hints_; typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; + /* This is the main structure that combines everything. Autofit modules */ /* specific to writing systems derive their structures from it, for */ /* example `AF_LatinMetrics'. */ @@ -418,6 +420,8 @@ extern void* af_debug_hints_; AF_FaceGlobals globals; /* to access properties */ + FT_Hash reverse_charmap; + } AF_StyleMetricsRec; diff --git a/modules/freetype2/src/autofit/afws-decl.h b/modules/freetype2/src/autofit/afws-decl.h @@ -4,7 +4,7 @@ * * Auto-fitter writing system declarations (specification only). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/afws-iter.h b/modules/freetype2/src/autofit/afws-iter.h @@ -4,7 +4,7 @@ * * Auto-fitter writing systems iterator (specification only). * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/autofit/autofit.c b/modules/freetype2/src/autofit/autofit.c @@ -4,7 +4,7 @@ * * Auto-fitter module (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,10 +19,13 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include "ft-hb.c" +#include "ft-hb-ft.c" +#include "afadjust.c" #include "afblue.c" #include "afcjk.c" #include "afdummy.c" #include "afglobal.c" +#include "afgsub.c" #include "afhints.c" #include "afindic.c" #include "aflatin.c" diff --git a/modules/freetype2/src/autofit/ft-hb-decls.h b/modules/freetype2/src/autofit/ft-hb-decls.h @@ -0,0 +1,203 @@ +/* + * Copyright © 2009, 2023 Red Hat, Inc. + * Copyright © 2015 Google, Inc. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod, Matthias Clasen + * Google Author(s): Behdad Esfahbod + */ + + + /* All HarfBuzz function declarations used by FreeType, taken */ + /* from various public HarfBuzz header files. The wrapper macro */ + /* `HB_EXTERN` is defined in `ft-hb.h`. */ + + +/* hb-blob.h */ + +HB_EXTERN(hb_blob_t *, +hb_blob_create,(const char *data, + unsigned int length, + hb_memory_mode_t mode, + void *user_data, + hb_destroy_func_t destroy)) + +HB_EXTERN(void, +hb_blob_destroy,(hb_blob_t *blob)) + + +/* hb-buffer.h */ + +HB_EXTERN(void, +hb_buffer_add_utf8,(hb_buffer_t *buffer, + const char *text, + int text_length, + unsigned int item_offset, + int item_length)) + +HB_EXTERN(void, +hb_buffer_clear_contents,(hb_buffer_t *buffer)) + +HB_EXTERN(hb_buffer_t *, +hb_buffer_create,(void)) + +HB_EXTERN(void, +hb_buffer_destroy,(hb_buffer_t *buffer)) + +HB_EXTERN(hb_glyph_info_t *, +hb_buffer_get_glyph_infos,(hb_buffer_t *buffer, + unsigned int *length)) + +HB_EXTERN(hb_glyph_position_t *, +hb_buffer_get_glyph_positions,(hb_buffer_t *buffer, + unsigned int *length)) + +HB_EXTERN(unsigned int, +hb_buffer_get_length,(const hb_buffer_t *buffer)) + +HB_EXTERN(void, +hb_buffer_guess_segment_properties,(hb_buffer_t *buffer)) + + +/* hb-face.h */ + +HB_EXTERN(hb_face_t *, +hb_face_create,(hb_blob_t *blob, + unsigned int index)) + +HB_EXTERN(hb_face_t *, +hb_face_create_for_tables,(hb_reference_table_func_t reference_table_func, + void *user_data, + hb_destroy_func_t destroy)) + +HB_EXTERN(void, +hb_face_destroy,(hb_face_t *face)) + +HB_EXTERN(void, +hb_face_set_index,(hb_face_t *face, + unsigned int index)) + +HB_EXTERN(void, +hb_face_set_upem,(hb_face_t *face, + unsigned int upem)) + + +/* hb-font.h */ + +HB_EXTERN(hb_font_t *, +hb_font_create,(hb_face_t *face)) + +HB_EXTERN(void, +hb_font_destroy,(hb_font_t *font)) + +HB_EXTERN(hb_face_t *, +hb_font_get_face,(hb_font_t *font)) + +HB_EXTERN(void, +hb_font_set_scale,(hb_font_t *font, + int x_scale, + int y_scale)) + + +/* hb-ot-layout.h */ + +HB_EXTERN(void, +hb_ot_layout_collect_lookups,(hb_face_t *face, + hb_tag_t table_tag, + const hb_tag_t *scripts, + const hb_tag_t *languages, + const hb_tag_t *features, + hb_set_t *lookup_indexes /* OUT */)) + +HB_EXTERN(void, +hb_ot_layout_lookup_collect_glyphs,(hb_face_t *face, + hb_tag_t table_tag, + unsigned int lookup_index, + hb_set_t *glyphs_before, /* OUT. May be NULL */ + hb_set_t *glyphs_input, /* OUT. May be NULL */ + hb_set_t *glyphs_after, /* OUT. May be NULL */ + hb_set_t *glyphs_output /* OUT. May be NULL */)) + +HB_EXTERN(hb_bool_t, +hb_ot_layout_lookup_would_substitute,(hb_face_t *face, + unsigned int lookup_index, + const hb_codepoint_t *glyphs, + unsigned int glyphs_length, + hb_bool_t zero_context)) + +HB_EXTERN(void, +hb_ot_tags_from_script_and_language,(hb_script_t script, + hb_language_t language, + unsigned int *script_count /* IN/OUT */, + hb_tag_t *script_tags /* OUT */, + unsigned int *language_count /* IN/OUT */, + hb_tag_t *language_tags /* OUT */)) + + +/* hb-set.h */ + +HB_EXTERN(void, +hb_set_add,(hb_set_t *set, + hb_codepoint_t codepoint)) + +HB_EXTERN(void, +hb_set_clear,(hb_set_t *set)) + +HB_EXTERN(hb_set_t *, +hb_set_create,(void)) + +HB_EXTERN(void, +hb_set_destroy,(hb_set_t *set)) + +HB_EXTERN(void, +hb_set_del,(hb_set_t *set, + hb_codepoint_t codepoint)) + +HB_EXTERN(hb_bool_t, +hb_set_has,(const hb_set_t *set, + hb_codepoint_t codepoint)) + +HB_EXTERN(hb_bool_t, +hb_set_is_empty,(const hb_set_t *set)) + +HB_EXTERN(hb_bool_t, +hb_set_next,(const hb_set_t *set, + hb_codepoint_t *codepoint)) + +HB_EXTERN(void, +hb_set_subtract,(hb_set_t *set, + const hb_set_t *other)) + + +/* hb-shape.h */ + +HB_EXTERN(void, +hb_shape,(hb_font_t *font, + hb_buffer_t *buffer, + const hb_feature_t *features, + unsigned int num_features)) + +HB_EXTERN(hb_bool_t, +hb_version_atleast,(unsigned int major, + unsigned int minor, + unsigned int micro)) + + +/* END */ diff --git a/modules/freetype2/src/autofit/ft-hb-ft.c b/modules/freetype2/src/autofit/ft-hb-ft.c @@ -0,0 +1,117 @@ +/* + * Copyright © 2009, 2023 Red Hat, Inc. + * Copyright © 2015 Google, Inc. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod, Matthias Clasen + * Google Author(s): Behdad Esfahbod + */ + +#include <freetype/freetype.h> +#include <freetype/tttables.h> + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + +#include "ft-hb-ft.h" + +/* The following three functions are a more or less verbatim + * copy of corresponding HarfBuzz code from hb-ft.cc + */ + +static hb_blob_t * +ft_hb_ft_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data) +{ + AF_FaceGlobals globals = (AF_FaceGlobals) user_data; + + FT_Face ft_face = globals->face; + FT_Byte *buffer; + FT_ULong length = 0; + FT_Error error; + + FT_UNUSED (face); + + /* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */ + + error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length); + if (error) + return NULL; + + buffer = (FT_Byte *) ft_smalloc (length); + if (!buffer) + return NULL; + + error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length); + if (error) + { + free (buffer); + return NULL; + } + + return hb(blob_create) ((const char *) buffer, length, + HB_MEMORY_MODE_WRITABLE, + buffer, ft_sfree); +} + +static hb_face_t * +ft_hb_ft_face_create (AF_FaceGlobals globals) +{ + FT_Face ft_face = globals->face; + + hb_face_t *face; + + if (!ft_face->stream->read) { + hb_blob_t *blob; + + blob = hb(blob_create) ((const char *) ft_face->stream->base, + (unsigned int) ft_face->stream->size, + HB_MEMORY_MODE_READONLY, + ft_face, NULL); + face = hb(face_create) (blob, ft_face->face_index); + hb(blob_destroy) (blob); + } else { + face = hb(face_create_for_tables) (ft_hb_ft_reference_table, globals, NULL); + } + + hb(face_set_index) (face, ft_face->face_index); + hb(face_set_upem) (face, ft_face->units_per_EM); + + return face; +} + +FT_LOCAL_DEF(hb_font_t *) +ft_hb_ft_font_create (AF_FaceGlobals globals) +{ + hb_font_t *font; + hb_face_t *face; + + face = ft_hb_ft_face_create (globals); + font = hb(font_create) (face); + hb(face_destroy) (face); + return font; +} + +#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ + +/* ANSI C doesn't like empty source files */ +typedef int ft_hb_ft_dummy_; + +#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ + +/* END */ diff --git a/modules/freetype2/src/autofit/ft-hb-ft.h b/modules/freetype2/src/autofit/ft-hb-ft.h @@ -0,0 +1,46 @@ +/* + * Copyright © 2009, 2023 Red Hat, Inc. + * Copyright © 2015 Google, Inc. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod, Matthias Clasen + * Google Author(s): Behdad Esfahbod + */ + +#ifndef FT_HB_FT_H +#define FT_HB_FT_H + +#include "ft-hb.h" + +#include "afglobal.h" + + +FT_BEGIN_HEADER + +FT_LOCAL(hb_font_t *) +ft_hb_ft_font_create (AF_FaceGlobals globals); + + +FT_END_HEADER + +#endif /* FT_HB_FT_H */ + + +/* END */ diff --git a/modules/freetype2/src/autofit/ft-hb-types.h b/modules/freetype2/src/autofit/ft-hb-types.h @@ -0,0 +1,129 @@ +/* + * Copyright © 2009, 2023 Red Hat, Inc. + * Copyright © 2015 Google, Inc. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod, Matthias Clasen + * Google Author(s): Behdad Esfahbod + */ + + + /* This file is a condensed version of the public HarfBuzz header file */ + /* `hb-common.h`, also including some additional HarfBuzz declarations */ + /* and macros. It allows FreeType to load HarfBuzz dynamically without */ + /* actually using its header files. */ + + +#ifndef FT_HB_TYPES_H +#define FT_HB_TYPES_H + +#if defined (_AIX) +# include <sys/inttypes.h> +#elif defined (_MSC_VER) && _MSC_VER < 1600 +/* VS 2010 (_MSC_VER 1600) has stdint.h */ +typedef __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#elif defined (_MSC_VER) && _MSC_VER < 1800 +/* VS 2013 (_MSC_VER 1800) has inttypes.h */ +# include <stdint.h> +#else +# include <inttypes.h> +#endif +#include <stddef.h> + +typedef int hb_bool_t; +typedef uint32_t hb_codepoint_t; +#define HB_CODEPOINT_INVALID ((hb_codepoint_t) -1) +typedef uint32_t hb_tag_t; + +#define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF))) +#define HB_TAG_NONE HB_TAG(0,0,0,0) +#define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff) +#define HB_OT_TAG_DEFAULT_SCRIPT HB_TAG ('D', 'F', 'L', 'T') +#define HB_OT_TAG_GPOS HB_TAG('G','P','O','S') +#define HB_OT_TAG_GSUB HB_TAG('G','S','U','B') + +typedef int32_t hb_position_t; +typedef uint32_t hb_mask_t; + +typedef enum { + HB_DIRECTION_INVALID = 0, + HB_DIRECTION_LTR = 4, + HB_DIRECTION_RTL, + HB_DIRECTION_TTB, + HB_DIRECTION_BTT +} hb_direction_t; +typedef enum { + HB_MEMORY_MODE_DUPLICATE, + HB_MEMORY_MODE_READONLY, + HB_MEMORY_MODE_WRITABLE, + HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE +} hb_memory_mode_t; + +#define HB_NO_SINGLE_HEADER_ERROR +#include "hb-script-list.h" +#undef HB_NO_SINGLE_HEADER_ERROR + +typedef const struct hb_language_impl_t *hb_language_t; +#define HB_LANGUAGE_INVALID ((hb_language_t) 0) +#define HB_SET_VALUE_INVALID HB_CODEPOINT_INVALID + +typedef struct hb_feature_t { + hb_tag_t tag; + uint32_t value; + unsigned int start; + unsigned int end; +} hb_feature_t; + +#define HB_FEATURE_GLOBAL_START 0 +#define HB_FEATURE_GLOBAL_END ((unsigned int) -1) + +typedef struct hb_glyph_info_t { + hb_codepoint_t codepoint; + hb_mask_t mask; + uint32_t cluster; + uint32_t var1; + uint32_t var2; +} hb_glyph_info_t; + +typedef struct hb_glyph_position_t { + hb_position_t x_advance; + hb_position_t y_advance; + hb_position_t x_offset; + hb_position_t y_offset; + uint32_t var; +} hb_glyph_position_t; + +typedef struct hb_blob_t hb_blob_t; +typedef struct hb_buffer_t hb_buffer_t; +typedef struct hb_face_t hb_face_t; +typedef struct hb_font_t hb_font_t; +typedef struct hb_set_t hb_set_t; + +typedef void (*hb_destroy_func_t) (void *data); +typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data); + +#endif /* FT_HB_TYPES_H */ diff --git a/modules/freetype2/src/autofit/ft-hb.c b/modules/freetype2/src/autofit/ft-hb.c @@ -1,115 +1,197 @@ -/* - * Copyright © 2009, 2023 Red Hat, Inc. - * Copyright © 2015 Google, Inc. +/**************************************************************************** * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. + * ft-hb.c * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. + * FreeType-HarfBuzz bridge (body). * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * Copyright (C) 2025 by + * Behdad Esfahbod. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. * - * Red Hat Author(s): Behdad Esfahbod, Matthias Clasen - * Google Author(s): Behdad Esfahbod */ + +#if !defined( _WIN32 ) && !defined( _GNU_SOURCE ) +# define _GNU_SOURCE 1 /* for RTLD_DEFAULT */ +#endif + #include <freetype/freetype.h> -#include <freetype/tttables.h> +#include <freetype/internal/ftmemory.h> -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ +#include "afglobal.h" #include "ft-hb.h" -/* The following three functions are a more or less verbatim - * copy of corresponding HarfBuzz code from hb-ft.cc - */ -static hb_blob_t * -hb_ft_reference_table_ (hb_face_t *face, hb_tag_t tag, void *user_data) -{ - FT_Face ft_face = (FT_Face) user_data; - FT_Byte *buffer; - FT_ULong length = 0; - FT_Error error; +#if defined( FT_CONFIG_OPTION_USE_HARFBUZZ ) && \ + defined( FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC ) + +#ifndef FT_LIBHARFBUZZ +# ifdef _WIN32 +# define FT_LIBHARFBUZZ "libharfbuzz-0.dll" +# else +# ifdef __APPLE__ +# define FT_LIBHARFBUZZ "libharfbuzz.0.dylib" +# else +# define FT_LIBHARFBUZZ "libharfbuzz.so.0" +# endif +# endif +#endif - FT_UNUSED (face); +#ifdef _WIN32 - /* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */ +# include <windows.h> - error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length); - if (error) - return NULL; +#else /* !_WIN32 */ - buffer = (FT_Byte *) ft_smalloc (length); - if (!buffer) - return NULL; +# include <dlfcn.h> - error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length); - if (error) + /* The GCC pragma suppresses the warning "ISO C forbids */ + /* assignment between function pointer and 'void *'", which */ + /* inevitably gets emitted with `-Wpedantic`; see the man */ + /* page of function `dlsym` for more information. */ +# if defined( __GNUC__ ) +# pragma GCC diagnostic push +# ifndef __cplusplus +# pragma GCC diagnostic ignored "-Wpedantic" +# endif +# endif + +#endif /* !_WIN32 */ + + + FT_LOCAL_DEF( void ) + ft_hb_funcs_init( struct AF_ModuleRec_ *af_module ) { - free (buffer); - return NULL; + FT_Memory memory = af_module->root.memory; + FT_Error error; + + ft_hb_funcs_t *funcs = NULL; + ft_hb_version_atleast_func_t version_atleast = NULL; + +#ifdef _WIN32 + HANDLE lib; +# define DLSYM( lib, name ) \ + (ft_ ## name ## _func_t)GetProcAddress( lib, #name ) +#else + void *lib; +# define DLSYM( lib, name ) \ + (ft_ ## name ## _func_t)dlsym( lib, #name ) +#endif + + + af_module->hb_funcs = NULL; + + if ( FT_NEW( funcs ) ) + return; + FT_ZERO( funcs ); + +#ifdef _WIN32 + + lib = LoadLibraryA( FT_LIBHARFBUZZ ); + if ( !lib ) + goto Fail; + version_atleast = DLSYM( lib, hb_version_atleast ); + +#else /* !_WIN32 */ + +# ifdef RTLD_DEFAULT +# define FT_RTLD_FLAGS RTLD_LAZY | RTLD_GLOBAL + lib = RTLD_DEFAULT; + version_atleast = DLSYM( lib, hb_version_atleast ); +# else +# define FT_RTLD_FLAGS RTLD_LAZY +# endif + + if ( !version_atleast ) + { + /* Load the HarfBuzz library. + * + * We never close the library, since we opened it with RTLD_GLOBAL. + * This is important for the case where we are using HarfBuzz as a + * shared library, and we want to use the symbols from the library in + * other shared libraries or clients. HarfBuzz holds onto global + * variables, and closing the library will cause them to be + * invalidated. + */ + lib = dlopen( FT_LIBHARFBUZZ, FT_RTLD_FLAGS ); + if ( !lib ) + goto Fail; + version_atleast = DLSYM( lib, hb_version_atleast ); + } + +#endif /* !_WIN32 */ + + if ( !version_atleast ) + goto Fail; + + /* Load all symbols we use. */ +#define HB_EXTERN( ret, name, args ) \ + { \ + funcs->name = DLSYM( lib, name ); \ + if ( !funcs->name ) \ + goto Fail; \ } +#include "ft-hb-decls.h" +#undef HB_EXTERN - return hb_blob_create ((const char *) buffer, length, - HB_MEMORY_MODE_WRITABLE, - buffer, ft_sfree); -} - -static hb_face_t * -hb_ft_face_create_ (FT_Face ft_face, - hb_destroy_func_t destroy) -{ - hb_face_t *face; - - if (!ft_face->stream->read) { - hb_blob_t *blob; - - blob = hb_blob_create ((const char *) ft_face->stream->base, - (unsigned int) ft_face->stream->size, - HB_MEMORY_MODE_READONLY, - ft_face, destroy); - face = hb_face_create (blob, ft_face->face_index); - hb_blob_destroy (blob); - } else { - face = hb_face_create_for_tables (hb_ft_reference_table_, ft_face, destroy); +#undef DLSYM + + af_module->hb_funcs = funcs; + return; + + Fail: + if ( funcs ) + FT_FREE( funcs ); } - hb_face_set_index (face, ft_face->face_index); - hb_face_set_upem (face, ft_face->units_per_EM); - return face; -} + FT_LOCAL_DEF( void ) + ft_hb_funcs_done( struct AF_ModuleRec_ *af_module ) + { + FT_Memory memory = af_module->root.memory; -FT_LOCAL_DEF(hb_font_t *) -hb_ft_font_create_ (FT_Face ft_face, - hb_destroy_func_t destroy) -{ - hb_font_t *font; - hb_face_t *face; - face = hb_ft_face_create_ (ft_face, destroy); - font = hb_font_create (face); - hb_face_destroy (face); - return font; -} + if ( af_module->hb_funcs ) + { + FT_FREE( af_module->hb_funcs ); + af_module->hb_funcs = NULL; + } + } + + + FT_LOCAL_DEF( FT_Bool ) + ft_hb_enabled( struct AF_FaceGlobalsRec_ *globals ) + { + return globals->module->hb_funcs != NULL; + } + +#ifndef _WIN32 +# if defined( __GNUC__ ) +# pragma GCC diagnostic pop +# endif +#endif -#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ +#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */ + + FT_LOCAL_DEF( FT_Bool ) + ft_hb_enabled( struct AF_FaceGlobalsRec_ *globals ) + { + FT_UNUSED( globals ); + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + return TRUE; +#else + return FALSE; +#endif + } -/* ANSI C doesn't like empty source files */ -typedef int ft_hb_dummy_; +#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */ -#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ /* END */ diff --git a/modules/freetype2/src/autofit/ft-hb.h b/modules/freetype2/src/autofit/ft-hb.h @@ -1,43 +1,77 @@ -/* - * Copyright © 2009, 2023 Red Hat, Inc. - * Copyright © 2015 Google, Inc. +/**************************************************************************** * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. + * ft-hb.h * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. + * FreeType-HarfBuzz bridge (specification). * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * Copyright (C) 2025 by + * Behdad Esfahbod. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. * - * Red Hat Author(s): Behdad Esfahbod, Matthias Clasen - * Google Author(s): Behdad Esfahbod */ + #ifndef FT_HB_H #define FT_HB_H -#include <hb.h> - #include <freetype/internal/compiler-macros.h> #include <freetype/freetype.h> FT_BEGIN_HEADER -FT_LOCAL(hb_font_t *) -hb_ft_font_create_ (FT_Face ft_face, - hb_destroy_func_t destroy); +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + +# include "ft-hb-types.h" + +# ifdef FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC + +# define HB_EXTERN( ret, name, args ) \ + typedef ret (*ft_ ## name ## _func_t) args; +# include "ft-hb-decls.h" +# undef HB_EXTERN + + typedef struct ft_hb_funcs_t + { +# define HB_EXTERN( ret, name, args ) \ + ft_ ## name ## _func_t name; +# include "ft-hb-decls.h" +# undef HB_EXTERN + } ft_hb_funcs_t; + + struct AF_ModuleRec_; + + FT_LOCAL( void ) + ft_hb_funcs_init( struct AF_ModuleRec_ *af_module ); + + FT_LOCAL( void ) + ft_hb_funcs_done( struct AF_ModuleRec_ *af_module ); + +# define hb( x ) globals->module->hb_funcs->hb_ ## x + +# else /* !FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */ + +# define HB_EXTERN( ret, name, args ) \ + ret name args; +# include "ft-hb-decls.h" +# undef HB_EXTERN + +# define hb( x ) hb_ ## x + +# endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */ + +#endif /* FT_CONFIG_OPTION_USE_HARFBUZZ */ + + + struct AF_FaceGlobalsRec_; + + FT_LOCAL( FT_Bool ) + ft_hb_enabled( struct AF_FaceGlobalsRec_ *globals ); FT_END_HEADER diff --git a/modules/freetype2/src/autofit/hb-script-list.h b/modules/freetype2/src/autofit/hb-script-list.h @@ -0,0 +1,484 @@ +/* + * Copyright © 2007,2008,2009 Red Hat, Inc. + * Copyright © 2011,2012 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + * Google Author(s): Behdad Esfahbod + */ + +#if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) +#error "Include <hb.h> instead." +#endif + +#ifndef HB_SCRIPT_LIST_H +#define HB_SCRIPT_LIST_H + +/* This file belongs to the middle of hb-common.h. + * The reason it has been surgically extracted is because + * FreeType imports types and enums from hb-common.h, + * and since this enum is large and growing, we want to + * make it easy to just copy the file over to FreeType. + * https://github.com/harfbuzz/harfbuzz/issues/5271 + */ + +/* Dummy lines to make our checks happy. */ +#if 0 +#include "hb-common.h" +HB_BEGIN_DECLS +HB_END_DECLS +#endif + + +/** + * hb_script_t: + * @HB_SCRIPT_COMMON: `Zyyy` + * @HB_SCRIPT_INHERITED: `Zinh` + * @HB_SCRIPT_UNKNOWN: `Zzzz` + * @HB_SCRIPT_ARABIC: `Arab` + * @HB_SCRIPT_ARMENIAN: `Armn` + * @HB_SCRIPT_BENGALI: `Beng` + * @HB_SCRIPT_CYRILLIC: `Cyrl` + * @HB_SCRIPT_DEVANAGARI: `Deva` + * @HB_SCRIPT_GEORGIAN: `Geor` + * @HB_SCRIPT_GREEK: `Grek` + * @HB_SCRIPT_GUJARATI: `Gujr` + * @HB_SCRIPT_GURMUKHI: `Guru` + * @HB_SCRIPT_HANGUL: `Hang` + * @HB_SCRIPT_HAN: `Hani` + * @HB_SCRIPT_HEBREW: `Hebr` + * @HB_SCRIPT_HIRAGANA: `Hira` + * @HB_SCRIPT_KANNADA: `Knda` + * @HB_SCRIPT_KATAKANA: `Kana` + * @HB_SCRIPT_LAO: `Laoo` + * @HB_SCRIPT_LATIN: `Latn` + * @HB_SCRIPT_MALAYALAM: `Mlym` + * @HB_SCRIPT_ORIYA: `Orya` + * @HB_SCRIPT_TAMIL: `Taml` + * @HB_SCRIPT_TELUGU: `Telu` + * @HB_SCRIPT_THAI: `Thai` + * @HB_SCRIPT_TIBETAN: `Tibt` + * @HB_SCRIPT_BOPOMOFO: `Bopo` + * @HB_SCRIPT_BRAILLE: `Brai` + * @HB_SCRIPT_CANADIAN_SYLLABICS: `Cans` + * @HB_SCRIPT_CHEROKEE: `Cher` + * @HB_SCRIPT_ETHIOPIC: `Ethi` + * @HB_SCRIPT_KHMER: `Khmr` + * @HB_SCRIPT_MONGOLIAN: `Mong` + * @HB_SCRIPT_MYANMAR: `Mymr` + * @HB_SCRIPT_OGHAM: `Ogam` + * @HB_SCRIPT_RUNIC: `Runr` + * @HB_SCRIPT_SINHALA: `Sinh` + * @HB_SCRIPT_SYRIAC: `Syrc` + * @HB_SCRIPT_THAANA: `Thaa` + * @HB_SCRIPT_YI: `Yiii` + * @HB_SCRIPT_DESERET: `Dsrt` + * @HB_SCRIPT_GOTHIC: `Goth` + * @HB_SCRIPT_OLD_ITALIC: `Ital` + * @HB_SCRIPT_BUHID: `Buhd` + * @HB_SCRIPT_HANUNOO: `Hano` + * @HB_SCRIPT_TAGALOG: `Tglg` + * @HB_SCRIPT_TAGBANWA: `Tagb` + * @HB_SCRIPT_CYPRIOT: `Cprt` + * @HB_SCRIPT_LIMBU: `Limb` + * @HB_SCRIPT_LINEAR_B: `Linb` + * @HB_SCRIPT_OSMANYA: `Osma` + * @HB_SCRIPT_SHAVIAN: `Shaw` + * @HB_SCRIPT_TAI_LE: `Tale` + * @HB_SCRIPT_UGARITIC: `Ugar` + * @HB_SCRIPT_BUGINESE: `Bugi` + * @HB_SCRIPT_COPTIC: `Copt` + * @HB_SCRIPT_GLAGOLITIC: `Glag` + * @HB_SCRIPT_KHAROSHTHI: `Khar` + * @HB_SCRIPT_NEW_TAI_LUE: `Talu` + * @HB_SCRIPT_OLD_PERSIAN: `Xpeo` + * @HB_SCRIPT_SYLOTI_NAGRI: `Sylo` + * @HB_SCRIPT_TIFINAGH: `Tfng` + * @HB_SCRIPT_BALINESE: `Bali` + * @HB_SCRIPT_CUNEIFORM: `Xsux` + * @HB_SCRIPT_NKO: `Nkoo` + * @HB_SCRIPT_PHAGS_PA: `Phag` + * @HB_SCRIPT_PHOENICIAN: `Phnx` + * @HB_SCRIPT_CARIAN: `Cari` + * @HB_SCRIPT_CHAM: `Cham` + * @HB_SCRIPT_KAYAH_LI: `Kali` + * @HB_SCRIPT_LEPCHA: `Lepc` + * @HB_SCRIPT_LYCIAN: `Lyci` + * @HB_SCRIPT_LYDIAN: `Lydi` + * @HB_SCRIPT_OL_CHIKI: `Olck` + * @HB_SCRIPT_REJANG: `Rjng` + * @HB_SCRIPT_SAURASHTRA: `Saur` + * @HB_SCRIPT_SUNDANESE: `Sund` + * @HB_SCRIPT_VAI: `Vaii` + * @HB_SCRIPT_AVESTAN: `Avst` + * @HB_SCRIPT_BAMUM: `Bamu` + * @HB_SCRIPT_EGYPTIAN_HIEROGLYPHS: `Egyp` + * @HB_SCRIPT_IMPERIAL_ARAMAIC: `Armi` + * @HB_SCRIPT_INSCRIPTIONAL_PAHLAVI: `Phli` + * @HB_SCRIPT_INSCRIPTIONAL_PARTHIAN: `Prti` + * @HB_SCRIPT_JAVANESE: `Java` + * @HB_SCRIPT_KAITHI: `Kthi` + * @HB_SCRIPT_LISU: `Lisu` + * @HB_SCRIPT_MEETEI_MAYEK: `Mtei` + * @HB_SCRIPT_OLD_SOUTH_ARABIAN: `Sarb` + * @HB_SCRIPT_OLD_TURKIC: `Orkh` + * @HB_SCRIPT_SAMARITAN: `Samr` + * @HB_SCRIPT_TAI_THAM: `Lana` + * @HB_SCRIPT_TAI_VIET: `Tavt` + * @HB_SCRIPT_BATAK: `Batk` + * @HB_SCRIPT_BRAHMI: `Brah` + * @HB_SCRIPT_MANDAIC: `Mand` + * @HB_SCRIPT_CHAKMA: `Cakm` + * @HB_SCRIPT_MEROITIC_CURSIVE: `Merc` + * @HB_SCRIPT_MEROITIC_HIEROGLYPHS: `Mero` + * @HB_SCRIPT_MIAO: `Plrd` + * @HB_SCRIPT_SHARADA: `Shrd` + * @HB_SCRIPT_SORA_SOMPENG: `Sora` + * @HB_SCRIPT_TAKRI: `Takr` + * @HB_SCRIPT_BASSA_VAH: `Bass`, Since: 0.9.30 + * @HB_SCRIPT_CAUCASIAN_ALBANIAN: `Aghb`, Since: 0.9.30 + * @HB_SCRIPT_DUPLOYAN: `Dupl`, Since: 0.9.30 + * @HB_SCRIPT_ELBASAN: `Elba`, Since: 0.9.30 + * @HB_SCRIPT_GRANTHA: `Gran`, Since: 0.9.30 + * @HB_SCRIPT_KHOJKI: `Khoj`, Since: 0.9.30 + * @HB_SCRIPT_KHUDAWADI: `Sind`, Since: 0.9.30 + * @HB_SCRIPT_LINEAR_A: `Lina`, Since: 0.9.30 + * @HB_SCRIPT_MAHAJANI: `Mahj`, Since: 0.9.30 + * @HB_SCRIPT_MANICHAEAN: `Mani`, Since: 0.9.30 + * @HB_SCRIPT_MENDE_KIKAKUI: `Mend`, Since: 0.9.30 + * @HB_SCRIPT_MODI: `Modi`, Since: 0.9.30 + * @HB_SCRIPT_MRO: `Mroo`, Since: 0.9.30 + * @HB_SCRIPT_NABATAEAN: `Nbat`, Since: 0.9.30 + * @HB_SCRIPT_OLD_NORTH_ARABIAN: `Narb`, Since: 0.9.30 + * @HB_SCRIPT_OLD_PERMIC: `Perm`, Since: 0.9.30 + * @HB_SCRIPT_PAHAWH_HMONG: `Hmng`, Since: 0.9.30 + * @HB_SCRIPT_PALMYRENE: `Palm`, Since: 0.9.30 + * @HB_SCRIPT_PAU_CIN_HAU: `Pauc`, Since: 0.9.30 + * @HB_SCRIPT_PSALTER_PAHLAVI: `Phlp`, Since: 0.9.30 + * @HB_SCRIPT_SIDDHAM: `Sidd`, Since: 0.9.30 + * @HB_SCRIPT_TIRHUTA: `Tirh`, Since: 0.9.30 + * @HB_SCRIPT_WARANG_CITI: `Wara`, Since: 0.9.30 + * @HB_SCRIPT_AHOM: `Ahom`, Since: 0.9.30 + * @HB_SCRIPT_ANATOLIAN_HIEROGLYPHS: `Hluw`, Since: 0.9.30 + * @HB_SCRIPT_HATRAN: `Hatr`, Since: 0.9.30 + * @HB_SCRIPT_MULTANI: `Mult`, Since: 0.9.30 + * @HB_SCRIPT_OLD_HUNGARIAN: `Hung`, Since: 0.9.30 + * @HB_SCRIPT_SIGNWRITING: `Sgnw`, Since: 0.9.30 + * @HB_SCRIPT_ADLAM: `Adlm`, Since: 1.3.0 + * @HB_SCRIPT_BHAIKSUKI: `Bhks`, Since: 1.3.0 + * @HB_SCRIPT_MARCHEN: `Marc`, Since: 1.3.0 + * @HB_SCRIPT_OSAGE: `Osge`, Since: 1.3.0 + * @HB_SCRIPT_TANGUT: `Tang`, Since: 1.3.0 + * @HB_SCRIPT_NEWA: `Newa`, Since: 1.3.0 + * @HB_SCRIPT_MASARAM_GONDI: `Gonm`, Since: 1.6.0 + * @HB_SCRIPT_NUSHU: `Nshu`, Since: 1.6.0 + * @HB_SCRIPT_SOYOMBO: `Soyo`, Since: 1.6.0 + * @HB_SCRIPT_ZANABAZAR_SQUARE: `Zanb`, Since: 1.6.0 + * @HB_SCRIPT_DOGRA: `Dogr`, Since: 1.8.0 + * @HB_SCRIPT_GUNJALA_GONDI: `Gong`, Since: 1.8.0 + * @HB_SCRIPT_HANIFI_ROHINGYA: `Rohg`, Since: 1.8.0 + * @HB_SCRIPT_MAKASAR: `Maka`, Since: 1.8.0 + * @HB_SCRIPT_MEDEFAIDRIN: `Medf`, Since: 1.8.0 + * @HB_SCRIPT_OLD_SOGDIAN: `Sogo`, Since: 1.8.0 + * @HB_SCRIPT_SOGDIAN: `Sogd`, Since: 1.8.0 + * @HB_SCRIPT_ELYMAIC: `Elym`, Since: 2.4.0 + * @HB_SCRIPT_NANDINAGARI: `Nand`, Since: 2.4.0 + * @HB_SCRIPT_NYIAKENG_PUACHUE_HMONG: `Hmnp`, Since: 2.4.0 + * @HB_SCRIPT_WANCHO: `Wcho`, Since: 2.4.0 + * @HB_SCRIPT_CHORASMIAN: `Chrs`, Since: 2.6.7 + * @HB_SCRIPT_DIVES_AKURU: `Diak`, Since: 2.6.7 + * @HB_SCRIPT_KHITAN_SMALL_SCRIPT: `Kits`, Since: 2.6.7 + * @HB_SCRIPT_YEZIDI: `Yezi`, Since: 2.6.7 + * @HB_SCRIPT_CYPRO_MINOAN: `Cpmn`, Since: 3.0.0 + * @HB_SCRIPT_OLD_UYGHUR: `Ougr`, Since: 3.0.0 + * @HB_SCRIPT_TANGSA: `Tnsa`, Since: 3.0.0 + * @HB_SCRIPT_TOTO: `Toto`, Since: 3.0.0 + * @HB_SCRIPT_VITHKUQI: `Vith`, Since: 3.0.0 + * @HB_SCRIPT_MATH: `Zmth`, Since: 3.4.0 + * @HB_SCRIPT_KAWI: `Kawi`, Since: 5.2.0 + * @HB_SCRIPT_NAG_MUNDARI: `Nagm`, Since: 5.2.0 + * @HB_SCRIPT_GARAY: `Gara`, Since: 10.0.0 + * @HB_SCRIPT_GURUNG_KHEMA: `Gukh`, Since: 10.0.0 + * @HB_SCRIPT_KIRAT_RAI: `Krai`, Since: 10.0.0 + * @HB_SCRIPT_OL_ONAL: `Onao`, Since: 10.0.0 + * @HB_SCRIPT_SUNUWAR: `Sunu`, Since: 10.0.0 + * @HB_SCRIPT_TODHRI: `Todr`, Since: 10.0.0 + * @HB_SCRIPT_TULU_TIGALARI: `Tutg`, Since: 10.0.0 + * @HB_SCRIPT_INVALID: No script set + * + * Data type for scripts. Each #hb_script_t's value is an #hb_tag_t corresponding + * to the four-letter values defined by [ISO 15924](https://unicode.org/iso15924/). + * + * See also the Script (sc) property of the Unicode Character Database. + * + **/ + +/* https://docs.google.com/spreadsheets/d/1Y90M0Ie3MUJ6UVCRDOypOtijlMDLNNyyLk36T6iMu0o */ +typedef enum +{ + HB_SCRIPT_COMMON = HB_TAG ('Z','y','y','y'), /*1.1*/ + HB_SCRIPT_INHERITED = HB_TAG ('Z','i','n','h'), /*1.1*/ + HB_SCRIPT_UNKNOWN = HB_TAG ('Z','z','z','z'), /*5.0*/ + + HB_SCRIPT_ARABIC = HB_TAG ('A','r','a','b'), /*1.1*/ + HB_SCRIPT_ARMENIAN = HB_TAG ('A','r','m','n'), /*1.1*/ + HB_SCRIPT_BENGALI = HB_TAG ('B','e','n','g'), /*1.1*/ + HB_SCRIPT_CYRILLIC = HB_TAG ('C','y','r','l'), /*1.1*/ + HB_SCRIPT_DEVANAGARI = HB_TAG ('D','e','v','a'), /*1.1*/ + HB_SCRIPT_GEORGIAN = HB_TAG ('G','e','o','r'), /*1.1*/ + HB_SCRIPT_GREEK = HB_TAG ('G','r','e','k'), /*1.1*/ + HB_SCRIPT_GUJARATI = HB_TAG ('G','u','j','r'), /*1.1*/ + HB_SCRIPT_GURMUKHI = HB_TAG ('G','u','r','u'), /*1.1*/ + HB_SCRIPT_HANGUL = HB_TAG ('H','a','n','g'), /*1.1*/ + HB_SCRIPT_HAN = HB_TAG ('H','a','n','i'), /*1.1*/ + HB_SCRIPT_HEBREW = HB_TAG ('H','e','b','r'), /*1.1*/ + HB_SCRIPT_HIRAGANA = HB_TAG ('H','i','r','a'), /*1.1*/ + HB_SCRIPT_KANNADA = HB_TAG ('K','n','d','a'), /*1.1*/ + HB_SCRIPT_KATAKANA = HB_TAG ('K','a','n','a'), /*1.1*/ + HB_SCRIPT_LAO = HB_TAG ('L','a','o','o'), /*1.1*/ + HB_SCRIPT_LATIN = HB_TAG ('L','a','t','n'), /*1.1*/ + HB_SCRIPT_MALAYALAM = HB_TAG ('M','l','y','m'), /*1.1*/ + HB_SCRIPT_ORIYA = HB_TAG ('O','r','y','a'), /*1.1*/ + HB_SCRIPT_TAMIL = HB_TAG ('T','a','m','l'), /*1.1*/ + HB_SCRIPT_TELUGU = HB_TAG ('T','e','l','u'), /*1.1*/ + HB_SCRIPT_THAI = HB_TAG ('T','h','a','i'), /*1.1*/ + + HB_SCRIPT_TIBETAN = HB_TAG ('T','i','b','t'), /*2.0*/ + + HB_SCRIPT_BOPOMOFO = HB_TAG ('B','o','p','o'), /*3.0*/ + HB_SCRIPT_BRAILLE = HB_TAG ('B','r','a','i'), /*3.0*/ + HB_SCRIPT_CANADIAN_SYLLABICS = HB_TAG ('C','a','n','s'), /*3.0*/ + HB_SCRIPT_CHEROKEE = HB_TAG ('C','h','e','r'), /*3.0*/ + HB_SCRIPT_ETHIOPIC = HB_TAG ('E','t','h','i'), /*3.0*/ + HB_SCRIPT_KHMER = HB_TAG ('K','h','m','r'), /*3.0*/ + HB_SCRIPT_MONGOLIAN = HB_TAG ('M','o','n','g'), /*3.0*/ + HB_SCRIPT_MYANMAR = HB_TAG ('M','y','m','r'), /*3.0*/ + HB_SCRIPT_OGHAM = HB_TAG ('O','g','a','m'), /*3.0*/ + HB_SCRIPT_RUNIC = HB_TAG ('R','u','n','r'), /*3.0*/ + HB_SCRIPT_SINHALA = HB_TAG ('S','i','n','h'), /*3.0*/ + HB_SCRIPT_SYRIAC = HB_TAG ('S','y','r','c'), /*3.0*/ + HB_SCRIPT_THAANA = HB_TAG ('T','h','a','a'), /*3.0*/ + HB_SCRIPT_YI = HB_TAG ('Y','i','i','i'), /*3.0*/ + + HB_SCRIPT_DESERET = HB_TAG ('D','s','r','t'), /*3.1*/ + HB_SCRIPT_GOTHIC = HB_TAG ('G','o','t','h'), /*3.1*/ + HB_SCRIPT_OLD_ITALIC = HB_TAG ('I','t','a','l'), /*3.1*/ + + HB_SCRIPT_BUHID = HB_TAG ('B','u','h','d'), /*3.2*/ + HB_SCRIPT_HANUNOO = HB_TAG ('H','a','n','o'), /*3.2*/ + HB_SCRIPT_TAGALOG = HB_TAG ('T','g','l','g'), /*3.2*/ + HB_SCRIPT_TAGBANWA = HB_TAG ('T','a','g','b'), /*3.2*/ + + HB_SCRIPT_CYPRIOT = HB_TAG ('C','p','r','t'), /*4.0*/ + HB_SCRIPT_LIMBU = HB_TAG ('L','i','m','b'), /*4.0*/ + HB_SCRIPT_LINEAR_B = HB_TAG ('L','i','n','b'), /*4.0*/ + HB_SCRIPT_OSMANYA = HB_TAG ('O','s','m','a'), /*4.0*/ + HB_SCRIPT_SHAVIAN = HB_TAG ('S','h','a','w'), /*4.0*/ + HB_SCRIPT_TAI_LE = HB_TAG ('T','a','l','e'), /*4.0*/ + HB_SCRIPT_UGARITIC = HB_TAG ('U','g','a','r'), /*4.0*/ + + HB_SCRIPT_BUGINESE = HB_TAG ('B','u','g','i'), /*4.1*/ + HB_SCRIPT_COPTIC = HB_TAG ('C','o','p','t'), /*4.1*/ + HB_SCRIPT_GLAGOLITIC = HB_TAG ('G','l','a','g'), /*4.1*/ + HB_SCRIPT_KHAROSHTHI = HB_TAG ('K','h','a','r'), /*4.1*/ + HB_SCRIPT_NEW_TAI_LUE = HB_TAG ('T','a','l','u'), /*4.1*/ + HB_SCRIPT_OLD_PERSIAN = HB_TAG ('X','p','e','o'), /*4.1*/ + HB_SCRIPT_SYLOTI_NAGRI = HB_TAG ('S','y','l','o'), /*4.1*/ + HB_SCRIPT_TIFINAGH = HB_TAG ('T','f','n','g'), /*4.1*/ + + HB_SCRIPT_BALINESE = HB_TAG ('B','a','l','i'), /*5.0*/ + HB_SCRIPT_CUNEIFORM = HB_TAG ('X','s','u','x'), /*5.0*/ + HB_SCRIPT_NKO = HB_TAG ('N','k','o','o'), /*5.0*/ + HB_SCRIPT_PHAGS_PA = HB_TAG ('P','h','a','g'), /*5.0*/ + HB_SCRIPT_PHOENICIAN = HB_TAG ('P','h','n','x'), /*5.0*/ + + HB_SCRIPT_CARIAN = HB_TAG ('C','a','r','i'), /*5.1*/ + HB_SCRIPT_CHAM = HB_TAG ('C','h','a','m'), /*5.1*/ + HB_SCRIPT_KAYAH_LI = HB_TAG ('K','a','l','i'), /*5.1*/ + HB_SCRIPT_LEPCHA = HB_TAG ('L','e','p','c'), /*5.1*/ + HB_SCRIPT_LYCIAN = HB_TAG ('L','y','c','i'), /*5.1*/ + HB_SCRIPT_LYDIAN = HB_TAG ('L','y','d','i'), /*5.1*/ + HB_SCRIPT_OL_CHIKI = HB_TAG ('O','l','c','k'), /*5.1*/ + HB_SCRIPT_REJANG = HB_TAG ('R','j','n','g'), /*5.1*/ + HB_SCRIPT_SAURASHTRA = HB_TAG ('S','a','u','r'), /*5.1*/ + HB_SCRIPT_SUNDANESE = HB_TAG ('S','u','n','d'), /*5.1*/ + HB_SCRIPT_VAI = HB_TAG ('V','a','i','i'), /*5.1*/ + + HB_SCRIPT_AVESTAN = HB_TAG ('A','v','s','t'), /*5.2*/ + HB_SCRIPT_BAMUM = HB_TAG ('B','a','m','u'), /*5.2*/ + HB_SCRIPT_EGYPTIAN_HIEROGLYPHS = HB_TAG ('E','g','y','p'), /*5.2*/ + HB_SCRIPT_IMPERIAL_ARAMAIC = HB_TAG ('A','r','m','i'), /*5.2*/ + HB_SCRIPT_INSCRIPTIONAL_PAHLAVI = HB_TAG ('P','h','l','i'), /*5.2*/ + HB_SCRIPT_INSCRIPTIONAL_PARTHIAN = HB_TAG ('P','r','t','i'), /*5.2*/ + HB_SCRIPT_JAVANESE = HB_TAG ('J','a','v','a'), /*5.2*/ + HB_SCRIPT_KAITHI = HB_TAG ('K','t','h','i'), /*5.2*/ + HB_SCRIPT_LISU = HB_TAG ('L','i','s','u'), /*5.2*/ + HB_SCRIPT_MEETEI_MAYEK = HB_TAG ('M','t','e','i'), /*5.2*/ + HB_SCRIPT_OLD_SOUTH_ARABIAN = HB_TAG ('S','a','r','b'), /*5.2*/ + HB_SCRIPT_OLD_TURKIC = HB_TAG ('O','r','k','h'), /*5.2*/ + HB_SCRIPT_SAMARITAN = HB_TAG ('S','a','m','r'), /*5.2*/ + HB_SCRIPT_TAI_THAM = HB_TAG ('L','a','n','a'), /*5.2*/ + HB_SCRIPT_TAI_VIET = HB_TAG ('T','a','v','t'), /*5.2*/ + + HB_SCRIPT_BATAK = HB_TAG ('B','a','t','k'), /*6.0*/ + HB_SCRIPT_BRAHMI = HB_TAG ('B','r','a','h'), /*6.0*/ + HB_SCRIPT_MANDAIC = HB_TAG ('M','a','n','d'), /*6.0*/ + + HB_SCRIPT_CHAKMA = HB_TAG ('C','a','k','m'), /*6.1*/ + HB_SCRIPT_MEROITIC_CURSIVE = HB_TAG ('M','e','r','c'), /*6.1*/ + HB_SCRIPT_MEROITIC_HIEROGLYPHS = HB_TAG ('M','e','r','o'), /*6.1*/ + HB_SCRIPT_MIAO = HB_TAG ('P','l','r','d'), /*6.1*/ + HB_SCRIPT_SHARADA = HB_TAG ('S','h','r','d'), /*6.1*/ + HB_SCRIPT_SORA_SOMPENG = HB_TAG ('S','o','r','a'), /*6.1*/ + HB_SCRIPT_TAKRI = HB_TAG ('T','a','k','r'), /*6.1*/ + + /* + * Since: 0.9.30 + */ + HB_SCRIPT_BASSA_VAH = HB_TAG ('B','a','s','s'), /*7.0*/ + HB_SCRIPT_CAUCASIAN_ALBANIAN = HB_TAG ('A','g','h','b'), /*7.0*/ + HB_SCRIPT_DUPLOYAN = HB_TAG ('D','u','p','l'), /*7.0*/ + HB_SCRIPT_ELBASAN = HB_TAG ('E','l','b','a'), /*7.0*/ + HB_SCRIPT_GRANTHA = HB_TAG ('G','r','a','n'), /*7.0*/ + HB_SCRIPT_KHOJKI = HB_TAG ('K','h','o','j'), /*7.0*/ + HB_SCRIPT_KHUDAWADI = HB_TAG ('S','i','n','d'), /*7.0*/ + HB_SCRIPT_LINEAR_A = HB_TAG ('L','i','n','a'), /*7.0*/ + HB_SCRIPT_MAHAJANI = HB_TAG ('M','a','h','j'), /*7.0*/ + HB_SCRIPT_MANICHAEAN = HB_TAG ('M','a','n','i'), /*7.0*/ + HB_SCRIPT_MENDE_KIKAKUI = HB_TAG ('M','e','n','d'), /*7.0*/ + HB_SCRIPT_MODI = HB_TAG ('M','o','d','i'), /*7.0*/ + HB_SCRIPT_MRO = HB_TAG ('M','r','o','o'), /*7.0*/ + HB_SCRIPT_NABATAEAN = HB_TAG ('N','b','a','t'), /*7.0*/ + HB_SCRIPT_OLD_NORTH_ARABIAN = HB_TAG ('N','a','r','b'), /*7.0*/ + HB_SCRIPT_OLD_PERMIC = HB_TAG ('P','e','r','m'), /*7.0*/ + HB_SCRIPT_PAHAWH_HMONG = HB_TAG ('H','m','n','g'), /*7.0*/ + HB_SCRIPT_PALMYRENE = HB_TAG ('P','a','l','m'), /*7.0*/ + HB_SCRIPT_PAU_CIN_HAU = HB_TAG ('P','a','u','c'), /*7.0*/ + HB_SCRIPT_PSALTER_PAHLAVI = HB_TAG ('P','h','l','p'), /*7.0*/ + HB_SCRIPT_SIDDHAM = HB_TAG ('S','i','d','d'), /*7.0*/ + HB_SCRIPT_TIRHUTA = HB_TAG ('T','i','r','h'), /*7.0*/ + HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'), /*7.0*/ + + HB_SCRIPT_AHOM = HB_TAG ('A','h','o','m'), /*8.0*/ + HB_SCRIPT_ANATOLIAN_HIEROGLYPHS = HB_TAG ('H','l','u','w'), /*8.0*/ + HB_SCRIPT_HATRAN = HB_TAG ('H','a','t','r'), /*8.0*/ + HB_SCRIPT_MULTANI = HB_TAG ('M','u','l','t'), /*8.0*/ + HB_SCRIPT_OLD_HUNGARIAN = HB_TAG ('H','u','n','g'), /*8.0*/ + HB_SCRIPT_SIGNWRITING = HB_TAG ('S','g','n','w'), /*8.0*/ + + /* + * Since 1.3.0 + */ + HB_SCRIPT_ADLAM = HB_TAG ('A','d','l','m'), /*9.0*/ + HB_SCRIPT_BHAIKSUKI = HB_TAG ('B','h','k','s'), /*9.0*/ + HB_SCRIPT_MARCHEN = HB_TAG ('M','a','r','c'), /*9.0*/ + HB_SCRIPT_OSAGE = HB_TAG ('O','s','g','e'), /*9.0*/ + HB_SCRIPT_TANGUT = HB_TAG ('T','a','n','g'), /*9.0*/ + HB_SCRIPT_NEWA = HB_TAG ('N','e','w','a'), /*9.0*/ + + /* + * Since 1.6.0 + */ + HB_SCRIPT_MASARAM_GONDI = HB_TAG ('G','o','n','m'), /*10.0*/ + HB_SCRIPT_NUSHU = HB_TAG ('N','s','h','u'), /*10.0*/ + HB_SCRIPT_SOYOMBO = HB_TAG ('S','o','y','o'), /*10.0*/ + HB_SCRIPT_ZANABAZAR_SQUARE = HB_TAG ('Z','a','n','b'), /*10.0*/ + + /* + * Since 1.8.0 + */ + HB_SCRIPT_DOGRA = HB_TAG ('D','o','g','r'), /*11.0*/ + HB_SCRIPT_GUNJALA_GONDI = HB_TAG ('G','o','n','g'), /*11.0*/ + HB_SCRIPT_HANIFI_ROHINGYA = HB_TAG ('R','o','h','g'), /*11.0*/ + HB_SCRIPT_MAKASAR = HB_TAG ('M','a','k','a'), /*11.0*/ + HB_SCRIPT_MEDEFAIDRIN = HB_TAG ('M','e','d','f'), /*11.0*/ + HB_SCRIPT_OLD_SOGDIAN = HB_TAG ('S','o','g','o'), /*11.0*/ + HB_SCRIPT_SOGDIAN = HB_TAG ('S','o','g','d'), /*11.0*/ + + /* + * Since 2.4.0 + */ + HB_SCRIPT_ELYMAIC = HB_TAG ('E','l','y','m'), /*12.0*/ + HB_SCRIPT_NANDINAGARI = HB_TAG ('N','a','n','d'), /*12.0*/ + HB_SCRIPT_NYIAKENG_PUACHUE_HMONG = HB_TAG ('H','m','n','p'), /*12.0*/ + HB_SCRIPT_WANCHO = HB_TAG ('W','c','h','o'), /*12.0*/ + + /* + * Since 2.6.7 + */ + HB_SCRIPT_CHORASMIAN = HB_TAG ('C','h','r','s'), /*13.0*/ + HB_SCRIPT_DIVES_AKURU = HB_TAG ('D','i','a','k'), /*13.0*/ + HB_SCRIPT_KHITAN_SMALL_SCRIPT = HB_TAG ('K','i','t','s'), /*13.0*/ + HB_SCRIPT_YEZIDI = HB_TAG ('Y','e','z','i'), /*13.0*/ + + /* + * Since 3.0.0 + */ + HB_SCRIPT_CYPRO_MINOAN = HB_TAG ('C','p','m','n'), /*14.0*/ + HB_SCRIPT_OLD_UYGHUR = HB_TAG ('O','u','g','r'), /*14.0*/ + HB_SCRIPT_TANGSA = HB_TAG ('T','n','s','a'), /*14.0*/ + HB_SCRIPT_TOTO = HB_TAG ('T','o','t','o'), /*14.0*/ + HB_SCRIPT_VITHKUQI = HB_TAG ('V','i','t','h'), /*14.0*/ + + /* + * Since 3.4.0 + */ + HB_SCRIPT_MATH = HB_TAG ('Z','m','t','h'), + + /* + * Since 5.2.0 + */ + HB_SCRIPT_KAWI = HB_TAG ('K','a','w','i'), /*15.0*/ + HB_SCRIPT_NAG_MUNDARI = HB_TAG ('N','a','g','m'), /*15.0*/ + + /* + * Since 10.0.0 + */ + HB_SCRIPT_GARAY = HB_TAG ('G','a','r','a'), /*16.0*/ + HB_SCRIPT_GURUNG_KHEMA = HB_TAG ('G','u','k','h'), /*16.0*/ + HB_SCRIPT_KIRAT_RAI = HB_TAG ('K','r','a','i'), /*16.0*/ + HB_SCRIPT_OL_ONAL = HB_TAG ('O','n','a','o'), /*16.0*/ + HB_SCRIPT_SUNUWAR = HB_TAG ('S','u','n','u'), /*16.0*/ + HB_SCRIPT_TODHRI = HB_TAG ('T','o','d','r'), /*16.0*/ + HB_SCRIPT_TULU_TIGALARI = HB_TAG ('T','u','t','g'), /*16.0*/ + + /* No script set. */ + HB_SCRIPT_INVALID = HB_TAG_NONE, + + /*< private >*/ + + /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t + * without risking undefined behavior. We have two, for historical reasons. + * HB_TAG_MAX used to be unsigned, but that was invalid Ansi C, so was changed + * to _HB_SCRIPT_MAX_VALUE to be equal to HB_TAG_MAX_SIGNED as well. + * + * See this thread for technicalities: + * + * https://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html + */ + _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX_SIGNED, /*< skip >*/ + _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/ + +} hb_script_t; + + +#endif /* HB_SCRIPT_LIST_H */ diff --git a/modules/freetype2/src/autofit/module.mk b/modules/freetype2/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2024 by +# Copyright (C) 2003-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/autofit/rules.mk b/modules/freetype2/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2024 by +# Copyright (C) 2003-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -28,10 +28,12 @@ AUTOF_COMPILE := $(CC) $(ANSIFLAGS) \ # AUTOF driver sources (i.e., C files) # -AUTOF_DRV_SRC := $(AUTOF_DIR)/afblue.c \ +AUTOF_DRV_SRC := $(AUTOF_DIR)/afadjust.c \ + $(AUTOF_DIR)/afblue.c \ $(AUTOF_DIR)/afcjk.c \ $(AUTOF_DIR)/afdummy.c \ $(AUTOF_DIR)/afglobal.c \ + $(AUTOF_DIR)/afgsub.c \ $(AUTOF_DIR)/afhints.c \ $(AUTOF_DIR)/afindic.c \ $(AUTOF_DIR)/aflatin.c \ @@ -39,18 +41,20 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afblue.c \ $(AUTOF_DIR)/afmodule.c \ $(AUTOF_DIR)/afranges.c \ $(AUTOF_DIR)/afshaper.c \ - $(AUTOF_DIR)/ft-hb.c + $(AUTOF_DIR)/ft-hb.c \ + $(AUTOF_DIR)/ft-hb-ft.c # AUTOF driver headers # -AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ - $(AUTOF_DIR)/afcover.h \ - $(AUTOF_DIR)/aferrors.h \ - $(AUTOF_DIR)/afscript.h \ - $(AUTOF_DIR)/afstyles.h \ - $(AUTOF_DIR)/aftypes.h \ - $(AUTOF_DIR)/afws-decl.h \ - $(AUTOF_DIR)/afws-iter.h +AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ + $(AUTOF_DIR)/afcover.h \ + $(AUTOF_DIR)/aferrors.h \ + $(AUTOF_DIR)/afscript.h \ + $(AUTOF_DIR)/afstyles.h \ + $(AUTOF_DIR)/aftypes.h \ + $(AUTOF_DIR)/afws-decl.h \ + $(AUTOF_DIR)/afws-iter.h \ + $(AUTOF_DIR)/ft-hb-decls.h # AUTOF driver object(s) diff --git a/modules/freetype2/src/base/ftadvanc.c b/modules/freetype2/src/base/ftadvanc.c @@ -4,7 +4,7 @@ * * Quick computation of advance widths (body). * - * Copyright (C) 2008-2024 by + * Copyright (C) 2008-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftbase.c b/modules/freetype2/src/base/ftbase.c @@ -4,7 +4,7 @@ * * Single object library component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include "ftadvanc.c" -#include "ftcalc.c" #include "ftcolor.c" #include "ftdbgmem.c" #include "fterrors.c" @@ -35,6 +34,7 @@ #include "ftsnames.c" #include "ftstream.c" #include "fttrigon.c" +#include "ftcalc.c" /* included after FT_MulFix callers to inline it */ #include "ftutil.c" diff --git a/modules/freetype2/src/base/ftbase.h b/modules/freetype2/src/base/ftbase.h @@ -4,7 +4,7 @@ * * Private functions used in the `base' module (specification). * - * Copyright (C) 2008-2024 by + * Copyright (C) 2008-2025 by * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. * * This file is part of the FreeType project, and may only be used, @@ -34,7 +34,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_MAC_FONTS /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */ - /* see https://support.microsoft.com/en-us/kb/130437 */ + /* see https://jeffpar.github.io/kbarchive/kb/130/Q130437/ */ #define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL diff --git a/modules/freetype2/src/base/ftbbox.c b/modules/freetype2/src/base/ftbbox.c @@ -4,7 +4,7 @@ * * FreeType bbox computation (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/modules/freetype2/src/base/ftbdf.c b/modules/freetype2/src/base/ftbdf.c @@ -4,7 +4,7 @@ * * FreeType API for accessing BDF-specific strings (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftbitmap.c b/modules/freetype2/src/base/ftbitmap.c @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -876,13 +876,13 @@ #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE5(( "FT_Bitmap_Blend:\n" )); - FT_TRACE5(( " source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n", + FT_TRACE5(( " source bitmap: (%ld, %ld) -- (%ld, %ld); %u x %u\n", source_llx / 64, source_lly / 64, source_urx / 64, source_ury / 64, source_->width, source_->rows )); if ( target->width && target->rows ) - FT_TRACE5(( " target bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n", + FT_TRACE5(( " target bitmap: (%ld, %ld) -- (%ld, %ld); %u x %u\n", target_llx / 64, target_lly / 64, target_urx / 64, target_ury / 64, target->width, target->rows )); @@ -890,7 +890,7 @@ FT_TRACE5(( " target bitmap: empty\n" )); if ( final_width && final_rows ) - FT_TRACE5(( " final bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n", + FT_TRACE5(( " final bitmap: (%ld, %ld) -- (%ld, %ld); %u x %u\n", final_llx / 64, final_lly / 64, final_urx / 64, final_ury / 64, final_width, final_rows )); @@ -924,7 +924,7 @@ if ( FT_LONG_MAX / target->pitch < (int)target->rows ) { - FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%d x %d)\n", + FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%u x %u)\n", final_width, final_rows )); return FT_THROW( Invalid_Argument ); } @@ -952,7 +952,7 @@ if ( FT_LONG_MAX / new_pitch < (int)final_rows ) { - FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%d x %d)\n", + FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%u x %u)\n", final_width, final_rows )); return FT_THROW( Invalid_Argument ); } diff --git a/modules/freetype2/src/base/ftcalc.c b/modules/freetype2/src/base/ftcalc.c @@ -4,7 +4,7 @@ * * Arithmetic computations (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -38,24 +38,11 @@ #include <freetype/internal/ftdebug.h> #include <freetype/internal/ftobjs.h> - -#ifdef FT_MULFIX_ASSEMBLER -#undef FT_MulFix + /* cancel inlining macro from internal/ftcalc.h */ +#ifdef FT_MulFix +# undef FT_MulFix #endif -/* we need to emulate a 64-bit data type if a real one isn't available */ - -#ifndef FT_INT64 - - typedef struct FT_Int64_ - { - FT_UInt32 lo; - FT_UInt32 hi; - - } FT_Int64; - -#endif /* !FT_INT64 */ - /************************************************************************** * @@ -88,7 +75,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) { - return ( ADD_LONG( a, 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL; + return ADD_LONG( a, 0x8000L - ( a < 0 ) ) & ~0xFFFFL; } @@ -97,7 +84,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) { - return ( ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL; + return ADD_LONG( a, 0xFFFFL ) & ~0xFFFFL; } @@ -225,18 +212,18 @@ FT_MulFix( FT_Long a_, FT_Long b_ ) { -#ifdef FT_MULFIX_ASSEMBLER +#ifdef FT_CONFIG_OPTION_INLINE_MULFIX - return FT_MULFIX_ASSEMBLER( (FT_Int32)a_, (FT_Int32)b_ ); + return FT_MulFix_64( a_, b_ ); #else - FT_Int64 ab = (FT_Int64)a_ * (FT_Int64)b_; + FT_Int64 ab = MUL_INT64( a_, b_ ); /* this requires arithmetic right shift of signed numbers */ - return (FT_Long)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 ); + return (FT_Long)( ( ab + 0x8000L + ( ab >> 63 ) ) >> 16 ); -#endif /* FT_MULFIX_ASSEMBLER */ +#endif /* FT_CONFIG_OPTION_INLINE_MULFIX */ } @@ -975,43 +962,36 @@ #else - FT_Int result; + FT_Int64 z1, z2; + FT_Int result; - if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && - ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) + if ( (FT_ULong)FT_ABS( in_x ) + (FT_ULong)FT_ABS( out_y ) <= 92681UL ) { - FT_Long z1 = MUL_LONG( in_x, out_y ); - FT_Long z2 = MUL_LONG( in_y, out_x ); - - - if ( z1 > z2 ) - result = +1; - else if ( z1 < z2 ) - result = -1; - else - result = 0; + z1.lo = (FT_UInt32)in_x * (FT_UInt32)out_y; + z1.hi = (FT_UInt32)( (FT_Int32)z1.lo >> 31 ); /* sign-expansion */ } - else /* products might overflow 32 bits */ - { - FT_Int64 z1, z2; - - - /* XXX: this function does not allow 64-bit arguments */ + else ft_multo64( (FT_UInt32)in_x, (FT_UInt32)out_y, &z1 ); - ft_multo64( (FT_UInt32)in_y, (FT_UInt32)out_x, &z2 ); - if ( z1.hi > z2.hi ) - result = +1; - else if ( z1.hi < z2.hi ) - result = -1; - else if ( z1.lo > z2.lo ) - result = +1; - else if ( z1.lo < z2.lo ) - result = -1; - else - result = 0; + if ( (FT_ULong)FT_ABS( in_y ) + (FT_ULong)FT_ABS( out_x ) <= 92681UL ) + { + z2.lo = (FT_UInt32)in_y * (FT_UInt32)out_x; + z2.hi = (FT_UInt32)( (FT_Int32)z2.lo >> 31 ); /* sign-expansion */ } + else + ft_multo64( (FT_UInt32)in_y, (FT_UInt32)out_x, &z2 ); + + if ( (FT_Int32)z1.hi > (FT_Int32)z2.hi ) + result = +1; + else if ( (FT_Int32)z1.hi < (FT_Int32)z2.hi ) + result = -1; + else if ( z1.lo > z2.lo ) + result = +1; + else if ( z1.lo < z2.lo ) + result = -1; + else + result = 0; /* XXX: only the sign of return value, +1/0/-1 must be used */ return result; @@ -1065,62 +1045,4 @@ } - FT_BASE_DEF( FT_Int32 ) - FT_MulAddFix( FT_Fixed* s, - FT_Int32* f, - FT_UInt count ) - { - FT_UInt i; - FT_Int64 temp; - - -#ifdef FT_INT64 - temp = 0; - - for ( i = 0; i < count; ++i ) - temp += (FT_Int64)s[i] * f[i]; - - return (FT_Int32)( ( temp + 0x8000 ) >> 16 ); -#else - temp.hi = 0; - temp.lo = 0; - - for ( i = 0; i < count; ++i ) - { - FT_Int64 multResult; - - FT_Int sign = 1; - FT_UInt32 carry = 0; - - FT_UInt32 scalar; - FT_UInt32 factor; - - - FT_MOVE_SIGN( FT_UInt32, s[i], scalar, sign ); - FT_MOVE_SIGN( FT_UInt32, f[i], factor, sign ); - - ft_multo64( scalar, factor, &multResult ); - - if ( sign < 0 ) - { - /* Emulated `FT_Int64` negation. */ - carry = ( multResult.lo == 0 ); - - multResult.lo = ~multResult.lo + 1; - multResult.hi = ~multResult.hi + carry; - } - - FT_Add64( &temp, &multResult, &temp ); - } - - /* Shift and round value. */ - return (FT_Int32)( ( ( temp.hi << 16 ) | ( temp.lo >> 16 ) ) - + ( 1 & ( temp.lo >> 15 ) ) ); - - -#endif /* !FT_INT64 */ - - } - - /* END */ diff --git a/modules/freetype2/src/base/ftcid.c b/modules/freetype2/src/base/ftcid.c @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information. * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftcolor.c b/modules/freetype2/src/base/ftcolor.c @@ -4,7 +4,7 @@ * * FreeType's glyph color management (body). * - * Copyright (C) 2018-2024 by + * Copyright (C) 2018-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -56,9 +56,7 @@ FT_Color* *apalette ) { FT_Error error; - - TT_Face ttface; - SFNT_Service sfnt; + TT_Face ttface = (TT_Face)face; if ( !face ) @@ -72,14 +70,17 @@ return FT_Err_Ok; } - ttface = (TT_Face)face; - sfnt = (SFNT_Service)ttface->sfnt; + if ( palette_index != ttface->palette_index ) + { + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; - error = sfnt->set_palette( ttface, palette_index ); - if ( error ) - return error; - ttface->palette_index = palette_index; + error = sfnt->set_palette( ttface, palette_index ); + if ( error ) + return error; + + ttface->palette_index = palette_index; + } if ( apalette ) *apalette = ttface->palette; diff --git a/modules/freetype2/src/base/ftdbgmem.c b/modules/freetype2/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ * * Memory debugger (body). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -139,7 +139,6 @@ } FT_MemTableRec; -#define FT_MEM_SIZE_MIN 7 #define FT_MEM_SIZE_MAX 13845163 #define FT_FILENAME( x ) ( (x) ? (x) : "unknown file" ) diff --git a/modules/freetype2/src/base/ftdebug.c b/modules/freetype2/src/base/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -64,7 +64,7 @@ * with the actual log message if set to true. * * 5. The flag `ft_timestamp_flag` prints time along with the actual log - * message if set to ture. + * message if set to true. * * 6. `ft_have_newline_char` is used to differentiate between a log * message with and without a trailing newline character. diff --git a/modules/freetype2/src/base/fterrors.c b/modules/freetype2/src/base/fterrors.c @@ -4,7 +4,7 @@ * * FreeType API for error code handling. * - * Copyright (C) 2018-2024 by + * Copyright (C) 2018-2025 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/modules/freetype2/src/base/ftfntfmt.c b/modules/freetype2/src/base/ftfntfmt.c @@ -4,7 +4,7 @@ * * FreeType utility file for font formats (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftfstype.c b/modules/freetype2/src/base/ftfstype.c @@ -4,7 +4,7 @@ * * FreeType utility file to access FSType data (body). * - * Copyright (C) 2008-2024 by + * Copyright (C) 2008-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftgasp.c b/modules/freetype2/src/base/ftgasp.c @@ -4,7 +4,7 @@ * * Access of TrueType's `gasp' table (body). * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftgloadr.c b/modules/freetype2/src/base/ftgloadr.c @@ -4,7 +4,7 @@ * * The FreeType glyph loader (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftglyph.c b/modules/freetype2/src/base/ftglyph.c @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftgxval.c b/modules/freetype2/src/base/ftgxval.c @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * Masatake YAMATO, Redhat K.K, * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/base/fthash.c b/modules/freetype2/src/base/fthash.c @@ -41,6 +41,7 @@ #include <freetype/internal/fthash.h> #include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftobjs.h> #define INITIAL_HT_SIZE 241 @@ -233,7 +234,8 @@ hash_insert( FT_Hashkey key, size_t data, FT_Hash hash, - FT_Memory memory ) + FT_Memory memory, + FT_Bool overwrite ) { FT_Hashnode nn; FT_Hashnode* bp = hash_bucket( key, hash ); @@ -259,7 +261,7 @@ hash->used++; } - else + else if ( overwrite ) nn->data = data; Exit: @@ -278,7 +280,7 @@ hk.str = key; - return hash_insert( hk, data, hash, memory ); + return hash_insert( hk, data, hash, memory, TRUE ); } @@ -293,7 +295,37 @@ hk.num = num; - return hash_insert( hk, data, hash, memory ); + return hash_insert( hk, data, hash, memory, TRUE ); + } + + + FT_Error + ft_hash_str_insert_no_overwrite( const char* key, + size_t data, + FT_Hash hash, + FT_Memory memory ) + { + FT_Hashkey hk; + + + hk.str = key; + + return hash_insert( hk, data, hash, memory, FALSE ); + } + + + FT_Error + ft_hash_num_insert_no_overwrite( FT_Int num, + size_t data, + FT_Hash hash, + FT_Memory memory ) + { + FT_Hashkey hk; + + + hk.num = num; + + return hash_insert( hk, data, hash, memory, FALSE ); } @@ -335,4 +367,68 @@ } + FT_Bool + ft_hash_num_iterator( FT_UInt *idx, + FT_Int *key, + size_t *value, + FT_Hash hash ) + { + FT_Hashnode nn = NULL; + + + while ( 1 ) + { + if ( *idx >= hash->size ) + return 0; + + nn = hash->table[*idx]; + if ( nn ) + break; + + (*idx)++; + } + + if ( key ) + *key = nn->key.num; + if ( value ) + *value = nn->data; + + (*idx)++; + + return 1; + } + + + FT_Bool + ft_hash_str_iterator( FT_UInt *idx, + const char* *key, + size_t *value, + FT_Hash hash ) + { + FT_Hashnode nn = NULL; + + + while ( 1 ) + { + if ( *idx >= hash->size ) + return 0; + + nn = hash->table[*idx]; + if ( nn ) + break; + + (*idx)++; + } + + if ( key ) + *key = nn->key.str; + if ( value ) + *value = nn->data; + + (*idx)++; + + return 1; + } + + /* END */ diff --git a/modules/freetype2/src/base/ftinit.c b/modules/freetype2/src/base/ftinit.c @@ -4,7 +4,7 @@ * * FreeType initialization layer (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftlcdfil.c b/modules/freetype2/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ * * FreeType API for color filtering of subpixel bitmap glyphs (body). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftmac.c b/modules/freetype2/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-2024 by + * Copyright (C) 1996-2025 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/modules/freetype2/src/base/ftmm.c b/modules/freetype2/src/base/ftmm.c @@ -4,7 +4,7 @@ * * Multiple Master font support (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -292,6 +292,9 @@ if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); + if ( !num_coords && !FT_IS_VARIATION( face ) ) + return FT_Err_Ok; /* nothing to be done */ + error = ft_face_get_mm_service( face, &service_mm ); if ( !error ) { @@ -299,15 +302,21 @@ if ( service_mm->set_var_design ) error = service_mm->set_var_design( face, num_coords, coords ); - if ( !error || error == -1 ) + if ( !error || error == -1 || error == -2 ) { FT_Bool is_variation_old = FT_IS_VARIATION( face ); - if ( num_coords ) - face->face_flags |= FT_FACE_FLAG_VARIATION; - else - face->face_flags &= ~FT_FACE_FLAG_VARIATION; + if ( error != -1 ) + { + if ( error == -2 ) /* -2 means is_variable. */ + { + face->face_flags |= FT_FACE_FLAG_VARIATION; + error = FT_Err_Ok; + } + else + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } if ( service_mm->construct_ps_name ) { @@ -474,15 +483,21 @@ if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); - if ( !error || error == -1 ) + if ( !error || error == -1 || error == -2 ) { FT_Bool is_variation_old = FT_IS_VARIATION( face ); - if ( num_coords ) - face->face_flags |= FT_FACE_FLAG_VARIATION; - else - face->face_flags &= ~FT_FACE_FLAG_VARIATION; + if ( error != -1 ) + { + if ( error == -2 ) /* -2 means is_variable. */ + { + face->face_flags |= FT_FACE_FLAG_VARIATION; + error = FT_Err_Ok; + } + else + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } if ( service_mm->construct_ps_name ) { diff --git a/modules/freetype2/src/base/ftobjs.c b/modules/freetype2/src/base/ftobjs.c @@ -4,7 +4,7 @@ * * The FreeType private base classes (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -905,7 +905,6 @@ FT_Library library; FT_Bool autohint = FALSE; FT_Module hinter; - TT_Face ttface = (TT_Face)face; if ( !face || !face->size || !face->glyph ) @@ -983,6 +982,7 @@ { FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); FT_Bool is_light_type1; + TT_Face ttface = (TT_Face)face; /* only the new Adobe engine (for both CFF and Type 1) is `light'; */ @@ -994,8 +994,7 @@ /* the check for `num_locations' assures that we actually */ /* test for instructions in a TTF and not in a CFF-based OTF */ /* */ - /* since `maxSizeOfInstructions' might be unreliable, we */ - /* check the size of the `fpgm' and `prep' tables, too -- */ + /* we check the size of the `fpgm' and `prep' tables, too -- */ /* the assumption is that there don't exist real TTFs where */ /* both `fpgm' and `prep' tables are missing */ if ( ( mode == FT_RENDER_MODE_LIGHT && @@ -1003,9 +1002,8 @@ !is_light_type1 ) ) || ( FT_IS_SFNT( face ) && ttface->num_locations && - ttface->max_profile.maxSizeOfInstructions == 0 && ttface->font_program_size == 0 && - ttface->cvt_program_size == 0 ) ) + ttface->cvt_program_size <= 7 ) ) autohint = TRUE; } } @@ -1172,9 +1170,9 @@ } #ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE5(( "FT_Load_Glyph: index %d, flags 0x%x\n", + FT_TRACE5(( "FT_Load_Glyph: index %u, flags 0x%x\n", glyph_index, load_flags )); - FT_TRACE5(( " bitmap %dx%d %s, %s (mode %d)\n", + FT_TRACE5(( " bitmap %ux%u %s, %s (mode %d)\n", slot->bitmap.width, slot->bitmap.rows, slot->outline.points ? @@ -1253,14 +1251,14 @@ FT_Driver driver = (FT_Driver)driver_; - /* finalize client-specific data */ - if ( size->generic.finalizer ) - size->generic.finalizer( size ); - /* finalize format-specific stuff */ if ( driver->clazz->done_size ) driver->clazz->done_size( size ); + /* finalize client-specific data */ + if ( size->generic.finalizer ) + size->generic.finalizer( size ); + FT_FREE( size->internal ); FT_FREE( size ); } @@ -1322,10 +1320,6 @@ driver ); face->size = NULL; - /* now discard client data */ - if ( face->generic.finalizer ) - face->generic.finalizer( face ); - /* discard charmaps */ destroy_charmaps( face, memory ); @@ -1340,6 +1334,10 @@ face->stream = NULL; + /* now discard client data */ + if ( face->generic.finalizer ) + face->generic.finalizer( face ); + /* get rid of it */ if ( face->internal ) { @@ -1359,21 +1357,9 @@ } - /************************************************************************** - * - * @Function: - * find_unicode_charmap - * - * @Description: - * This function finds a Unicode charmap, if there is one. - * And if there is more than one, it tries to favour the more - * extensive one, i.e., one that supports UCS-4 against those which - * are limited to the BMP (said UCS-2 encoding.) - * - * This function is called from open_face() (just below), and also - * from FT_Select_Charmap( ..., FT_ENCODING_UNICODE ). - */ - static FT_Error + /* documentation is in ftobjs.h */ + + FT_BASE_DEF( FT_Error ) find_unicode_charmap( FT_Face face ) { FT_CharMap* first; @@ -2125,7 +2111,7 @@ if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len ) goto Exit2; - FT_TRACE3(( " Load POST fragment #%d (%ld byte) to buffer" + FT_TRACE3(( " Load POST fragment #%d (%lu byte) to buffer" " %p + 0x%08lx\n", i, rlen, (void*)pfb_data, pfb_pos )); @@ -2398,7 +2384,7 @@ is_darwin_vfs = ft_raccess_rule_by_darwin_vfs( library, i ); if ( is_darwin_vfs && vfs_rfork_has_no_font ) { - FT_TRACE3(( "Skip rule %d: darwin vfs resource fork" + FT_TRACE3(( "Skip rule %u: darwin vfs resource fork" " is already checked and" " no font is found\n", i )); @@ -2407,7 +2393,7 @@ if ( errors[i] ) { - FT_TRACE3(( "Error 0x%x has occurred in rule %d\n", + FT_TRACE3(( "Error 0x%x has occurred in rule %u\n", errors[i], i )); continue; } @@ -2415,7 +2401,7 @@ args2.flags = FT_OPEN_PATHNAME; args2.pathname = file_names[i] ? file_names[i] : args->pathname; - FT_TRACE3(( "Try rule %d: %s (offset=%ld) ...", + FT_TRACE3(( "Try rule %u: %s (offset=%ld) ...", i, args2.pathname, offsets[i] )); error = FT_Stream_New( library, &args2, &stream2 ); @@ -5044,9 +5030,9 @@ static void Destroy_Module( FT_Module module ) { - FT_Memory memory = module->memory; - FT_Module_Class* clazz = module->clazz; - FT_Library library = module->library; + const FT_Module_Class* clazz = module->clazz; + FT_Library library = module->library; + FT_Memory memory = module->memory; if ( library && library->auto_hinter == module ) @@ -5125,9 +5111,9 @@ goto Exit; /* base initialization */ + module->clazz = clazz; module->library = library; module->memory = memory; - module->clazz = (FT_Module_Class*)clazz; /* check whether the module is a renderer - this must be performed */ /* before the normal module initialization */ diff --git a/modules/freetype2/src/base/ftotval.c b/modules/freetype2/src/base/ftotval.c @@ -4,7 +4,7 @@ * * FreeType API for validating OpenType tables (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftoutln.c b/modules/freetype2/src/base/ftoutln.c @@ -4,7 +4,7 @@ * * FreeType outline management (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftpatent.c b/modules/freetype2/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-2024 by + * Copyright (C) 2007-2025 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftpfr.c b/modules/freetype2/src/base/ftpfr.c @@ -4,7 +4,7 @@ * * FreeType API for accessing PFR-specific data (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftpsprop.c b/modules/freetype2/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-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftrfork.c b/modules/freetype2/src/base/ftrfork.c @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * Masatake YAMATO and Redhat K.K. * * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are @@ -269,14 +269,8 @@ * According to Inside Macintosh: More Macintosh Toolbox, * "Resource IDs" (1-46), there are some reserved IDs. * However, FreeType2 is not a font synthesizer, no need - * to check the acceptable resource ID. + * to check the acceptable resource ID or its attributes. */ - if ( temp < 0 ) - { - error = FT_THROW( Invalid_Table ); - goto Exit; - } - ref[j].offset = temp & 0xFFFFFFL; FT_TRACE3(( " [%d]:" diff --git a/modules/freetype2/src/base/ftsnames.c b/modules/freetype2/src/base/ftsnames.c @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftstream.c b/modules/freetype2/src/base/ftstream.c @@ -4,7 +4,7 @@ * * I/O stream support (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -242,7 +242,7 @@ FT_ULong read_bytes; - FT_TRACE7(( "FT_Stream_EnterFrame: %ld bytes\n", count )); + FT_TRACE7(( "FT_Stream_EnterFrame: %lu bytes\n", count )); /* check for nested frame access */ FT_ASSERT( stream && stream->cursor == 0 ); diff --git a/modules/freetype2/src/base/ftstroke.c b/modules/freetype2/src/base/ftstroke.c @@ -4,7 +4,7 @@ * * FreeType path stroker (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1070,7 +1070,7 @@ if ( theta == FT_ANGLE_PI2 ) theta = -rotate; - phi = stroker->angle_in + theta + rotate; + phi = stroker->angle_in + theta + rotate; FT_Vector_From_Polar( &sigma, stroker->miter_limit, theta ); @@ -1371,7 +1371,7 @@ arc[1] = *control; arc[2] = stroker->center; - while ( arc >= bez_stack ) + do { FT_Angle angle_in, angle_out; @@ -1524,10 +1524,12 @@ } } - arc -= 2; - stroker->angle_in = angle_out; - } + + if ( arc == bez_stack ) + break; + arc -= 2; + } while ( 1 ); stroker->center = *to; stroker->line_length = 0; @@ -1577,7 +1579,7 @@ arc[2] = *control1; arc[3] = stroker->center; - while ( arc >= bez_stack ) + do { FT_Angle angle_in, angle_mid, angle_out; @@ -1741,10 +1743,12 @@ } } - arc -= 3; - stroker->angle_in = angle_out; - } + + if ( arc == bez_stack ) + break; + arc -= 3; + } while ( 1 ); stroker->center = *to; stroker->line_length = 0; diff --git a/modules/freetype2/src/base/ftsynth.c b/modules/freetype2/src/base/ftsynth.c @@ -4,7 +4,7 @@ * * FreeType synthesizing code for emboldening and slanting (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -141,7 +141,7 @@ /* * XXX: overflow check for 16-bit system, for compatibility * with FT_GlyphSlot_Embolden() since FreeType 2.1.10. - * unfortunately, this function return no informations + * unfortunately, this function returns no information * about the cause of error. */ if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN ) diff --git a/modules/freetype2/src/base/ftsystem.c b/modules/freetype2/src/base/ftsystem.c @@ -4,7 +4,7 @@ * * ANSI-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -280,7 +280,7 @@ stream->close = ft_ansi_stream_close; FT_TRACE1(( "FT_Stream_Open:" )); - FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n", + FT_TRACE1(( " opened `%s' (%lu bytes) successfully\n", filepathname, stream->size )); return FT_Err_Ok; diff --git a/modules/freetype2/src/base/fttrigon.c b/modules/freetype2/src/base/fttrigon.c @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (body). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/fttype1.c b/modules/freetype2/src/base/fttype1.c @@ -4,7 +4,7 @@ * * FreeType utility file for PS names support (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftutil.c b/modules/freetype2/src/base/ftutil.c @@ -4,7 +4,7 @@ * * FreeType utility file for memory and list management (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/ftver.rc b/modules/freetype2/src/base/ftver.rc @@ -4,7 +4,7 @@ /* */ /* FreeType VERSIONINFO resource for Windows DLLs. */ /* */ -/* Copyright (C) 2018-2024 by */ +/* Copyright (C) 2018-2025 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,8 +18,8 @@ #include<windows.h> -#define FT_VERSION 2,13,3,0 -#define FT_VERSION_STR "2.13.3" +#define FT_VERSION 2,14,1,0 +#define FT_VERSION_STR "2.14.1" VS_VERSION_INFO VERSIONINFO FILEVERSION FT_VERSION @@ -45,7 +45,7 @@ BEGIN VALUE "FileVersion", FT_VERSION_STR VALUE "ProductName", "FreeType" VALUE "ProductVersion", FT_VERSION_STR - VALUE "LegalCopyright", L"\x00A9 2000-2024 The FreeType Project www.freetype.org. All rights reserved." + VALUE "LegalCopyright", L"\x00A9 2000-2025 The FreeType Project freetype.org. All rights reserved." VALUE "InternalName", "freetype" VALUE "OriginalFilename", FT_FILENAME END diff --git a/modules/freetype2/src/base/ftwinfnt.c b/modules/freetype2/src/base/ftwinfnt.c @@ -4,7 +4,7 @@ * * FreeType API for accessing Windows FNT specific info (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/base/rules.mk b/modules/freetype2/src/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/bdf/bdf.h b/modules/freetype2/src/bdf/bdf.h @@ -57,39 +57,13 @@ FT_BEGIN_HEADER */ -#define BDF_CORRECT_METRICS 0x01 /* Correct invalid metrics when loading. */ -#define BDF_KEEP_COMMENTS 0x02 /* Preserve the font comments. */ -#define BDF_KEEP_UNENCODED 0x04 /* Keep the unencoded glyphs. */ -#define BDF_PROPORTIONAL 0x08 /* Font has proportional spacing. */ -#define BDF_MONOWIDTH 0x10 /* Font has mono width. */ -#define BDF_CHARCELL 0x20 /* Font has charcell spacing. */ +#define BDF_CORRECT_METRICS 0x1000 /* Correct metrics when loading. */ +#define BDF_KEEP_COMMENTS 0x2000 /* Preserve the font comments. */ +#define BDF_KEEP_UNENCODED 0x4000 /* Keep the unencoded glyphs. */ -#define BDF_ALL_SPACING ( BDF_PROPORTIONAL | \ - BDF_MONOWIDTH | \ - BDF_CHARCELL ) - -#define BDF_DEFAULT_LOAD_OPTIONS ( BDF_CORRECT_METRICS | \ - BDF_KEEP_COMMENTS | \ - BDF_KEEP_UNENCODED | \ - BDF_PROPORTIONAL ) - - - typedef struct bdf_options_t_ - { - int correct_metrics; - int keep_unencoded; - int keep_comments; - int font_spacing; - - } bdf_options_t; - - - /* Callback function type for unknown configuration options. */ - typedef int - (*bdf_options_callback_t)( bdf_options_t* opts, - char** params, - unsigned long nparams, - void* client_data ); +#define BDF_PROPORTIONAL 0x08 /* Font has proportional spacing. */ +#define BDF_MONOWIDTH 0x10 /* Font has mono width. */ +#define BDF_CHARCELL 0x20 /* Font has charcell spacing. */ /************************************************************************** @@ -167,9 +141,6 @@ FT_BEGIN_HEADER unsigned long resolution_y; /* Font vertical resolution. */ int spacing; /* Font spacing value. */ - - unsigned short monowidth; /* Logical width for monowidth font. */ - unsigned long default_char; /* Encoding of the default glyph. */ long font_ascent; /* Font ascent. */ @@ -190,7 +161,7 @@ FT_BEGIN_HEADER char* comments; /* Font comments. */ unsigned long comments_len; /* Length of comment string. */ - void* internal; /* Internal data for the font. */ + FT_Hash internal; /* Internal data for the font. */ unsigned short bpp; /* Bits per pixel. */ @@ -233,7 +204,7 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) bdf_load_font( FT_Stream stream, FT_Memory memory, - bdf_options_t* opts, + unsigned long flags, bdf_font_t* *font ); FT_LOCAL( void ) diff --git a/modules/freetype2/src/bdf/bdfdrivr.c b/modules/freetype2/src/bdf/bdfdrivr.c @@ -349,7 +349,6 @@ THE SOFTWARE. FT_Memory memory = FT_FACE_MEMORY( face ); bdf_font_t* font = NULL; - bdf_options_t options; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -360,12 +359,8 @@ THE SOFTWARE. if ( FT_STREAM_SEEK( 0 ) ) goto Exit; - options.correct_metrics = 1; /* FZ XXX: options semantics */ - options.keep_unencoded = 1; - options.keep_comments = 0; - options.font_spacing = BDF_PROPORTIONAL; - - error = bdf_load_font( stream, memory, &options, &font ); + error = bdf_load_font( stream, memory, + BDF_CORRECT_METRICS | BDF_KEEP_UNENCODED, &font ); if ( FT_ERR_EQ( error, Missing_Startfont_Field ) ) { FT_TRACE2(( " not a BDF file\n" )); @@ -394,10 +389,10 @@ THE SOFTWARE. bdf_property_t* prop = NULL; - FT_TRACE4(( " number of glyphs: allocated %ld (used %ld)\n", + FT_TRACE4(( " number of glyphs: allocated %lu (used %lu)\n", font->glyphs_size, font->glyphs_used )); - FT_TRACE4(( " number of unencoded glyphs: allocated %ld (used %ld)\n", + FT_TRACE4(( " number of unencoded glyphs: allocated %lu (used %lu)\n", font->unencoded_size, font->unencoded_used )); @@ -408,10 +403,18 @@ THE SOFTWARE. FT_FACE_FLAG_HORIZONTAL; prop = bdf_get_font_property( font, "SPACING" ); - if ( prop && prop->format == BDF_ATOM && - prop->value.atom && - ( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' || - *(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) ) + if ( prop && prop->value.atom ) + { + if ( prop->value.atom[0] == 'p' || prop->value.atom[0] == 'P' ) + font->spacing = BDF_PROPORTIONAL; + else if ( prop->value.atom[0] == 'm' || prop->value.atom[0] == 'M' ) + font->spacing = BDF_MONOWIDTH; + else if ( prop->value.atom[0] == 'c' || prop->value.atom[0] == 'C' ) + font->spacing = BDF_CHARCELL; + } + + if ( font->spacing == BDF_MONOWIDTH || + font->spacing == BDF_CHARCELL ) face->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; /* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */ @@ -444,19 +447,25 @@ THE SOFTWARE. long value; - /* sanity checks */ - if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF ) - { - font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF; - FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %ld\n", - font->font_ascent )); - } - if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF ) - { - font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF; - FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %ld\n", - font->font_descent )); - } + prop = bdf_get_font_property( font, "FONT_ASCENT" ); + if ( prop ) + font->font_ascent = prop->value.l; + else + font->font_ascent = font->bbx.ascent; + if ( font->font_ascent > 0x7FFF ) + font->font_ascent = 0x7FFF; + else if ( font->font_ascent < 0 ) + font->font_ascent = 0; + + prop = bdf_get_font_property( font, "FONT_DESCENT" ); + if ( prop ) + font->font_descent = prop->value.l; + else + font->font_descent = font->bbx.descent; + if ( font->font_descent > 0x7FFF ) + font->font_descent = 0x7FFF; + else if ( font->font_descent < 0 ) + font->font_descent = 0; bsize->height = (FT_Short)( font->font_ascent + font->font_descent ); @@ -591,6 +600,12 @@ THE SOFTWARE. resolution_y ); else bsize->x_ppem = bsize->y_ppem; + + prop = bdf_get_font_property( font, "DEFAULT_CHAR" ); + if ( prop ) + font->default_char = prop->value.ul; + else + font->default_char = ~0UL; } /* encoding table */ @@ -606,7 +621,7 @@ THE SOFTWARE. for ( n = 0; n < font->glyphs_size; n++ ) { (bdfface->en_table[n]).enc = cur[n].encoding; - FT_TRACE4(( " idx %ld, val 0x%lX\n", n, cur[n].encoding )); + FT_TRACE4(( " idx %lu, val 0x%lX\n", n, cur[n].encoding )); (bdfface->en_table[n]).glyph = (FT_UShort)n; if ( cur[n].encoding == font->default_char ) @@ -615,7 +630,7 @@ THE SOFTWARE. bdfface->default_glyph = (FT_UInt)n; else FT_TRACE1(( "BDF_Face_Init:" - " idx %ld is too large for this system\n", n )); + " idx %lu is too large for this system\n", n )); } } } @@ -802,7 +817,7 @@ THE SOFTWARE. goto Exit; } - FT_TRACE1(( "BDF_Glyph_Load: glyph index %d\n", glyph_index )); + FT_TRACE1(( "BDF_Glyph_Load: glyph index %u\n", glyph_index )); /* index 0 is the undefined glyph */ if ( glyph_index == 0 ) @@ -816,7 +831,7 @@ THE SOFTWARE. bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; if ( glyph.bpr > FT_INT_MAX ) - FT_TRACE1(( "BDF_Glyph_Load: too large pitch %ld is truncated\n", + FT_TRACE1(( "BDF_Glyph_Load: too large pitch %lu is truncated\n", glyph.bpr )); bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */ diff --git a/modules/freetype2/src/bdf/bdflib.c b/modules/freetype2/src/bdf/bdflib.c @@ -51,25 +51,6 @@ #define FT_COMPONENT bdflib -#define BUFSIZE 128 - - - /************************************************************************** - * - * Default BDF font options. - * - */ - - - static const bdf_options_t bdf_opts_ = - { - 1, /* Correct metrics. */ - 1, /* Preserve unencoded glyphs. */ - 0, /* Preserve comments. */ - BDF_PROPORTIONAL /* Default spacing. */ - }; - - /************************************************************************** * * Builtin BDF font properties. @@ -89,7 +70,6 @@ { "CHARSET_COLLECTIONS", BDF_ATOM, 1, { 0 } }, { "CHARSET_ENCODING", BDF_ATOM, 1, { 0 } }, { "CHARSET_REGISTRY", BDF_ATOM, 1, { 0 } }, - { "COMMENT", BDF_ATOM, 1, { 0 } }, { "COPYRIGHT", BDF_ATOM, 1, { 0 } }, { "DEFAULT_CHAR", BDF_CARDINAL, 1, { 0 } }, { "DESTINATION", BDF_CARDINAL, 1, { 0 } }, @@ -170,19 +150,6 @@ num_bdf_properties_ = sizeof ( bdf_properties_ ) / sizeof ( bdf_properties_[0] ); - - /* An auxiliary macro to parse properties, to be used in conditionals. */ - /* It behaves like `strncmp' but also tests the following character */ - /* whether it is a whitespace or null. */ - /* `property' is a constant string of length `n' to compare with. */ -#define _bdf_strncmp( name, property, n ) \ - ( ft_strncmp( name, property, n ) || \ - !( name[n] == ' ' || \ - name[n] == '\0' || \ - name[n] == '\n' || \ - name[n] == '\r' || \ - name[n] == '\t' ) ) - /* Auto correction messages. */ #define ACMSG1 "FONT_ASCENT property missing. " \ "Added `FONT_ASCENT %hd'.\n" @@ -195,28 +162,28 @@ #define ACMSG6 "Font descent != actual descent. Old: %d New: %d.\n" #define ACMSG7 "Font height != actual height. Old: %d New: %d.\n" #define ACMSG8 "Glyph scalable width (SWIDTH) adjustments made.\n" -#define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n" -#define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n" +#define ACMSG9 "SWIDTH field missing at line %lu. Set automatically.\n" +#define ACMSG10 "DWIDTH field missing at line %lu. Set to glyph width.\n" #define ACMSG11 "SIZE bits per pixel field adjusted to %hd.\n" #define ACMSG13 "Glyph %lu extra rows removed.\n" #define ACMSG14 "Glyph %lu extra columns removed.\n" -#define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n" +#define ACMSG15 "Incorrect glyph count: %lu indicated but %lu found.\n" #define ACMSG16 "Glyph %lu missing columns padded with zero bits.\n" -#define ACMSG17 "Adjusting number of glyphs to %ld.\n" +#define ACMSG17 "Adjusting number of glyphs to %lu.\n" /* Error messages. */ -#define ERRMSG1 "[line %ld] Missing `%s' line.\n" -#define ERRMSG2 "[line %ld] Font header corrupted or missing fields.\n" -#define ERRMSG3 "[line %ld] Font glyphs corrupted or missing fields.\n" -#define ERRMSG4 "[line %ld] BBX too big.\n" -#define ERRMSG5 "[line %ld] `%s' value too big.\n" -#define ERRMSG6 "[line %ld] Input line too long.\n" -#define ERRMSG7 "[line %ld] Font name too long.\n" -#define ERRMSG8 "[line %ld] Invalid `%s' value.\n" -#define ERRMSG9 "[line %ld] Invalid keyword.\n" +#define ERRMSG1 "[line %lu] Missing `%s' line.\n" +#define ERRMSG2 "[line %lu] Font header corrupted or missing fields.\n" +#define ERRMSG3 "[line %lu] Font glyphs corrupted or missing fields.\n" +#define ERRMSG4 "[line %lu] BBX too big.\n" +#define ERRMSG5 "[line %lu] `%s' value too big.\n" +#define ERRMSG6 "[line %lu] Input line too long.\n" +#define ERRMSG7 "[line %lu] Font name too long.\n" +#define ERRMSG8 "[line %lu] Invalid `%s' value.\n" +#define ERRMSG9 "[line %lu] Invalid keyword.\n" /* Debug messages. */ -#define DBGMSG1 " [%6ld] %s" /* no \n */ +#define DBGMSG1 " [%6lu] %s" /* no \n */ #define DBGMSG2 " (0x%lX)\n" @@ -227,28 +194,6 @@ */ - /* Function type for parsing lines of a BDF font. */ - - typedef FT_Error - (*bdf_line_func_t_)( char* line, - unsigned long linelen, - unsigned long lineno, - void* call_data, - void* client_data ); - - - /* List structure for splitting lines into fields. */ - - typedef struct bdf_list_t__ - { - char** field; - unsigned long size; - unsigned long used; - FT_Memory memory; - - } bdf_list_t_; - - /* Structure used while loading BDF fonts. */ typedef struct bdf_parse_t__ @@ -268,10 +213,8 @@ char* glyph_name; long glyph_enc; + bdf_glyph_t* glyph; bdf_font_t* font; - bdf_options_t* opts; - - bdf_list_t_ list; FT_Memory memory; unsigned long size; /* the stream size */ @@ -279,393 +222,36 @@ } bdf_parse_t_; + /* Function type for parsing lines of a BDF font. */ + + typedef FT_Error + (*bdf_line_func_t_)( char* line, + unsigned long linelen, + unsigned long lineno, + bdf_parse_t_* p, + void* next ); + + #define setsbit( m, cc ) \ ( m[(FT_Byte)(cc) >> 3] |= (FT_Byte)( 1 << ( (cc) & 7 ) ) ) #define sbitset( m, cc ) \ ( m[(FT_Byte)(cc) >> 3] & ( 1 << ( (cc) & 7 ) ) ) - static void - bdf_list_init_( bdf_list_t_* list, - FT_Memory memory ) - { - FT_ZERO( list ); - list->memory = memory; - } - - - static void - bdf_list_done_( bdf_list_t_* list ) - { - FT_Memory memory = list->memory; - - - if ( memory ) - { - FT_FREE( list->field ); - FT_ZERO( list ); - } - } - - - static FT_Error - bdf_list_ensure_( bdf_list_t_* list, - unsigned long num_items ) /* same as bdf_list_t_.used */ - { - FT_Error error = FT_Err_Ok; - - - if ( num_items > list->size ) - { - unsigned long oldsize = list->size; /* same as bdf_list_t_.size */ - unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5; - unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) ); - FT_Memory memory = list->memory; - - - if ( oldsize == bigsize ) - { - error = FT_THROW( Out_Of_Memory ); - goto Exit; - } - else if ( newsize < oldsize || newsize > bigsize ) - newsize = bigsize; - - if ( FT_QRENEW_ARRAY( list->field, oldsize, newsize ) ) - goto Exit; - - list->size = newsize; - } - - Exit: - return error; - } - - - static void - bdf_list_shift_( bdf_list_t_* list, - unsigned long n ) - { - unsigned long i, u; - - - if ( list == NULL || list->used == 0 || n == 0 ) - return; - - if ( n >= list->used ) - { - list->used = 0; - return; - } - - for ( u = n, i = 0; u < list->used; i++, u++ ) - list->field[i] = list->field[u]; - list->used -= n; - } - - - /* An empty string for empty fields. */ - - static const char empty[] = ""; /* XXX eliminate this */ - - - static char * - bdf_list_join_( bdf_list_t_* list, - int c, - unsigned long *alen ) - { - unsigned long i, j; - char* dp; - - - *alen = 0; - - if ( list == NULL || list->used == 0 ) - return NULL; - - dp = list->field[0]; - for ( i = j = 0; i < list->used; i++ ) - { - char* fp = list->field[i]; - - - while ( *fp ) - dp[j++] = *fp++; - - if ( i + 1 < list->used ) - dp[j++] = (char)c; - } - if ( dp != empty ) - dp[j] = 0; - - *alen = j; - return dp; - } - - - /* The code below ensures that we have at least 4 + 1 `field' */ - /* elements in `list' (which are possibly NULL) so that we */ - /* don't have to check the number of fields in most cases. */ - - static FT_Error - bdf_list_split_( bdf_list_t_* list, - const char* separators, - char* line, - unsigned long linelen ) - { - unsigned long final_empty; - int mult; - const char *sp, *end; - char *ep; - char seps[32]; - FT_Error error = FT_Err_Ok; - - - /* Initialize the list. */ - list->used = 0; - if ( list->size ) - { - list->field[0] = (char*)empty; - list->field[1] = (char*)empty; - list->field[2] = (char*)empty; - list->field[3] = (char*)empty; - list->field[4] = (char*)empty; - } - - /* If the line is empty, then simply return. */ - if ( linelen == 0 || line[0] == 0 ) - goto Exit; - - /* In the original code, if the `separators' parameter is NULL or */ - /* empty, the list is split into individual bytes. We don't need */ - /* this, so an error is signaled. */ - if ( separators == NULL || *separators == 0 ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - /* Prepare the separator bitmap. */ - FT_MEM_ZERO( seps, 32 ); - - /* If the very last character of the separator string is a plus, then */ - /* set the `mult' flag to indicate that multiple separators should be */ - /* collapsed into one. */ - for ( mult = 0, sp = separators; sp && *sp; sp++ ) - { - if ( *sp == '+' && *( sp + 1 ) == 0 ) - mult = 1; - else - setsbit( seps, *sp ); - } - - /* Break the line up into fields. */ - for ( final_empty = 0, sp = ep = line, end = sp + linelen; - sp < end && *sp; ) - { - /* Collect everything that is not a separator. */ - for ( ; *ep && !sbitset( seps, *ep ); ep++ ) - ; - - /* Resize the list if necessary. */ - if ( list->used == list->size ) - { - error = bdf_list_ensure_( list, list->used + 1 ); - if ( error ) - goto Exit; - } - - /* Assign the field appropriately. */ - list->field[list->used++] = ( ep > sp ) ? (char*)sp : (char*)empty; - - sp = ep; - - if ( mult ) - { - /* If multiple separators should be collapsed, do it now by */ - /* setting all the separator characters to 0. */ - for ( ; *ep && sbitset( seps, *ep ); ep++ ) - *ep = 0; - } - else if ( *ep != 0 ) - /* Don't collapse multiple separators by making them 0, so just */ - /* make the one encountered 0. */ - *ep++ = 0; - - final_empty = ( ep > sp && *ep == 0 ); - sp = ep; - } - - /* Finally, NULL-terminate the list. */ - if ( list->used + final_empty >= list->size ) - { - error = bdf_list_ensure_( list, list->used + final_empty + 1 ); - if ( error ) - goto Exit; - } - - if ( final_empty ) - list->field[list->used++] = (char*)empty; - - list->field[list->used] = NULL; - - Exit: - return error; - } - - -#define NO_SKIP 256 /* this value cannot be stored in a 'char' */ - - - static FT_Error - bdf_readstream_( FT_Stream stream, - bdf_line_func_t_ callback, - void* client_data, - unsigned long *lno ) + static char* + bdf_strtok_( char* line, + int delim ) { - bdf_line_func_t_ cb; - unsigned long lineno, buf_size; - int refill, hold, to_skip; - ptrdiff_t bytes, start, end, cursor, avail; - char* buf = NULL; - FT_Memory memory = stream->memory; - FT_Error error = FT_Err_Ok; - - - if ( callback == NULL ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - /* initial size and allocation of the input buffer */ - buf_size = 1024; - - if ( FT_QALLOC( buf, buf_size ) ) - goto Exit; - - cb = callback; - lineno = 1; - buf[0] = 0; - start = 0; - avail = 0; - cursor = 0; - refill = 1; - to_skip = NO_SKIP; - bytes = 0; /* make compiler happy */ - - for (;;) - { - if ( refill ) - { - bytes = (ptrdiff_t)FT_Stream_TryRead( - stream, (FT_Byte*)buf + cursor, - buf_size - (unsigned long)cursor ); - avail = cursor + bytes; - cursor = 0; - refill = 0; - } - - end = start; - - /* should we skip an optional character like \n or \r? */ - if ( start < avail && buf[start] == to_skip ) - { - start += 1; - to_skip = NO_SKIP; - continue; - } - - /* try to find the end of the line */ - while ( end < avail && buf[end] != '\n' && buf[end] != '\r' ) - end++; - - /* if we hit the end of the buffer, try shifting its content */ - /* or even resizing it */ - if ( end >= avail ) - { - if ( bytes == 0 ) - { - /* last line in file doesn't end in \r or \n; */ - /* ignore it then exit */ - if ( lineno == 1 ) - error = FT_THROW( Missing_Startfont_Field ); - break; - } - - if ( start == 0 ) - { - /* this line is definitely too long; try resizing the input */ - /* buffer a bit to handle it. */ - FT_ULong new_size; - - - if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */ - { - if ( lineno == 1 ) - error = FT_THROW( Missing_Startfont_Field ); - else - { - FT_ERROR(( "bdf_readstream_: " ERRMSG6, lineno )); - error = FT_THROW( Invalid_Argument ); - } - goto Exit; - } - - new_size = buf_size * 2; - if ( FT_QREALLOC( buf, buf_size, new_size ) ) - goto Exit; - - cursor = avail; - buf_size = new_size; - } - else - { - bytes = avail - start; - - FT_MEM_MOVE( buf, buf + start, bytes ); - - cursor = bytes; - start = 0; - } - refill = 1; - continue; - } + while ( *line && *line != delim ) + line++; - /* Temporarily NUL-terminate the line. */ - hold = buf[end]; - buf[end] = 0; - - /* XXX: Use encoding independent value for 0x1A */ - if ( buf[start] != '#' && buf[start] != 0x1A && end > start ) - { - error = (*cb)( buf + start, (unsigned long)( end - start ), lineno, - (void*)&cb, client_data ); - /* Redo if we have encountered CHARS without properties. */ - if ( error == -1 ) - error = (*cb)( buf + start, (unsigned long)( end - start ), lineno, - (void*)&cb, client_data ); - if ( error ) - break; - } - - lineno += 1; - buf[end] = (char)hold; - start = end + 1; - - if ( hold == '\n' ) - to_skip = '\r'; - else if ( hold == '\r' ) - to_skip = '\n'; - else - to_skip = NO_SKIP; - } + if ( *line ) + *line++ = '\0'; - *lno = lineno; + while ( *line && *line == delim ) + line++; - Exit: - FT_FREE( buf ); - return error; + return line; } @@ -673,31 +259,28 @@ static const unsigned char a2i[128] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - static const unsigned char ddigits[32] = - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const unsigned char hdigits[32] = + static const unsigned char ddigits[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03, - 0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; @@ -710,9 +293,6 @@ unsigned long v; - if ( s == NULL || *s == 0 ) - return 0; - for ( v = 0; sbitset( ddigits, *s ); s++ ) { if ( v < ( FT_ULONG_MAX - 9 ) / 10 ) @@ -735,16 +315,14 @@ long v, neg; - if ( s == NULL || *s == 0 ) - return 0; - /* Check for a minus sign. */ - neg = 0; if ( *s == '-' ) { s++; - neg = 1; + neg = -1; } + else + neg = 1; for ( v = 0; sbitset( ddigits, *s ); s++ ) { @@ -757,7 +335,7 @@ } } - return ( !neg ) ? v : -v; + return neg * v; } @@ -768,9 +346,6 @@ unsigned short v; - if ( s == NULL || *s == 0 ) - return 0; - for ( v = 0; sbitset( ddigits, *s ); s++ ) { if ( v < ( FT_USHORT_MAX - 9 ) / 10 ) @@ -793,16 +368,14 @@ short v, neg; - if ( s == NULL || *s == 0 ) - return 0; - /* Check for a minus. */ - neg = 0; if ( *s == '-' ) { s++; - neg = 1; + neg = -1; } + else + neg = 1; for ( v = 0; sbitset( ddigits, *s ); s++ ) { @@ -815,7 +388,7 @@ } } - return (short)( ( !neg ) ? v : -v ); + return neg * v; } @@ -926,8 +499,6 @@ #define BDF_BBX_ 0x0400U #define BDF_BITMAP_ 0x0800U -#define BDF_SWIDTH_ADJ_ 0x1000U - #define BDF_GLYPH_BITS_ ( BDF_GLYPH_ | \ BDF_ENCODING_ | \ BDF_SWIDTH_ | \ @@ -935,9 +506,6 @@ BDF_BBX_ | \ BDF_BITMAP_ ) -#define BDF_GLYPH_WIDTH_CHECK_ 0x40000000UL -#define BDF_GLYPH_HEIGHT_CHECK_ 0x80000000UL - static FT_Error bdf_add_comment_( bdf_font_t* font, @@ -949,6 +517,13 @@ FT_Error error = FT_Err_Ok; + /* Skip keyword COMMENT. */ + comment += 7; + len -= 7; + + if ( len == 0 ) + goto Exit; + if ( FT_QRENEW_ARRAY( font->comments, font->comments_len, font->comments_len + len + 1 ) ) @@ -966,76 +541,6 @@ } - /* Set the spacing from the font name if it exists, or set it to the */ - /* default specified in the options. */ - static FT_Error - bdf_set_default_spacing_( bdf_font_t* font, - bdf_options_t* opts, - unsigned long lineno ) - { - size_t len; - char name[256]; - bdf_list_t_ list; - FT_Memory memory; - FT_Error error = FT_Err_Ok; - - FT_UNUSED( lineno ); /* only used in debug mode */ - - - if ( font == NULL || font->name == NULL || font->name[0] == 0 ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - memory = font->memory; - - bdf_list_init_( &list, memory ); - - font->spacing = opts->font_spacing; - - len = ft_strlen( font->name ) + 1; - /* Limit ourselves to 256 characters in the font name. */ - if ( len >= 256 ) - { - FT_ERROR(( "bdf_set_default_spacing_: " ERRMSG7, lineno )); - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - FT_MEM_COPY( name, font->name, len ); - - error = bdf_list_split_( &list, "-", name, (unsigned long)len ); - if ( error ) - goto Fail; - - if ( list.used == 15 ) - { - switch ( list.field[11][0] ) - { - case 'C': - case 'c': - font->spacing = BDF_CHARCELL; - break; - case 'M': - case 'm': - font->spacing = BDF_MONOWIDTH; - break; - case 'P': - case 'p': - font->spacing = BDF_PROPORTIONAL; - break; - } - } - - Fail: - bdf_list_done_( &list ); - - Exit: - return error; - } - - /* Determine whether the property is an atom or not. If it is, then */ /* clean it up so the double quotes are removed if they exist. */ static int @@ -1052,7 +557,7 @@ sp = ep = line; - while ( *ep && *ep != ' ' && *ep != '\t' ) + while ( *ep && *ep != ' ' ) ep++; hold = *ep; @@ -1078,7 +583,7 @@ if ( sp < ep ) do sp++; - while ( *sp == ' ' || *sp == '\t' ); + while ( *sp == ' ' ); /* Trim the leading double quote if it exists. */ if ( *sp == '"' ) @@ -1090,7 +595,7 @@ if ( sp < ep ) do *ep-- = '\0'; - while ( *ep == ' ' || *ep == '\t' ); + while ( *ep == ' ' ); /* Trim the trailing double quote if it exists. */ if ( *ep == '"' ) @@ -1115,8 +620,7 @@ /* First, check whether the property already exists in the font. */ - if ( ( propid = ft_hash_str_lookup( name, - (FT_Hash)font->internal ) ) != NULL ) + if ( ( propid = ft_hash_str_lookup( name, font->internal ) ) != NULL ) { /* The property already exists in the font, so simply replace */ /* the value of the property with the current value. */ @@ -1203,172 +707,132 @@ break; } - /* If the property happens to be a comment, then it doesn't need */ - /* to be added to the internal hash table. */ - if ( _bdf_strncmp( name, "COMMENT", 7 ) != 0 ) - { - /* Add the property to the font property table. */ - error = ft_hash_str_insert( fp->name, - font->props_used, - (FT_Hash)font->internal, - memory ); - if ( error ) - goto Exit; - } + /* Add the property to the font property table. */ + error = ft_hash_str_insert( fp->name, + font->props_used, + font->internal, + memory ); + if ( error ) + goto Exit; font->props_used++; - /* Some special cases need to be handled here. The DEFAULT_CHAR */ - /* property needs to be located if it exists in the property list, the */ - /* FONT_ASCENT and FONT_DESCENT need to be assigned if they are */ - /* present, and the SPACING property should override the default */ - /* spacing. */ - if ( _bdf_strncmp( name, "DEFAULT_CHAR", 12 ) == 0 ) - font->default_char = fp->value.ul; - else if ( _bdf_strncmp( name, "FONT_ASCENT", 11 ) == 0 ) - font->font_ascent = fp->value.l; - else if ( _bdf_strncmp( name, "FONT_DESCENT", 12 ) == 0 ) - font->font_descent = fp->value.l; - else if ( _bdf_strncmp( name, "SPACING", 7 ) == 0 ) - { - if ( !fp->value.atom ) - { - FT_ERROR(( "bdf_add_property_: " ERRMSG8, lineno, "SPACING" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - - if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' ) - font->spacing = BDF_PROPORTIONAL; - else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' ) - font->spacing = BDF_MONOWIDTH; - else if ( fp->value.atom[0] == 'c' || fp->value.atom[0] == 'C' ) - font->spacing = BDF_CHARCELL; - } - Exit: return error; } - static const unsigned char nibble_mask[8] = - { - 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE - }; - - static FT_Error bdf_parse_end_( char* line, unsigned long linelen, unsigned long lineno, - void* call_data, - void* client_data ) + bdf_parse_t_* p, + void* next ) { /* a no-op; we ignore everything after `ENDFONT' */ FT_UNUSED( line ); FT_UNUSED( linelen ); FT_UNUSED( lineno ); - FT_UNUSED( call_data ); - FT_UNUSED( client_data ); + FT_UNUSED( p ); + FT_UNUSED( next ); return FT_Err_Ok; } - /* Actually parse the glyph info and bitmaps. */ + /* Line function prototypes. */ + static FT_Error + bdf_parse_start_( char* line, + unsigned long linelen, + unsigned long lineno, + bdf_parse_t_* p, + void* next ); + + static FT_Error bdf_parse_glyphs_( char* line, unsigned long linelen, unsigned long lineno, - void* call_data, - void* client_data ) - { - int c, mask_index; - char* s; - unsigned char* bp; - unsigned long i, slen, nibbles; + bdf_parse_t_* p, + void* next ); - bdf_line_func_t_* next; - bdf_parse_t_* p; - bdf_glyph_t* glyph; - bdf_font_t* font; - FT_Memory memory; - FT_Error error = FT_Err_Ok; + /* Aggressively parse the glyph bitmaps. */ + static FT_Error + bdf_parse_bitmap_( char* line, + unsigned long linelen, + unsigned long lineno, + bdf_parse_t_* p, + void* next ) + { + bdf_glyph_t* glyph = p->glyph; + unsigned char* bp; + unsigned long i, nibbles; + int x; FT_UNUSED( lineno ); /* only used in debug mode */ - next = (bdf_line_func_t_ *)call_data; - p = (bdf_parse_t_ *) client_data; + nibbles = glyph->bpr << 1; + bp = glyph->bitmap + p->row * glyph->bpr; - font = p->font; - memory = font->memory; + if ( nibbles > linelen ) + { + FT_TRACE2(( "bdf_parse_bitmap_: " ACMSG16, glyph->encoding )); + nibbles = linelen; + } - /* Check for a comment. */ - if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 ) + for ( i = 0; i < nibbles; i++ ) { - if ( p->opts->keep_comments ) - { - linelen -= 7; + /* char to hex without checks */ + x = line[i]; + x += 9 * ( x & 0x40 ) >> 6; /* for [A-Fa-f] */ + x &= 0x0F; - s = line + 7; - if ( *s != 0 ) - { - s++; - linelen--; - } - error = bdf_add_comment_( p->font, s, linelen ); - } - goto Exit; + if ( i & 1 ) + *bp++ |= x; + else + *bp = (unsigned char)( x << 4 ); } - /* The very first thing expected is the number of glyphs. */ - if ( !( p->flags & BDF_GLYPHS_ ) ) - { - if ( _bdf_strncmp( line, "CHARS", 5 ) != 0 ) - { - FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "CHARS" )); - error = FT_THROW( Missing_Chars_Field ); - goto Exit; - } + p->row++; - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - p->cnt = font->glyphs_size = bdf_atoul_( p->list.field[1] ); + /* When done, go back to parsing glyphs */ + if ( p->row >= (unsigned long)glyph->bbx.height ) + *(bdf_line_func_t_*)next = bdf_parse_glyphs_; - /* We need at least 20 bytes per glyph. */ - if ( p->cnt > p->size / 20 ) - { - p->cnt = font->glyphs_size = p->size / 20; - FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG17, p->cnt )); - } + return FT_Err_Ok; + } - /* Make sure the number of glyphs is non-zero. */ - if ( p->cnt == 0 ) - font->glyphs_size = 64; - /* Limit ourselves to 1,114,112 glyphs in the font (this is the */ - /* number of code points available in Unicode). */ - if ( p->cnt >= 0x110000UL ) - { - FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "CHARS" )); - error = FT_THROW( Invalid_Argument ); - goto Exit; - } + /* Actually parse the glyph info. */ + static FT_Error + bdf_parse_glyphs_( char* line, + unsigned long linelen, + unsigned long lineno, + bdf_parse_t_* p, + void* next ) + { + bdf_font_t* font = p->font; + bdf_glyph_t* glyph; + FT_Memory memory = font->memory; + FT_Error error = FT_Err_Ok; - if ( FT_NEW_ARRAY( font->glyphs, font->glyphs_size ) ) - goto Exit; + FT_UNUSED( lineno ); /* only used in debug mode */ - p->flags |= BDF_GLYPHS_; + + /* Check for a comment. */ + if ( ft_strncmp( line, "COMMENT", 7 ) == 0 ) + { + if ( p->flags & BDF_KEEP_COMMENTS ) + error = bdf_add_comment_( font, line, linelen ); goto Exit; } /* Check for the ENDFONT field. */ - if ( _bdf_strncmp( line, "ENDFONT", 7 ) == 0 ) + if ( ft_strncmp( line, "ENDFONT", 7 ) == 0 ) { if ( p->flags & BDF_GLYPH_BITS_ ) { @@ -1385,14 +849,18 @@ by_encoding ); p->flags &= ~BDF_START_; - *next = bdf_parse_end_; + + *(bdf_line_func_t_*)next = bdf_parse_end_; goto Exit; } /* Check for the ENDCHAR field. */ - if ( _bdf_strncmp( line, "ENDCHAR", 7 ) == 0 ) + if ( ft_strncmp( line, "ENDCHAR", 7 ) == 0 ) { + /* Free unused glyph_name */ + FT_FREE( p->glyph_name ); + p->glyph_enc = 0; p->flags &= ~BDF_GLYPH_BITS_; @@ -1401,13 +869,13 @@ /* Check whether a glyph is being scanned but should be */ /* ignored because it is an unencoded glyph. */ - if ( ( p->flags & BDF_GLYPH_ ) && - p->glyph_enc == -1 && - p->opts->keep_unencoded == 0 ) + if ( p->flags & BDF_GLYPH_ && + p->glyph_enc == -1 && + !( p->flags & BDF_KEEP_UNENCODED ) ) goto Exit; /* Check for the STARTCHAR field. */ - if ( _bdf_strncmp( line, "STARTCHAR", 9 ) == 0 ) + if ( ft_strncmp( line, "STARTCHAR ", 10 ) == 0 ) { if ( p->flags & BDF_GLYPH_BITS_ ) { @@ -1417,37 +885,20 @@ goto Exit; } - /* Set the character name in the parse info first until the */ - /* encoding can be checked for an unencoded character. */ - FT_FREE( p->glyph_name ); + line = bdf_strtok_( line, ' ' ); - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - - bdf_list_shift_( &p->list, 1 ); - - s = bdf_list_join_( &p->list, ' ', &slen ); - - if ( !s ) - { - FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG8, lineno, "STARTCHAR" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - - if ( FT_DUP( p->glyph_name, s, slen + 1 ) ) + if ( FT_STRDUP( p->glyph_name, line ) ) goto Exit; p->flags |= BDF_GLYPH_; - FT_TRACE4(( DBGMSG1, lineno, s )); + FT_TRACE4(( DBGMSG1, lineno, line )); goto Exit; } /* Check for the ENCODING field. */ - if ( _bdf_strncmp( line, "ENCODING", 8 ) == 0 ) + if ( ft_strncmp( line, "ENCODING ", 9 ) == 0 ) { if ( !( p->flags & BDF_GLYPH_ ) ) { @@ -1457,11 +908,9 @@ goto Exit; } - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; + line = bdf_strtok_( line, ' ' ); - p->glyph_enc = bdf_atol_( p->list.field[1] ); + p->glyph_enc = bdf_atol_( line ); /* Normalize negative encoding values. The specification only */ /* allows -1, but we can be more generous here. */ @@ -1469,8 +918,10 @@ p->glyph_enc = -1; /* Check for alternative encoding format. */ - if ( p->glyph_enc == -1 && p->list.used > 2 ) - p->glyph_enc = bdf_atol_( p->list.field[2] ); + line = bdf_strtok_( line, ' ' ); + + if ( p->glyph_enc == -1 && *line ) + p->glyph_enc = bdf_atol_( line ); if ( p->glyph_enc < -1 || p->glyph_enc >= 0x110000L ) p->glyph_enc = -1; @@ -1494,47 +945,35 @@ glyph = font->glyphs + font->glyphs_used++; glyph->name = p->glyph_name; glyph->encoding = (unsigned long)p->glyph_enc; - - /* Reset the initial glyph info. */ - p->glyph_name = NULL; } - else + else if ( p->flags & BDF_KEEP_UNENCODED ) { - /* Unencoded glyph. Check whether it should */ - /* be added or not. */ - if ( p->opts->keep_unencoded ) + /* Allocate the next unencoded glyph. */ + if ( font->unencoded_used == font->unencoded_size ) { - /* Allocate the next unencoded glyph. */ - if ( font->unencoded_used == font->unencoded_size ) - { - if ( FT_RENEW_ARRAY( font->unencoded , - font->unencoded_size, - font->unencoded_size + 4 ) ) - goto Exit; - - font->unencoded_size += 4; - } - - glyph = font->unencoded + font->unencoded_used; - glyph->name = p->glyph_name; - glyph->encoding = font->unencoded_used++; + if ( FT_RENEW_ARRAY( font->unencoded , + font->unencoded_size, + font->unencoded_size + 4 ) ) + goto Exit; - /* Reset the initial glyph info. */ - p->glyph_name = NULL; - } - else - { - /* Free up the glyph name if the unencoded shouldn't be */ - /* kept. */ - FT_FREE( p->glyph_name ); + font->unencoded_size += 4; } - } - /* Clear the flags that might be added when width and height are */ - /* checked for consistency. */ - p->flags &= ~( BDF_GLYPH_WIDTH_CHECK_ | BDF_GLYPH_HEIGHT_CHECK_ ); + glyph = font->unencoded + font->unencoded_used; + glyph->name = p->glyph_name; + glyph->encoding = font->unencoded_used++; + } + else + { + /* Free up the glyph name if the unencoded shouldn't be */ + /* kept. */ + FT_FREE( p->glyph_name ); + glyph = NULL; + } - p->flags |= BDF_ENCODING_; + p->glyph_name = NULL; + p->glyph = glyph; + p->flags |= BDF_ENCODING_; goto Exit; } @@ -1543,90 +982,23 @@ goto Missing_Encoding; /* Point at the glyph being constructed. */ - if ( p->glyph_enc == -1 ) - glyph = font->unencoded + ( font->unencoded_used - 1 ); - else - glyph = font->glyphs + ( font->glyphs_used - 1 ); - - /* Check whether a bitmap is being constructed. */ - if ( p->flags & BDF_BITMAP_ ) - { - /* If there are more rows than are specified in the glyph metrics, */ - /* ignore the remaining lines. */ - if ( p->row >= (unsigned long)glyph->bbx.height ) - { - if ( !( p->flags & BDF_GLYPH_HEIGHT_CHECK_ ) ) - { - FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG13, glyph->encoding )); - p->flags |= BDF_GLYPH_HEIGHT_CHECK_; - } - - goto Exit; - } - - /* Only collect the number of nibbles indicated by the glyph */ - /* metrics. If there are more columns, they are simply ignored. */ - nibbles = glyph->bpr << 1; - bp = glyph->bitmap + p->row * glyph->bpr; - - for ( i = 0; i < nibbles; i++ ) - { - c = line[i]; - if ( !sbitset( hdigits, c ) ) - break; - *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); - if ( i + 1 < nibbles && ( i & 1 ) ) - *++bp = 0; - } - - /* If any line has not enough columns, */ - /* indicate they have been padded with zero bits. */ - if ( i < nibbles && - !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) ) - { - FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG16, glyph->encoding )); - p->flags |= BDF_GLYPH_WIDTH_CHECK_; - } - - /* Remove possible garbage at the right. */ - mask_index = ( glyph->bbx.width * p->font->bpp ) & 7; - if ( glyph->bbx.width ) - *bp &= nibble_mask[mask_index]; - - /* If any line has extra columns, indicate they have been removed. */ - if ( i == nibbles && - sbitset( hdigits, line[nibbles] ) && - !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) ) - { - FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG14, glyph->encoding )); - p->flags |= BDF_GLYPH_WIDTH_CHECK_; - } - - p->row++; - goto Exit; - } + glyph = p->glyph; /* Expect the SWIDTH (scalable width) field next. */ - if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 ) + if ( ft_strncmp( line, "SWIDTH ", 7 ) == 0 ) { - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; + line = bdf_strtok_( line, ' ' ); + glyph->swidth = bdf_atous_( line ); - glyph->swidth = bdf_atous_( p->list.field[1] ); p->flags |= BDF_SWIDTH_; - goto Exit; } /* Expect the DWIDTH (device width) field next. */ - if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 ) + if ( ft_strncmp( line, "DWIDTH ", 7 ) == 0 ) { - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - - glyph->dwidth = bdf_atous_( p->list.field[1] ); + line = bdf_strtok_( line, ' ' ); + glyph->dwidth = bdf_atous_( line ); if ( !( p->flags & BDF_SWIDTH_ ) ) { @@ -1644,17 +1016,21 @@ goto Exit; } + /* Do not leak the bitmap or reset its size */ + if ( p->flags & BDF_BITMAP_ ) + goto Exit; + /* Expect the BBX field next. */ - if ( _bdf_strncmp( line, "BBX", 3 ) == 0 ) + if ( ft_strncmp( line, "BBX ", 4 ) == 0 ) { - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - - glyph->bbx.width = bdf_atous_( p->list.field[1] ); - glyph->bbx.height = bdf_atous_( p->list.field[2] ); - glyph->bbx.x_offset = bdf_atos_( p->list.field[3] ); - glyph->bbx.y_offset = bdf_atos_( p->list.field[4] ); + line = bdf_strtok_( line, ' ' ); + glyph->bbx.width = bdf_atous_( line ); + line = bdf_strtok_( line, ' ' ); + glyph->bbx.height = bdf_atous_( line ); + line = bdf_strtok_( line, ' ' ); + glyph->bbx.x_offset = bdf_atos_( line ); + line = bdf_strtok_( line, ' ' ); + glyph->bbx.y_offset = bdf_atos_( line ); /* Generate the ascent and descent of the character. */ glyph->bbx.ascent = (short)( glyph->bbx.height + glyph->bbx.y_offset ); @@ -1681,7 +1057,7 @@ /* If the BDF_CORRECT_METRICS flag is set, then adjust the SWIDTH */ /* value if necessary. */ - if ( p->opts->correct_metrics ) + if ( p->flags & BDF_CORRECT_METRICS ) { /* Determine the point size of the glyph. */ unsigned short sw = (unsigned short)FT_MulDiv( @@ -1694,7 +1070,7 @@ { glyph->swidth = sw; - p->flags |= BDF_SWIDTH_ADJ_; + FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG8 )); } } @@ -1703,7 +1079,7 @@ } /* And finally, gather up the bitmap. */ - if ( _bdf_strncmp( line, "BITMAP", 6 ) == 0 ) + if ( ft_strncmp( line, "BITMAP", 6 ) == 0 ) { unsigned long bitmap_size; @@ -1729,11 +1105,12 @@ else glyph->bytes = (unsigned short)bitmap_size; - if ( FT_ALLOC( glyph->bitmap, glyph->bytes ) ) + if ( !bitmap_size || FT_ALLOC( glyph->bitmap, glyph->bytes ) ) goto Exit; p->row = 0; p->flags |= BDF_BITMAP_; + *(bdf_line_func_t_*)next = bdf_parse_bitmap_; goto Exit; } @@ -1760,95 +1137,49 @@ bdf_parse_properties_( char* line, unsigned long linelen, unsigned long lineno, - void* call_data, - void* client_data ) + bdf_parse_t_* p, + void* next ) { - unsigned long vlen; - bdf_line_func_t_* next; - bdf_parse_t_* p; - char* name; - char* value; - char nbuf[BUFSIZE]; - FT_Error error = FT_Err_Ok; + bdf_font_t* font = p->font; + FT_Error error = FT_Err_Ok; + char* name; + char* value; FT_UNUSED( lineno ); - next = (bdf_line_func_t_ *)call_data; - p = (bdf_parse_t_ *) client_data; - - /* Check for the end of the properties. */ - if ( _bdf_strncmp( line, "ENDPROPERTIES", 13 ) == 0 ) + /* Check for a comment. */ + if ( ft_strncmp( line, "COMMENT", 7 ) == 0 ) { - /* If the FONT_ASCENT or FONT_DESCENT properties have not been */ - /* encountered yet, then make sure they are added as properties and */ - /* make sure they are set from the font bounding box info. */ - /* */ - /* This is *always* done regardless of the options, because X11 */ - /* requires these two fields to compile fonts. */ - if ( bdf_get_font_property( p->font, "FONT_ASCENT" ) == 0 ) - { - p->font->font_ascent = p->font->bbx.ascent; - ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent ); - error = bdf_add_property_( p->font, "FONT_ASCENT", - nbuf, lineno ); - if ( error ) - goto Exit; + if ( p->flags & BDF_KEEP_COMMENTS ) + error = bdf_add_comment_( font, line, linelen ); - FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent )); - } - - if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 ) - { - p->font->font_descent = p->font->bbx.descent; - ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent ); - error = bdf_add_property_( p->font, "FONT_DESCENT", - nbuf, lineno ); - if ( error ) - goto Exit; - - FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent )); - } + goto Exit; + } - p->flags &= ~BDF_PROPS_; - *next = bdf_parse_glyphs_; + /* Check for the end of the properties. */ + if ( ft_strncmp( line, "ENDPROPERTIES", 13 ) == 0 ) + { + *(bdf_line_func_t_*)next = bdf_parse_start_; goto Exit; } /* Ignore the _XFREE86_GLYPH_RANGES properties. */ - if ( _bdf_strncmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 ) + if ( ft_strncmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 ) goto Exit; - /* Handle COMMENT fields and properties in a special way to preserve */ - /* the spacing. */ - if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 ) + if ( bdf_is_atom_( line, linelen, &name, &value, p->font ) ) { - name = value = line; - value += 7; - if ( *value ) - *value++ = 0; - error = bdf_add_property_( p->font, name, value, lineno ); - if ( error ) - goto Exit; - } - else if ( bdf_is_atom_( line, linelen, &name, &value, p->font ) ) - { - error = bdf_add_property_( p->font, name, value, lineno ); + error = bdf_add_property_( font, name, value, lineno ); if ( error ) goto Exit; } else { - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - name = p->list.field[0]; + value = bdf_strtok_( line, ' ' ); - bdf_list_shift_( &p->list, 1 ); - value = bdf_list_join_( &p->list, ' ', &vlen ); - - error = bdf_add_property_( p->font, name, value, lineno ); + error = bdf_add_property_( font, line, value, lineno ); if ( error ) goto Exit; } @@ -1863,160 +1194,121 @@ bdf_parse_start_( char* line, unsigned long linelen, unsigned long lineno, - void* call_data, - void* client_data ) + bdf_parse_t_* p, + void* next ) { - unsigned long slen; - bdf_line_func_t_* next; - bdf_parse_t_* p; - bdf_font_t* font; - char *s; - - FT_Memory memory = NULL; - FT_Error error = FT_Err_Ok; + bdf_font_t* font; + FT_Memory memory = p->memory; + FT_Error error = FT_Err_Ok; FT_UNUSED( lineno ); /* only used in debug mode */ - next = (bdf_line_func_t_ *)call_data; - p = (bdf_parse_t_ *) client_data; - - if ( p->font ) - memory = p->font->memory; - - /* Check for a comment. This is done to handle those fonts that have */ - /* comments before the STARTFONT line for some reason. */ - if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 ) - { - if ( p->opts->keep_comments && p->font ) - { - linelen -= 7; - - s = line + 7; - if ( *s != 0 ) - { - s++; - linelen--; - } - error = bdf_add_comment_( p->font, s, linelen ); - } - goto Exit; - } - + /* The first line must be STARTFONT. */ + /* Otherwise, reject the font immediately. */ if ( !( p->flags & BDF_START_ ) ) { - memory = p->memory; - - if ( _bdf_strncmp( line, "STARTFONT", 9 ) != 0 ) + if ( ft_strncmp( line, "STARTFONT", 9 ) != 0 ) { - /* we don't emit an error message since this code gets */ - /* explicitly caught one level higher */ error = FT_THROW( Missing_Startfont_Field ); goto Exit; } - p->flags = BDF_START_; - font = p->font = NULL; + p->flags |= BDF_START_; - if ( FT_NEW( font ) ) + if ( FT_NEW( p->font ) ) goto Exit; - p->font = font; - - font->memory = p->memory; - { /* setup */ - size_t i; - bdf_property_t* prop; + p->font->memory = memory; + goto Exit; + } - error = ft_hash_str_init( &(font->proptbl), memory ); - if ( error ) - goto Exit; - for ( i = 0, prop = (bdf_property_t*)bdf_properties_; - i < num_bdf_properties_; i++, prop++ ) - { - error = ft_hash_str_insert( prop->name, i, - &(font->proptbl), memory ); - if ( error ) - goto Exit; - } - } + /* Point at the font being constructed. */ + font = p->font; - if ( FT_QALLOC( p->font->internal, sizeof ( FT_HashRec ) ) ) - goto Exit; - error = ft_hash_str_init( (FT_Hash)p->font->internal, memory ); - if ( error ) - goto Exit; - p->font->spacing = p->opts->font_spacing; - p->font->default_char = ~0UL; + /* Check for a comment. */ + if ( ft_strncmp( line, "COMMENT", 7 ) == 0 ) + { + if ( p->flags & BDF_KEEP_COMMENTS ) + error = bdf_add_comment_( font, line, linelen ); goto Exit; } /* Check for the start of the properties. */ - if ( _bdf_strncmp( line, "STARTPROPERTIES", 15 ) == 0 ) + if ( !( p->flags & BDF_PROPS_ ) && + ft_strncmp( line, "STARTPROPERTIES ", 16 ) == 0 ) { - if ( !( p->flags & BDF_FONT_BBX_ ) ) - { - /* Missing the FONTBOUNDINGBOX field. */ - FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); - error = FT_THROW( Missing_Fontboundingbox_Field ); - goto Exit; - } + line = bdf_strtok_( line, ' ' ); + font->props_size = bdf_atoul_( line ); - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; + if ( font->props_size < 2 ) + font->props_size = 2; - /* at this point, `p->font' can't be NULL */ - p->cnt = p->font->props_size = bdf_atoul_( p->list.field[1] ); /* We need at least 4 bytes per property. */ - if ( p->cnt > p->size / 4 ) + if ( font->props_size > p->size / 4 ) { - p->font->props_size = 0; + font->props_size = 0; - FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "STARTPROPERTIES" )); + FT_ERROR(( "bdf_parse_start_: " ERRMSG5, lineno, "STARTPROPERTIES" )); error = FT_THROW( Invalid_Argument ); goto Exit; } - if ( FT_NEW_ARRAY( p->font->props, p->cnt ) ) + if ( FT_NEW_ARRAY( font->props, font->props_size ) ) { - p->font->props_size = 0; + font->props_size = 0; goto Exit; } + if ( FT_QNEW( font->internal ) ) + goto Exit; + error = ft_hash_str_init( font->internal, memory ); + if ( error ) + goto Exit; + + /* preset common properties */ + { + bdf_property_t* prop = (bdf_property_t*)bdf_properties_; + FT_Hash proptbl = &font->proptbl; + size_t i; + + + error = ft_hash_str_init( proptbl, memory ); + if ( error ) + goto Exit; + for ( i = 0; i < num_bdf_properties_; i++, prop++ ) + { + error = ft_hash_str_insert( prop->name, i, proptbl, memory ); + if ( error ) + goto Exit; + } + } + p->flags |= BDF_PROPS_; - *next = bdf_parse_properties_; + + *(bdf_line_func_t_*)next = bdf_parse_properties_; goto Exit; } /* Check for the FONTBOUNDINGBOX field. */ - if ( _bdf_strncmp( line, "FONTBOUNDINGBOX", 15 ) == 0 ) + if ( ft_strncmp( line, "FONTBOUNDINGBOX ", 16 ) == 0 ) { - if ( !( p->flags & BDF_SIZE_ ) ) - { - /* Missing the SIZE field. */ - FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "SIZE" )); - error = FT_THROW( Missing_Size_Field ); - goto Exit; - } + line = bdf_strtok_( line, ' ' ); + font->bbx.width = bdf_atous_( line ); + line = bdf_strtok_( line, ' ' ); + font->bbx.height = bdf_atous_( line ); + line = bdf_strtok_( line, ' ' ); + font->bbx.x_offset = bdf_atos_( line ); + line = bdf_strtok_( line, ' ' ); + font->bbx.y_offset = bdf_atos_( line ); - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - - p->font->bbx.width = bdf_atous_( p->list.field[1] ); - p->font->bbx.height = bdf_atous_( p->list.field[2] ); - - p->font->bbx.x_offset = bdf_atos_( p->list.field[3] ); - p->font->bbx.y_offset = bdf_atos_( p->list.field[4] ); + font->bbx.ascent = (short)( font->bbx.height + + font->bbx.y_offset ); - p->font->bbx.ascent = (short)( p->font->bbx.height + - p->font->bbx.y_offset ); - - p->font->bbx.descent = (short)( -p->font->bbx.y_offset ); + font->bbx.descent = (short)( -font->bbx.y_offset ); p->flags |= BDF_FONT_BBX_; @@ -2024,33 +1316,45 @@ } /* The next thing to check for is the FONT field. */ - if ( _bdf_strncmp( line, "FONT", 4 ) == 0 ) + if ( ft_strncmp( line, "FONT ", 5 ) == 0 ) { - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - bdf_list_shift_( &p->list, 1 ); + int i; - s = bdf_list_join_( &p->list, ' ', &slen ); - if ( !s ) - { - FT_ERROR(( "bdf_parse_start_: " ERRMSG8, lineno, "FONT" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } + line = bdf_strtok_( line, ' ' ); /* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */ - FT_FREE( p->font->name ); + FT_FREE( font->name ); - if ( FT_DUP( p->font->name, s, slen + 1 ) ) + if ( FT_STRDUP( font->name, line ) ) goto Exit; - /* 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. */ - error = bdf_set_default_spacing_( p->font, p->opts, lineno ); - if ( error ) - goto Exit; + /* If the font name is an XLFD name, set the spacing to the one in */ + /* the font name after the 11th dash. */ + for ( i = 0; i < 11; i++ ) + { + while ( *line && *line != '-' ) + line++; + if ( *line ) + line++; + } + + switch ( *line ) + { + case 'C': + case 'c': + font->spacing = BDF_CHARCELL; + break; + case 'M': + case 'm': + font->spacing = BDF_MONOWIDTH; + break; + case 'P': + case 'p': + default: + font->spacing = BDF_PROPORTIONAL; + break; + } p->flags |= BDF_FONT_NAME_; @@ -2058,59 +1362,63 @@ } /* Check for the SIZE field. */ - if ( _bdf_strncmp( line, "SIZE", 4 ) == 0 ) + if ( ft_strncmp( line, "SIZE ", 5 ) == 0 ) { - if ( !( p->flags & BDF_FONT_NAME_ ) ) - { - /* Missing the FONT field. */ - FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONT" )); - error = FT_THROW( Missing_Font_Field ); - goto Exit; - } - - error = bdf_list_split_( &p->list, " +", line, linelen ); - if ( error ) - goto Exit; - - p->font->point_size = bdf_atoul_( p->list.field[1] ); - p->font->resolution_x = bdf_atoul_( p->list.field[2] ); - p->font->resolution_y = bdf_atoul_( p->list.field[3] ); + line = bdf_strtok_( line, ' ' ); + font->point_size = bdf_atoul_( line ); + line = bdf_strtok_( line, ' ' ); + font->resolution_x = bdf_atoul_( line ); + line = bdf_strtok_( line, ' ' ); + font->resolution_y = bdf_atoul_( line ); /* Check for the bits per pixel field. */ - if ( p->list.used == 5 ) + line = bdf_strtok_( line, ' ' ); + if ( *line ) { unsigned short bpp; - bpp = bdf_atous_( p->list.field[4] ); + bpp = bdf_atous_( line ); /* Only values 1, 2, 4, 8 are allowed for greymap fonts. */ if ( bpp > 4 ) - p->font->bpp = 8; + font->bpp = 8; else if ( bpp > 2 ) - p->font->bpp = 4; + font->bpp = 4; else if ( bpp > 1 ) - p->font->bpp = 2; + font->bpp = 2; else - p->font->bpp = 1; + font->bpp = 1; - if ( p->font->bpp != bpp ) - FT_TRACE2(( "bdf_parse_start_: " ACMSG11, p->font->bpp )); + if ( font->bpp != bpp ) + FT_TRACE2(( "bdf_parse_start_: " ACMSG11, font->bpp )); } else - p->font->bpp = 1; + font->bpp = 1; p->flags |= BDF_SIZE_; goto Exit; } - /* Check for the CHARS field -- font properties are optional */ - if ( _bdf_strncmp( line, "CHARS", 5 ) == 0 ) + /* Check for the CHARS field */ + if ( ft_strncmp( line, "CHARS ", 6 ) == 0 ) { - char nbuf[BUFSIZE]; - - + /* Check the header for completeness before parsing glyphs. */ + if ( !( p->flags & BDF_FONT_NAME_ ) ) + { + /* Missing the FONT field. */ + FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONT" )); + error = FT_THROW( Missing_Font_Field ); + goto Exit; + } + if ( !( p->flags & BDF_SIZE_ ) ) + { + /* Missing the SIZE field. */ + FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "SIZE" )); + error = FT_THROW( Missing_Size_Field ); + goto Exit; + } if ( !( p->flags & BDF_FONT_BBX_ ) ) { /* Missing the FONTBOUNDINGBOX field. */ @@ -2119,28 +1427,36 @@ goto Exit; } - /* Add the two standard X11 properties which are required */ - /* for compiling fonts. */ - p->font->font_ascent = p->font->bbx.ascent; - ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent ); - error = bdf_add_property_( p->font, "FONT_ASCENT", - nbuf, lineno ); - if ( error ) + line = bdf_strtok_( line, ' ' ); + p->cnt = font->glyphs_size = bdf_atoul_( line ); + + /* We need at least 20 bytes per glyph. */ + if ( p->cnt > p->size / 20 ) + { + p->cnt = font->glyphs_size = p->size / 20; + FT_TRACE2(( "bdf_parse_start_: " ACMSG17, p->cnt )); + } + + /* Make sure the number of glyphs is non-zero. */ + if ( p->cnt == 0 ) + font->glyphs_size = 64; + + /* Limit ourselves to 1,114,112 glyphs in the font (this is the */ + /* number of code points available in Unicode). */ + if ( p->cnt >= 0x110000UL ) + { + FT_ERROR(( "bdf_parse_start_: " ERRMSG5, lineno, "CHARS" )); + error = FT_THROW( Invalid_Argument ); goto Exit; - FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent )); + } - p->font->font_descent = p->font->bbx.descent; - ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent ); - error = bdf_add_property_( p->font, "FONT_DESCENT", - nbuf, lineno ); - if ( error ) + if ( FT_NEW_ARRAY( font->glyphs, font->glyphs_size ) ) goto Exit; - FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent )); - *next = bdf_parse_glyphs_; + p->flags |= BDF_GLYPHS_; + + *(bdf_line_func_t_*)next = bdf_parse_glyphs_; - /* A special return value. */ - error = -1; goto Exit; } @@ -2152,6 +1468,104 @@ } + static FT_Error + bdf_readstream_( FT_Stream stream, + bdf_parse_t_* p, + unsigned long* lno ) + { + bdf_line_func_t_ cb = bdf_parse_start_; + unsigned long lineno, buf_size; + unsigned long bytes, start, end, cursor, avail; + char* buf = NULL; + FT_Memory memory = stream->memory; + FT_Error error = FT_Err_Ok; + + + /* initial size and allocation of the input buffer */ + buf_size = 1024; + + if ( FT_QALLOC( buf, buf_size ) ) + goto Exit; + + lineno = 1; + start = 0; + cursor = 0; + + Refill: + bytes = FT_Stream_TryRead( stream, + (FT_Byte*)buf + cursor, buf_size - cursor ); + avail = cursor + bytes; + + while ( bytes ) + { + /* try to find the start of the line */ + while ( start < avail && buf[start] < ' ' ) + start++; + + /* try to find the end of the line */ + end = start + 1; + while ( end < avail && buf[end] >= ' ' ) + end++; + + /* if we hit the end of the buffer, try shifting its content */ + /* or even resizing it */ + if ( end >= avail ) + { + if ( start == 0 ) + { + /* this line is definitely too long; try resizing the input */ + /* buffer a bit to handle it. */ + FT_ULong new_size; + + + if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */ + { + FT_ERROR(( "bdf_readstream_: " ERRMSG6, lineno )); + error = FT_THROW( Invalid_File_Format ); + + goto Exit; + } + + new_size = buf_size * 4; + if ( FT_QREALLOC( buf, buf_size, new_size ) ) + goto Exit; + + cursor = avail; + buf_size = new_size; + } + else + { + cursor = avail - start; + + FT_MEM_MOVE( buf, buf + start, cursor ); + + start = 0; + } + goto Refill; + } + + /* NUL-terminate the line. */ + buf[end] = 0; + + if ( buf[start] != '#' ) + { + error = (*cb)( buf + start, end - start, lineno, p, (void*)&cb ); + if ( error ) + break; + } + + lineno += 1; + start = end + 1; + } + + *lno = lineno; + + Exit: + FT_FREE( buf ); + return error; + } + + /************************************************************************** * * API. @@ -2162,7 +1576,7 @@ FT_LOCAL_DEF( FT_Error ) bdf_load_font( FT_Stream stream, FT_Memory memory, - bdf_options_t* opts, + unsigned long flags, bdf_font_t* *font ) { unsigned long lineno = 0; /* make compiler happy */ @@ -2174,26 +1588,17 @@ if ( FT_NEW( p ) ) goto Exit; - p->opts = (bdf_options_t*)( opts ? opts : &bdf_opts_ ); + p->flags = flags; /* comments, metrics, unencoded */ p->minlb = 32767; p->size = stream->size; p->memory = memory; /* only during font creation */ - bdf_list_init_( &p->list, memory ); - - error = bdf_readstream_( stream, bdf_parse_start_, - (void *)p, &lineno ); + error = bdf_readstream_( stream, p, &lineno ); if ( error ) goto Fail; if ( p->font ) { - /* If the font is not proportional, set the font's monowidth */ - /* field to the width of the font bounding box. */ - - if ( p->font->spacing != BDF_PROPORTIONAL ) - p->font->monowidth = p->font->bbx.width; - /* If the number of glyphs loaded is not that of the original count, */ /* indicate the difference. */ if ( p->cnt != p->font->glyphs_used + p->font->unencoded_used ) @@ -2204,7 +1609,7 @@ /* Once the font has been loaded, adjust the overall font metrics if */ /* necessary. */ - if ( p->opts->correct_metrics != 0 && + if ( p->flags & BDF_CORRECT_METRICS && ( p->font->glyphs_used > 0 || p->font->unencoded_used > 0 ) ) { if ( p->maxrb - p->minlb != p->font->bbx.width ) @@ -2242,9 +1647,6 @@ p->font->bbx.height, p->maxas + p->maxds )); p->font->bbx.height = (unsigned short)( p->maxas + p->maxds ); } - - if ( p->flags & BDF_SWIDTH_ADJ_ ) - FT_TRACE2(( "bdf_load_font: " ACMSG8 )); } } @@ -2275,8 +1677,6 @@ Exit: if ( p ) { - bdf_list_done_( &p->list ); - FT_FREE( p->glyph_name ); FT_FREE( p ); } @@ -2311,7 +1711,7 @@ /* Free up the internal hash table of property names. */ if ( font->internal ) { - ft_hash_str_free( (FT_Hash)font->internal, memory ); + ft_hash_str_free( font->internal, memory ); FT_FREE( font->internal ); } @@ -2369,9 +1769,9 @@ if ( font == NULL || font->props_size == 0 || name == NULL || *name == 0 ) return 0; - propid = ft_hash_str_lookup( name, (FT_Hash)font->internal ); + propid = ft_hash_str_lookup( name, font->internal ); - return propid ? ( font->props + *propid ) : 0; + return propid ? ( font->props + *propid ) : NULL; } diff --git a/modules/freetype2/src/bzip2/ftbzip2.c b/modules/freetype2/src/bzip2/ftbzip2.c @@ -8,7 +8,7 @@ * parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2010-2024 by + * Copyright (C) 2010-2025 by * Joel Klinghed. * * based on `src/gzip/ftgzip.c' diff --git a/modules/freetype2/src/bzip2/rules.mk b/modules/freetype2/src/bzip2/rules.mk @@ -2,7 +2,7 @@ # FreeType 2 BZIP2 support configuration rules # -# Copyright (C) 2010-2024 by +# Copyright (C) 2010-2025 by # Joel Klinghed. # # based on `src/lzw/rules.mk' diff --git a/modules/freetype2/src/cache/ftcache.c b/modules/freetype2/src/cache/ftcache.c @@ -4,7 +4,7 @@ * * The FreeType Caching sub-system (body only). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcbasic.c b/modules/freetype2/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ * * The FreeType basic cache interface (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftccache.c b/modules/freetype2/src/cache/ftccache.c @@ -4,7 +4,7 @@ * * The FreeType internal cache interface (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftccache.h b/modules/freetype2/src/cache/ftccache.h @@ -4,7 +4,7 @@ * * FreeType internal cache interface (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftccback.h b/modules/freetype2/src/cache/ftccback.h @@ -4,7 +4,7 @@ * * Callback functions of the caching sub-system (specification only). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftccmap.c b/modules/freetype2/src/cache/ftccmap.c @@ -4,7 +4,7 @@ * * FreeType CharMap cache (body) * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcerror.h b/modules/freetype2/src/cache/ftcerror.h @@ -4,7 +4,7 @@ * * Caching sub-system error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcglyph.c b/modules/freetype2/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ * * FreeType Glyph Image (FT_Glyph) cache (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcglyph.h b/modules/freetype2/src/cache/ftcglyph.h @@ -4,7 +4,7 @@ * * FreeType abstract glyph cache (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcimage.c b/modules/freetype2/src/cache/ftcimage.c @@ -4,7 +4,7 @@ * * FreeType Image cache (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcimage.h b/modules/freetype2/src/cache/ftcimage.h @@ -4,7 +4,7 @@ * * FreeType Generic Image cache (specification) * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcmanag.c b/modules/freetype2/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ * * FreeType Cache Manager (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcmanag.h b/modules/freetype2/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ * * FreeType Cache Manager (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcmru.c b/modules/freetype2/src/cache/ftcmru.c @@ -4,7 +4,7 @@ * * FreeType MRU support (body). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcmru.h b/modules/freetype2/src/cache/ftcmru.h @@ -4,7 +4,7 @@ * * Simple MRU list-cache (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcsbits.c b/modules/freetype2/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ * * FreeType sbits manager (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/ftcsbits.h b/modules/freetype2/src/cache/ftcsbits.h @@ -4,7 +4,7 @@ * * A small-bitmap cache (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cache/rules.mk b/modules/freetype2/src/cache/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2000-2024 by +# Copyright (C) 2000-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/cff/cff.c b/modules/freetype2/src/cff/cff.c @@ -4,7 +4,7 @@ * * FreeType OpenType driver component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cffcmap.c b/modules/freetype2/src/cff/cffcmap.c @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cffcmap.h b/modules/freetype2/src/cff/cffcmap.h @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cffdrivr.c b/modules/freetype2/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ * * OpenType font driver implementation (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. * * This file is part of the FreeType project, and may only be used, @@ -121,7 +121,20 @@ kerning->y = 0; if ( sfnt ) - kerning->x = sfnt->get_kerning( cffface, left_glyph, right_glyph ); + { + /* Use 'kern' table if available since that can be faster; otherwise */ + /* use GPOS kerning pairs if available. */ + if ( cffface->kern_avail_bits ) + kerning->x = sfnt->get_kerning( cffface, + left_glyph, + right_glyph ); +#ifdef TT_CONFIG_OPTION_GPOS_KERNING + else if ( cffface->num_gpos_lookups_kerning ) + kerning->x = sfnt->get_gpos_kerning( cffface, + left_glyph, + right_glyph ); +#endif + } return FT_Err_Ok; } @@ -168,25 +181,7 @@ CFF_Size cffsize = (CFF_Size)size; - if ( !cffslot ) - return FT_THROW( Invalid_Slot_Handle ); - - FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index )); - - /* check whether we want a scaled outline or bitmap */ - if ( !cffsize ) - load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; - - /* reset the size object if necessary */ - if ( load_flags & FT_LOAD_NO_SCALE ) - size = NULL; - - if ( size ) - { - /* these two objects must have the same parent */ - if ( size->face != slot->face ) - return FT_THROW( Invalid_Face_Handle ); - } + FT_TRACE1(( "cff_glyph_load: glyph index %u\n", glyph_index )); /* now load the glyph outline if necessary */ error = cff_slot_load( cffslot, cffsize, glyph_index, load_flags ); @@ -205,105 +200,70 @@ FT_Int32 flags, FT_Fixed* advances ) { - FT_UInt nn; - FT_Error error = FT_Err_Ok; - FT_GlyphSlot slot = face->glyph; + CFF_Face cffface = (CFF_Face)face; + FT_Bool horz; + FT_UInt nn; - if ( FT_IS_SFNT( face ) ) + if ( !FT_IS_SFNT( face ) ) + return FT_THROW( Unimplemented_Feature ); + + horz = !( flags & FT_LOAD_VERTICAL_LAYOUT ); + + if ( horz ) { /* OpenType 1.7 mandates that the data from `hmtx' table be used; */ /* it is no longer necessary that those values are identical to */ /* the values in the `CFF' table */ + if ( !cffface->horizontal.number_Of_HMetrics ) + return FT_THROW( Unimplemented_Feature ); - CFF_Face cffface = (CFF_Face)face; - FT_Short dummy; - - - if ( flags & FT_LOAD_VERTICAL_LAYOUT ) - { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* no fast retrieval for blended MM fonts without VVAR table */ - if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && - !( cffface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - return FT_THROW( Unimplemented_Feature ); + /* no fast retrieval for blended MM fonts without HVAR table */ + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( cffface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + return FT_THROW( Unimplemented_Feature ); #endif + } + else /* vertical */ + { + /* check whether we have data from the `vmtx' table at all; */ + /* otherwise we extract the info from the CFF glyphstrings */ + /* (instead of synthesizing a global value using the `OS/2' */ + /* table) */ + if ( !cffface->vertical_info ) + return FT_THROW( Unimplemented_Feature ); - /* check whether we have data from the `vmtx' table at all; */ - /* otherwise we extract the info from the CFF glyphstrings */ - /* (instead of synthesizing a global value using the `OS/2' */ - /* table) */ - if ( !cffface->vertical_info ) - goto Missing_Table; - - for ( nn = 0; nn < count; nn++ ) - { - FT_UShort ah; - - - ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface, - 1, - start + nn, - &dummy, - &ah ); - - FT_TRACE5(( " idx %d: advance height %d font unit%s\n", - start + nn, - ah, - ah == 1 ? "" : "s" )); - advances[nn] = ah; - } - } - else - { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* no fast retrieval for blended MM fonts without HVAR table */ - if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && - !( cffface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - return FT_THROW( Unimplemented_Feature ); + /* no fast retrieval for blended MM fonts without VVAR table */ + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( cffface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + return FT_THROW( Unimplemented_Feature ); #endif - - /* check whether we have data from the `hmtx' table at all */ - if ( !cffface->horizontal.number_Of_HMetrics ) - goto Missing_Table; - - for ( nn = 0; nn < count; nn++ ) - { - FT_UShort aw; - - - ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface, - 0, - start + nn, - &dummy, - &aw ); - - FT_TRACE5(( " idx %d: advance width %d font unit%s\n", - start + nn, - aw, - aw == 1 ? "" : "s" )); - advances[nn] = aw; - } - } - - return error; } - Missing_Table: - flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; - + /* proceed to fast advances */ for ( nn = 0; nn < count; nn++ ) { - error = cff_glyph_load( slot, face->size, start + nn, flags ); - if ( error ) - break; - - advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) - ? slot->linearVertAdvance - : slot->linearHoriAdvance; + FT_UShort aw; + FT_Short dummy; + + + ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface, + !horz, + start + nn, + &dummy, + &aw ); + + FT_TRACE5(( " idx %u: advance %s %d font unit%s\n", + start + nn, + horz ? "width" : "height", + aw, + aw == 1 ? "" : "s" )); + advances[nn] = aw; } - return error; + return FT_Err_Ok; } diff --git a/modules/freetype2/src/cff/cffdrivr.h b/modules/freetype2/src/cff/cffdrivr.h @@ -4,7 +4,7 @@ * * High-level OpenType driver interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cfferrs.h b/modules/freetype2/src/cff/cfferrs.h @@ -4,7 +4,7 @@ * * CFF error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cffgload.c b/modules/freetype2/src/cff/cffgload.c @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -238,24 +238,12 @@ else if ( glyph_index >= cff->num_glyphs ) return FT_THROW( Invalid_Argument ); - if ( load_flags & FT_LOAD_NO_RECURSE ) - load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; - - glyph->x_scale = 0x10000L; - glyph->y_scale = 0x10000L; - if ( size ) - { - glyph->x_scale = size->root.metrics.x_scale; - glyph->y_scale = size->root.metrics.y_scale; - } - #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* try to load embedded bitmap if any */ /* */ /* XXX: The convention should be emphasized in */ /* the documents because it can be confusing. */ - if ( size ) { CFF_Face cff_face = (CFF_Face)size->root.face; SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt; @@ -284,9 +272,6 @@ FT_Short dummy; - glyph->root.outline.n_points = 0; - glyph->root.outline.n_contours = 0; - glyph->root.metrics.width = (FT_Pos)metrics.width * 64; glyph->root.metrics.height = (FT_Pos)metrics.height * 64; @@ -423,6 +408,25 @@ #endif /* FT_CONFIG_OPTION_SVG */ + /* top-level code ensures that FT_LOAD_NO_HINTING is set */ + /* if FT_LOAD_NO_SCALE is active */ + hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); + scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + + glyph->hint = hinting; + glyph->scaled = scaled; + + if ( scaled ) + { + glyph->x_scale = size->root.metrics.x_scale; + glyph->y_scale = size->root.metrics.y_scale; + } + else + { + glyph->x_scale = 0x10000L; + glyph->y_scale = 0x10000L; + } + /* if we have a CID subfont, use its matrix (which has already */ /* been multiplied with the root matrix) */ @@ -457,18 +461,6 @@ font_offset = cff->top_font.font_dict.font_offset; } - glyph->root.outline.n_points = 0; - glyph->root.outline.n_contours = 0; - - /* top-level code ensures that FT_LOAD_NO_HINTING is set */ - /* if FT_LOAD_NO_SCALE is active */ - hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); - scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); - - glyph->hint = hinting; - glyph->scaled = scaled; - glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; /* by default */ - { #ifdef CFF_CONFIG_OPTION_OLD_ENGINE PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); @@ -602,10 +594,8 @@ { /* Now, set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ - /* bearing the yMax. */ - - /* For composite glyphs, return only left side bearing and */ - /* advance width. */ + /* bearing the yMax. For composite glyphs, return only */ + /* left side bearing and advance width. */ if ( load_flags & FT_LOAD_NO_RECURSE ) { FT_Slot_Internal internal = glyph->root.internal; @@ -624,6 +614,12 @@ FT_Bool has_vertical_info; + glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; + + glyph->root.outline.flags = FT_OUTLINE_REVERSE_FILL; + if ( size && size->root.metrics.y_ppem < 24 ) + glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION; + if ( face->horizontal.number_Of_HMetrics ) { FT_Short horiBearingX = 0; @@ -677,14 +673,6 @@ glyph->root.linearVertAdvance = metrics->vertAdvance; - glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; - - glyph->root.outline.flags = 0; - if ( size && size->root.metrics.y_ppem < 24 ) - glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION; - - glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL; - /* apply the font matrix, if any */ if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L || font_matrix.xy != 0 || font_matrix.yx != 0 ) @@ -707,7 +695,7 @@ metrics->vertAdvance += font_offset.y; } - if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling ) + if ( scaled || force_scaling ) { /* scale the outline and the metrics */ FT_Int n; diff --git a/modules/freetype2/src/cff/cffgload.h b/modules/freetype2/src/cff/cffgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cffload.c b/modules/freetype2/src/cff/cffload.c @@ -4,7 +4,7 @@ * * OpenType and CFF data/program tables loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -442,7 +442,7 @@ if ( cur_offset != 0 ) { FT_TRACE0(( "cff_index_get_pointers:" - " invalid first offset value %ld set to zero\n", + " invalid first offset value %lu set to zero\n", cur_offset )); cur_offset = 0; } @@ -559,8 +559,8 @@ idx->data_offset > stream->size - off2 + 1 ) { FT_ERROR(( "cff_index_access_element:" - " offset to next entry (%ld)" - " exceeds the end of stream (%ld)\n", + " offset to next entry (%lu)" + " exceeds the end of stream (%lu)\n", off2, stream->size - idx->data_offset + 1 )); off2 = stream->size - idx->data_offset + 1; } @@ -982,7 +982,7 @@ if ( glyph_sid > 0xFFFFL - nleft ) { FT_ERROR(( "cff_charset_load: invalid SID range trimmed" - " nleft=%d -> %ld\n", nleft, 0xFFFFL - glyph_sid )); + " nleft=%u -> %ld\n", nleft, 0xFFFFL - glyph_sid )); nleft = ( FT_UInt )( 0xFFFFL - glyph_sid ); } @@ -1315,7 +1315,7 @@ if ( numOperands > count ) { - FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d argument%s\n", + FT_TRACE4(( " cff_blend_doBlend: Stack underflow %u argument%s\n", count, count == 1 ? "" : "s" )); @@ -1466,7 +1466,7 @@ if ( master == 0 ) { blend->BV[master] = FT_FIXED_ONE; - FT_TRACE4(( " build blend vector len %d\n", len )); + FT_TRACE4(( " build blend vector len %u\n", len )); FT_TRACE4(( " [ %f ", blend->BV[master] / 65536.0 )); continue; } @@ -2341,7 +2341,7 @@ if ( face_index > 0 && subfont_index >= font->name_index.count ) { FT_ERROR(( "cff_font_load:" - " invalid subfont index for pure CFF font (%d)\n", + " invalid subfont index for pure CFF font (%u)\n", subfont_index )); error = FT_THROW( Invalid_Argument ); goto Exit; diff --git a/modules/freetype2/src/cff/cffload.h b/modules/freetype2/src/cff/cffload.h @@ -4,7 +4,7 @@ * * OpenType & CFF data/program tables loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cffobjs.c b/modules/freetype2/src/cff/cffobjs.c @@ -4,7 +4,7 @@ * * OpenType objects manager (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -537,8 +537,8 @@ sfnt_format = 1; - /* now, the font can be either an OpenType/CFF font, or an SVG CEF */ - /* font; in the latter case it doesn't have a `head' table */ + /* the font may be OpenType/CFF, SVG CEF, or sfnt/CFF; a `head' table */ + /* implies OpenType/CFF, otherwise just look for an optional cmap */ error = face->goto_table( face, TTAG_head, stream, 0 ); if ( !error ) { @@ -554,7 +554,9 @@ { /* load the `cmap' table explicitly */ error = sfnt->load_cmap( face, stream ); - if ( error ) + + /* this may fail because CID-keyed fonts don't have a cmap */ + if ( FT_ERR_NEQ( error, Table_Missing ) && FT_ERR_NEQ( error, Ok ) ) goto Exit; } @@ -651,7 +653,7 @@ { s = cff_index_get_sid_string( cff, idx ); if ( s ) - FT_TRACE4(( " %5d %s\n", idx, s )); + FT_TRACE4(( " %5u %s\n", idx, s )); } /* In Multiple Master CFFs, two SIDs hold the Normalize Design */ @@ -666,7 +668,7 @@ FT_PtrDist l; - FT_TRACE4(( " %5d ", idx + 390 )); + FT_TRACE4(( " %5u ", idx + 390 )); for ( l = 0; l < s1len; l++ ) FT_TRACE4(( "%c", s1[l] )); FT_TRACE4(( "\n" )); @@ -681,7 +683,7 @@ FT_PtrDist l; - FT_TRACE4(( " %5d ", cff->num_strings + 390 )); + FT_TRACE4(( " %5u ", cff->num_strings + 390 )); for ( l = 0; l < s1len; l++ ) FT_TRACE4(( "%c", s1[l] )); FT_TRACE4(( "\n" )); diff --git a/modules/freetype2/src/cff/cffobjs.h b/modules/freetype2/src/cff/cffobjs.h @@ -4,7 +4,7 @@ * * OpenType objects manager (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cffparse.c b/modules/freetype2/src/cff/cffparse.c @@ -4,7 +4,7 @@ * * CFF token stream parser (body) * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -892,7 +892,7 @@ dict->cid_supplement )); error = FT_Err_Ok; - FT_TRACE4(( " %d %d %ld\n", + FT_TRACE4(( " %u %u %ld\n", dict->cid_registry, dict->cid_ordering, dict->cid_supplement )); @@ -929,7 +929,7 @@ priv->vsindex = (FT_UInt)cff_parse_num( parser, data++ ); - FT_TRACE4(( " %d\n", priv->vsindex )); + FT_TRACE4(( " %u\n", priv->vsindex )); error = FT_Err_Ok; @@ -979,7 +979,7 @@ goto Exit; } - FT_TRACE4(( " %d value%s blended\n", + FT_TRACE4(( " %u value%s blended\n", numBlends, numBlends == 1 ? "" : "s" )); @@ -1014,7 +1014,7 @@ if ( dict->maxstack < CFF2_DEFAULT_STACK ) dict->maxstack = CFF2_DEFAULT_STACK; - FT_TRACE4(( " %d\n", dict->maxstack )); + FT_TRACE4(( " %u\n", dict->maxstack )); Exit: return error; diff --git a/modules/freetype2/src/cff/cffparse.h b/modules/freetype2/src/cff/cffparse.h @@ -4,7 +4,7 @@ * * CFF token stream parser (specification) * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/cfftoken.h b/modules/freetype2/src/cff/cfftoken.h @@ -4,7 +4,7 @@ * * CFF token definitions (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cff/module.mk b/modules/freetype2/src/cff/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/cff/rules.mk b/modules/freetype2/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/cid/ciderrs.h b/modules/freetype2/src/cid/ciderrs.h @@ -4,7 +4,7 @@ * * CID error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidgload.c b/modules/freetype2/src/cid/cidgload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 Glyph Loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -103,20 +103,20 @@ if ( ( cid->fd_bytes == 1 && fd_select == 0xFFU ) || ( cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) { - FT_TRACE1(( "cid_load_glyph: fail for glyph index %d:\n", + FT_TRACE1(( "cid_load_glyph: fail for glyph index %u:\n", glyph_index )); - FT_TRACE1(( " FD number %ld is the maximum\n", + FT_TRACE1(( " FD number %lu is the maximum\n", fd_select )); - FT_TRACE1(( " integer fitting into %d byte%s\n", + FT_TRACE1(( " integer fitting into %u byte%s\n", cid->fd_bytes, cid->fd_bytes == 1 ? "" : "s" )); } else { - FT_TRACE0(( "cid_load_glyph: fail for glyph index %d:\n", + FT_TRACE0(( "cid_load_glyph: fail for glyph index %u:\n", glyph_index )); - FT_TRACE0(( " FD number %ld is larger\n", + FT_TRACE0(( " FD number %lu is larger\n", fd_select )); - FT_TRACE0(( " than number of dictionaries (%d)\n", + FT_TRACE0(( " than number of dictionaries (%u)\n", cid->num_dicts )); } @@ -125,7 +125,7 @@ } else if ( off2 > stream->size ) { - FT_TRACE0(( "cid_load_glyph: fail for glyph index %d:\n", + FT_TRACE0(( "cid_load_glyph: fail for glyph index %u:\n", glyph_index )); FT_TRACE0(( " end of the glyph data\n" )); FT_TRACE0(( " is beyond the data stream\n" )); @@ -135,7 +135,7 @@ } else if ( off1 > off2 ) { - FT_TRACE0(( "cid_load_glyph: fail for glyph index %d:\n", + FT_TRACE0(( "cid_load_glyph: fail for glyph index %u:\n", glyph_index )); FT_TRACE0(( " the end position of glyph data\n" )); FT_TRACE0(( " is set before the start position\n" )); @@ -252,8 +252,8 @@ cs_offset = decoder->lenIV >= 0 ? (FT_UInt)decoder->lenIV : 0; if ( cs_offset > glyph_length ) { - FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "offset to the charstring is beyond glyph length\n", + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%u," + " offset to the charstring is beyond glyph length\n", glyph_index )); error = FT_THROW( Invalid_Offset ); goto Exit; @@ -452,16 +452,12 @@ glyph->x_scale = cidsize->metrics.x_scale; glyph->y_scale = cidsize->metrics.y_scale; - cidglyph->outline.n_points = 0; - cidglyph->outline.n_contours = 0; - hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); glyph->hint = hinting; glyph->scaled = scaled; - cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; error = psaux->t1_decoder_funcs->init( &decoder, cidglyph->face, @@ -501,12 +497,8 @@ /* now set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ - /* bearing the yMax */ - cidglyph->outline.flags &= FT_OUTLINE_OWNER; - cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL; - - /* for composite glyphs, return only left side bearing and */ - /* advance width */ + /* bearing the yMax; for composite glyphs, return only */ + /* left side bearing and advance width */ if ( load_flags & FT_LOAD_NO_RECURSE ) { FT_Slot_Internal internal = cidglyph->internal; @@ -527,6 +519,13 @@ FT_Glyph_Metrics* metrics = &cidglyph->metrics; + cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; + + cidglyph->outline.flags &= FT_OUTLINE_OWNER; + cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL; + if ( cidsize->metrics.y_ppem < 24 ) + cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; + /* copy the _unscaled_ advance width */ metrics->horiAdvance = FIXED_TO_INT( decoder.builder.advance.x ); @@ -539,11 +538,6 @@ face->cid.font_bbox.yMin ) >> 16; cidglyph->linearVertAdvance = metrics->vertAdvance; - cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; - - if ( cidsize->metrics.y_ppem < 24 ) - cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; - /* apply the font matrix, if any */ if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L || font_matrix.xy != 0 || font_matrix.yx != 0 ) diff --git a/modules/freetype2/src/cid/cidgload.h b/modules/freetype2/src/cid/cidgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidload.c b/modules/freetype2/src/cid/cidload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidload.h b/modules/freetype2/src/cid/cidload.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidobjs.c b/modules/freetype2/src/cid/cidobjs.c @@ -4,7 +4,7 @@ * * CID objects manager (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidobjs.h b/modules/freetype2/src/cid/cidobjs.h @@ -4,7 +4,7 @@ * * CID objects manager (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidparse.c b/modules/freetype2/src/cid/cidparse.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidparse.h b/modules/freetype2/src/cid/cidparse.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidriver.c b/modules/freetype2/src/cid/cidriver.c @@ -4,7 +4,7 @@ * * CID driver interface (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidriver.h b/modules/freetype2/src/cid/cidriver.h @@ -4,7 +4,7 @@ * * High-level CID driver interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/cidtoken.h b/modules/freetype2/src/cid/cidtoken.h @@ -4,7 +4,7 @@ * * CID token definitions (specification only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/cid/module.mk b/modules/freetype2/src/cid/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/cid/rules.mk b/modules/freetype2/src/cid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/cid/type1cid.c b/modules/freetype2/src/cid/type1cid.c @@ -4,7 +4,7 @@ * * FreeType OpenType driver component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/dlg/dlgwrap.c b/modules/freetype2/src/dlg/dlgwrap.c @@ -4,7 +4,7 @@ * * Wrapper file for the 'dlg' library (body only) * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/dlg/rules.mk b/modules/freetype2/src/dlg/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/gxvalid/README b/modules/freetype2/src/gxvalid/README @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator ------------------------------------------------------------------------ -Copyright (C) 2004-2024 by +Copyright (C) 2004-2025 by suzuki toshiya, Masatake YAMATO, Red hat K.K., David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/modules/freetype2/src/gxvalid/gxvalid.c b/modules/freetype2/src/gxvalid/gxvalid.c @@ -4,7 +4,7 @@ * * FreeType validator for TrueTypeGX/AAT tables (body only). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvalid.h b/modules/freetype2/src/gxvalid/gxvalid.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT table validation (specification only). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvbsln.c b/modules/freetype2/src/gxvalid/gxvbsln.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT bsln table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvcommn.c b/modules/freetype2/src/gxvalid/gxvcommn.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common tables validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -1730,7 +1730,7 @@ { #ifdef FT_DEBUG_LEVEL_TRACE if ( odtect->range[i].name || odtect->range[j].name ) - GXV_TRACE(( "found overlap between range %d and range %d\n", + GXV_TRACE(( "found overlap between range %u and range %u\n", i, j )); else GXV_TRACE(( "found overlap between `%s' and `%s\'\n", diff --git a/modules/freetype2/src/gxvalid/gxvcommn.h b/modules/freetype2/src/gxvalid/gxvcommn.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common tables validation (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxverror.h b/modules/freetype2/src/gxvalid/gxverror.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT validation module error codes (specification only). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvfeat.c b/modules/freetype2/src/gxvalid/gxvfeat.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT feat table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -306,7 +306,7 @@ FT_INVALID_FORMAT; featureNameCount = FT_NEXT_USHORT( p ); - GXV_TRACE(( " (featureNameCount = %d)\n", featureNameCount )); + GXV_TRACE(( " (featureNameCount = %u)\n", featureNameCount )); if ( !( IS_PARANOID_VALIDATION ) ) p += 6; /* skip (none) and (none) */ diff --git a/modules/freetype2/src/gxvalid/gxvfeat.h b/modules/freetype2/src/gxvalid/gxvfeat.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT feat table validation (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvfgen.c b/modules/freetype2/src/gxvalid/gxvfgen.c @@ -5,7 +5,7 @@ * Generate feature registry data for gxv `feat' validator. * This program is derived from gxfeatreg.c in gxlayout. * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * Masatake YAMATO and Redhat K.K. * * This file may only be used, diff --git a/modules/freetype2/src/gxvalid/gxvjust.c b/modules/freetype2/src/gxvalid/gxvjust.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT just table validation (body). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -672,7 +672,7 @@ FT_TRACE3(( "validating `just' table\n" )); GXV_INIT; - limit = gxvalid->root->limit; + limit = gxvalid->root->limit; GXV_LIMIT_CHECK( 4 + 2 + 2 + 2 ); version = FT_NEXT_ULONG( p ); diff --git a/modules/freetype2/src/gxvalid/gxvkern.c b/modules/freetype2/src/gxvalid/gxvkern.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT kern table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -884,7 +884,7 @@ for ( i = 0; i < nTables; i++ ) { - GXV_TRACE(( "validating subtable %d/%lu\n", i, nTables )); + GXV_TRACE(( "validating subtable %u/%lu\n", i, nTables )); /* p should be 32bit-aligned? */ gxv_kern_subtable_validate( p, 0, gxvalid ); p += gxvalid->subtable_length; diff --git a/modules/freetype2/src/gxvalid/gxvlcar.c b/modules/freetype2/src/gxvalid/gxvlcar.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT lcar table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmod.c b/modules/freetype2/src/gxvalid/gxvmod.c @@ -4,7 +4,7 @@ * * FreeType's TrueTypeGX/AAT validation module implementation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmod.h b/modules/freetype2/src/gxvalid/gxvmod.h @@ -5,7 +5,7 @@ * FreeType's TrueTypeGX/AAT validation module implementation * (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmort.c b/modules/freetype2/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT mort table validation (body). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -207,7 +207,7 @@ func = fmt_funcs_table[type]; if ( !func ) - GXV_TRACE(( "morx type %d is reserved\n", type )); + GXV_TRACE(( "morx type %u is reserved\n", type )); func( p, p + rest, gxvalid ); diff --git a/modules/freetype2/src/gxvalid/gxvmort.h b/modules/freetype2/src/gxvalid/gxvmort.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common definition for mort table (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmort0.c b/modules/freetype2/src/gxvalid/gxvmort0.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type0 (Indic Script Rearrangement) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmort1.c b/modules/freetype2/src/gxvalid/gxvmort1.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type1 (Contextual Substitution) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmort2.c b/modules/freetype2/src/gxvalid/gxvmort2.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type2 (Ligature Substitution) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmort4.c b/modules/freetype2/src/gxvalid/gxvmort4.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type4 (Non-Contextual Glyph Substitution) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmort5.c b/modules/freetype2/src/gxvalid/gxvmort5.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type5 (Contextual Glyph Insertion) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmorx.c b/modules/freetype2/src/gxvalid/gxvmorx.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT morx table validation (body). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmorx.h b/modules/freetype2/src/gxvalid/gxvmorx.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common definition for morx table (specification). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmorx0.c b/modules/freetype2/src/gxvalid/gxvmorx0.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type0 (Indic Script Rearrangement) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmorx1.c b/modules/freetype2/src/gxvalid/gxvmorx1.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type1 (Contextual Substitution) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmorx2.c b/modules/freetype2/src/gxvalid/gxvmorx2.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type2 (Ligature Substitution) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmorx4.c b/modules/freetype2/src/gxvalid/gxvmorx4.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvmorx5.c b/modules/freetype2/src/gxvalid/gxvmorx5.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type5 (Contextual Glyph Insertion) subtable. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvopbd.c b/modules/freetype2/src/gxvalid/gxvopbd.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT opbd table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvprop.c b/modules/freetype2/src/gxvalid/gxvprop.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT prop table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/modules/freetype2/src/gxvalid/gxvtrak.c b/modules/freetype2/src/gxvalid/gxvtrak.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT trak table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -231,7 +231,7 @@ gxvalid->table_data = trak; gxvalid->face = face; - limit = gxvalid->root->limit; + limit = gxvalid->root->limit; FT_TRACE3(( "validating `trak' table\n" )); GXV_INIT; diff --git a/modules/freetype2/src/gxvalid/module.mk b/modules/freetype2/src/gxvalid/module.mk @@ -2,7 +2,7 @@ # FreeType 2 gxvalid module definition # -# Copyright (C) 2004-2024 by +# Copyright (C) 2004-2025 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/modules/freetype2/src/gxvalid/rules.mk b/modules/freetype2/src/gxvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2024 by +# Copyright (C) 2004-2025 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/modules/freetype2/src/gzip/ftgzip.c b/modules/freetype2/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ * parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/gzip/ftzconf.h b/modules/freetype2/src/gzip/ftzconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/modules/freetype2/src/gzip/gzguts.h b/modules/freetype2/src/gzip/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error); /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) diff --git a/modules/freetype2/src/gzip/inflate.c b/modules/freetype2/src/gzip/inflate.c @@ -1393,7 +1393,7 @@ int ZEXPORT inflateSync(z_streamp strm) { /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { diff --git a/modules/freetype2/src/gzip/inftrees.c b/modules/freetype2/src/gzip/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 static const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, diff --git a/modules/freetype2/src/gzip/inftrees.h b/modules/freetype2/src/gzip/inftrees.h @@ -44,8 +44,8 @@ typedef struct { examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ diff --git a/modules/freetype2/src/gzip/patches/freetype-zlib.diff b/modules/freetype2/src/gzip/patches/freetype-zlib.diff @@ -104,7 +104,7 @@ index 6c38f5c04..27487dcc2 100644 + +#endif /* !Z_FREETYPE */ diff --git b/src/gzip/gzguts.h a/src/gzip/gzguts.h -index f9375047e..f9a250b85 100644 +index eba72085b..d7d733bda 100644 --- b/src/gzip/gzguts.h +++ a/src/gzip/gzguts.h @@ -162,7 +162,7 @@ @@ -127,7 +127,7 @@ index 49c6d156c..a38c5be45 100644 -void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start); +static void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start); diff --git b/src/gzip/inflate.c a/src/gzip/inflate.c -index b0757a9b2..f7ed5d181 100644 +index 94ecff015..c8125680b 100644 --- b/src/gzip/inflate.c +++ a/src/gzip/inflate.c @@ -215,6 +215,8 @@ int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, @@ -184,7 +184,7 @@ index f127b6b1f..8a0e437ae 100644 + +#endif /* !INFLATE_H */ diff --git b/src/gzip/inftrees.c a/src/gzip/inftrees.c -index 8a208c2da..1fd655593 100644 +index 468eea879..98cfe1644 100644 --- b/src/gzip/inftrees.c +++ a/src/gzip/inftrees.c @@ -8,7 +8,7 @@ @@ -193,11 +193,11 @@ index 8a208c2da..1fd655593 100644 -const char inflate_copyright[] = +static const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome diff --git b/src/gzip/inftrees.h a/src/gzip/inftrees.h -index a10712d8c..47f726c36 100644 +index 396f74b5d..d735b0a51 100644 --- b/src/gzip/inftrees.h +++ a/src/gzip/inftrees.h @@ -3,6 +3,9 @@ @@ -221,7 +221,7 @@ index a10712d8c..47f726c36 100644 + +#endif /* !INFTREES_H */ diff --git b/src/gzip/zlib.h a/src/gzip/zlib.h -index 6b7244f99..5c7a884c9 100644 +index 8d4b932ea..8c3c42a32 100644 --- b/src/gzip/zlib.h +++ a/src/gzip/zlib.h @@ -31,7 +31,7 @@ @@ -305,7 +305,7 @@ index 6b7244f99..5c7a884c9 100644 /* utility functions */ @@ -1768,6 +1783,8 @@ ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ +#ifndef Z_FREETYPE @@ -404,7 +404,7 @@ index b1c5d2d3c..f76def425 100644 #ifndef Z_SOLO diff --git b/src/gzip/zutil.h a/src/gzip/zutil.h -index 902a304cc..a2c046a1f 100644 +index 48dd7feba..2c96797e3 100644 --- b/src/gzip/zutil.h +++ a/src/gzip/zutil.h @@ -53,8 +53,10 @@ typedef unsigned long ulg; @@ -416,9 +416,9 @@ index 902a304cc..a2c046a1f 100644 /* (size given to avoid silly warnings with Visual C++) */ +#endif - #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + #define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] -@@ -188,6 +190,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +@@ -167,6 +169,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #pragma warn -8066 #endif @@ -427,7 +427,7 @@ index 902a304cc..a2c046a1f 100644 /* provide prototypes for these when building zlib without LFS */ #if !defined(_WIN32) && \ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) -@@ -196,6 +200,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +@@ -175,6 +179,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t); #endif @@ -436,7 +436,7 @@ index 902a304cc..a2c046a1f 100644 /* common defaults */ #ifndef OS_CODE -@@ -227,9 +233,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +@@ -206,9 +212,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define zmemcmp _fmemcmp # define zmemzero(dest, len) _fmemset(dest, 0, len) # else diff --git a/modules/freetype2/src/gzip/rules.mk b/modules/freetype2/src/gzip/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2024 by +# Copyright (C) 2002-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/gzip/zlib.h b/modules/freetype2/src/gzip/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -941,10 +941,10 @@ ZEXTERN int ZEXPORT inflateSync(z_streamp strm); inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1773,14 +1773,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ #ifndef Z_FREETYPE diff --git a/modules/freetype2/src/gzip/zutil.h b/modules/freetype2/src/gzip/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -58,7 +58,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #endif -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -139,17 +139,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -172,18 +163,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 diff --git a/modules/freetype2/src/lzw/ftlzw.c b/modules/freetype2/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-2024 by + * Copyright (C) 2004-2025 by * Albert Chin-A-Young. * * based on code in `src/gzip/ftgzip.c' diff --git a/modules/freetype2/src/lzw/ftzopen.c b/modules/freetype2/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-2024 by + * Copyright (C) 2005-2025 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/lzw/ftzopen.h b/modules/freetype2/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-2024 by + * Copyright (C) 2005-2025 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/lzw/rules.mk b/modules/freetype2/src/lzw/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2024 by +# Copyright (C) 2004-2025 by # Albert Chin-A-Young. # # based on `src/lzw/rules.mk' diff --git a/modules/freetype2/src/otvalid/module.mk b/modules/freetype2/src/otvalid/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2024 by +# Copyright (C) 2004-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/otvalid/otvalid.c b/modules/freetype2/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ * * FreeType validator for OpenType tables (body only). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/otvalid/otvalid.h b/modules/freetype2/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ * * OpenType table validation (specification only). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/otvalid/otvbase.c b/modules/freetype2/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ * * OpenType BASE table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -44,7 +44,7 @@ BaseCoordFormat = FT_NEXT_USHORT( p ); p += 2; /* skip Coordinate */ - OTV_TRACE(( " (format %d)\n", BaseCoordFormat )); + OTV_TRACE(( " (format %u)\n", BaseCoordFormat )); switch ( BaseCoordFormat ) { @@ -83,7 +83,7 @@ BaseTagCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (BaseTagCount = %d)\n", BaseTagCount )); + OTV_TRACE(( " (BaseTagCount = %u)\n", BaseTagCount )); OTV_LIMIT_CHECK( BaseTagCount * 4 ); /* BaselineTag */ @@ -106,7 +106,7 @@ p += 2; /* skip DefaultIndex */ BaseCoordCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (BaseCoordCount = %d)\n", BaseCoordCount )); + OTV_TRACE(( " (BaseCoordCount = %u)\n", BaseCoordCount )); OTV_LIMIT_CHECK( BaseCoordCount * 2 ); @@ -138,7 +138,7 @@ OTV_OPTIONAL_OFFSET( MaxCoord ); FeatMinMaxCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (FeatMinMaxCount = %d)\n", FeatMinMaxCount )); + OTV_TRACE(( " (FeatMinMaxCount = %u)\n", FeatMinMaxCount )); table_size = FeatMinMaxCount * 8 + 6; @@ -192,7 +192,7 @@ OTV_OPTIONAL_OFFSET( DefaultMinMax ); BaseLangSysCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (BaseLangSysCount = %d)\n", BaseLangSysCount )); + OTV_TRACE(( " (BaseLangSysCount = %u)\n", BaseLangSysCount )); table_size = BaseLangSysCount * 6 + 6; @@ -231,7 +231,7 @@ OTV_LIMIT_CHECK( 2 ); BaseScriptCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (BaseScriptCount = %d)\n", BaseScriptCount )); + OTV_TRACE(( " (BaseScriptCount = %u)\n", BaseScriptCount )); OTV_LIMIT_CHECK( BaseScriptCount * 6 ); diff --git a/modules/freetype2/src/otvalid/otvcommn.c b/modules/freetype2/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ * * OpenType common tables validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -52,7 +52,7 @@ OTV_LIMIT_CHECK( 4 ); CoverageFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", CoverageFormat )); + OTV_TRACE(( " (format %u)\n", CoverageFormat )); switch ( CoverageFormat ) { @@ -64,7 +64,7 @@ GlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + OTV_TRACE(( " (GlyphCount = %u)\n", GlyphCount )); OTV_LIMIT_CHECK( GlyphCount * 2 ); /* GlyphArray */ @@ -90,7 +90,7 @@ RangeCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (RangeCount = %d)\n", RangeCount )); + OTV_TRACE(( " (RangeCount = %u)\n", RangeCount )); OTV_LIMIT_CHECK( RangeCount * 6 ); @@ -233,7 +233,7 @@ OTV_LIMIT_CHECK( 4 ); ClassFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", ClassFormat )); + OTV_TRACE(( " (format %u)\n", ClassFormat )); switch ( ClassFormat ) { @@ -248,7 +248,7 @@ StartGlyph = FT_NEXT_USHORT( p ); GlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + OTV_TRACE(( " (GlyphCount = %u)\n", GlyphCount )); OTV_LIMIT_CHECK( GlyphCount * 2 ); /* ClassValueArray */ @@ -265,7 +265,7 @@ ClassRangeCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (ClassRangeCount = %d)\n", ClassRangeCount )); + OTV_TRACE(( " (ClassRangeCount = %u)\n", ClassRangeCount )); OTV_LIMIT_CHECK( ClassRangeCount * 6 ); @@ -368,14 +368,14 @@ LookupFlag = FT_NEXT_USHORT( p ); SubTableCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (type %d)\n", LookupType )); + OTV_TRACE(( " (type %u)\n", LookupType )); if ( LookupType == 0 || LookupType > otvalid->type_count ) FT_INVALID_DATA; validate = otvalid->type_funcs[LookupType - 1]; - OTV_TRACE(( " (SubTableCount = %d)\n", SubTableCount )); + OTV_TRACE(( " (SubTableCount = %u)\n", SubTableCount )); OTV_LIMIT_CHECK( SubTableCount * 2 ); @@ -405,7 +405,7 @@ OTV_LIMIT_CHECK( 2 ); LookupCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (LookupCount = %d)\n", LookupCount )); + OTV_TRACE(( " (LookupCount = %u)\n", LookupCount )); OTV_LIMIT_CHECK( LookupCount * 2 ); @@ -450,7 +450,7 @@ p += 2; /* skip FeatureParams (unused) */ LookupCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (LookupCount = %d)\n", LookupCount )); + OTV_TRACE(( " (LookupCount = %u)\n", LookupCount )); OTV_LIMIT_CHECK( LookupCount * 2 ); @@ -486,7 +486,7 @@ OTV_LIMIT_CHECK( 2 ); FeatureCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (FeatureCount = %d)\n", FeatureCount )); + OTV_TRACE(( " (FeatureCount = %u)\n", FeatureCount )); OTV_LIMIT_CHECK( FeatureCount * 2 ); @@ -532,8 +532,8 @@ ReqFeatureIndex = FT_NEXT_USHORT( p ); FeatureCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (ReqFeatureIndex = %d)\n", ReqFeatureIndex )); - OTV_TRACE(( " (FeatureCount = %d)\n", FeatureCount )); + OTV_TRACE(( " (ReqFeatureIndex = %u)\n", ReqFeatureIndex )); + OTV_TRACE(( " (FeatureCount = %u)\n", FeatureCount )); if ( ReqFeatureIndex != 0xFFFFU && ReqFeatureIndex >= otvalid->extra1 ) FT_INVALID_DATA; @@ -571,7 +571,7 @@ DefaultLangSys = FT_NEXT_USHORT( p ); LangSysCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (LangSysCount = %d)\n", LangSysCount )); + OTV_TRACE(( " (LangSysCount = %u)\n", LangSysCount )); if ( DefaultLangSys != 0 ) otv_LangSys_validate( table + DefaultLangSys, otvalid ); @@ -607,7 +607,7 @@ OTV_LIMIT_CHECK( 2 ); ScriptCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (ScriptCount = %d)\n", ScriptCount )); + OTV_TRACE(( " (ScriptCount = %u)\n", ScriptCount )); OTV_LIMIT_CHECK( ScriptCount * 6 ); @@ -665,7 +665,7 @@ OTV_LIMIT_CHECK( 2 ); Count = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (Count = %d)\n", Count )); + OTV_TRACE(( " (Count = %u)\n", Count )); OTV_LIMIT_CHECK( Count * 2 ); @@ -698,7 +698,7 @@ Coverage = FT_NEXT_USHORT( p ); Count = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (Count = %d)\n", Count )); + OTV_TRACE(( " (Count = %u)\n", Count )); otv_Coverage_validate( table + Coverage, otvalid, (FT_Int)Count ); @@ -731,7 +731,7 @@ OTV_LIMIT_CHECK( 2 ); Count = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (Count = %d)\n", Count )); + OTV_TRACE(( " (Count = %u)\n", Count )); OTV_LIMIT_CHECK( Count * 2 ); @@ -765,8 +765,8 @@ Count1 = FT_NEXT_USHORT( p ); Count2 = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (Count1 = %d)\n", Count1 )); - OTV_TRACE(( " (Count2 = %d)\n", Count2 )); + OTV_TRACE(( " (Count1 = %u)\n", Count1 )); + OTV_TRACE(( " (Count2 = %u)\n", Count2 )); if ( Count1 == 0 ) FT_INVALID_DATA; @@ -806,7 +806,7 @@ OTV_LIMIT_CHECK( 2 ); BacktrackCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (BacktrackCount = %d)\n", BacktrackCount )); + OTV_TRACE(( " (BacktrackCount = %u)\n", BacktrackCount )); OTV_LIMIT_CHECK( BacktrackCount * 2 + 2 ); p += BacktrackCount * 2; @@ -815,21 +815,21 @@ if ( InputCount == 0 ) FT_INVALID_DATA; - OTV_TRACE(( " (InputCount = %d)\n", InputCount )); + OTV_TRACE(( " (InputCount = %u)\n", InputCount )); OTV_LIMIT_CHECK( InputCount * 2 ); p += ( InputCount - 1 ) * 2; LookaheadCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (LookaheadCount = %d)\n", LookaheadCount )); + OTV_TRACE(( " (LookaheadCount = %u)\n", LookaheadCount )); OTV_LIMIT_CHECK( LookaheadCount * 2 + 2 ); p += LookaheadCount * 2; Count = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (Count = %d)\n", Count )); + OTV_TRACE(( " (Count = %u)\n", Count )); OTV_LIMIT_CHECK( Count * 4 ); @@ -866,7 +866,7 @@ ClassDef = FT_NEXT_USHORT( p ); ClassSetCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (ClassSetCount = %d)\n", ClassSetCount )); + OTV_TRACE(( " (ClassSetCount = %u)\n", ClassSetCount )); otv_Coverage_validate( table + Coverage, otvalid, -1 ); otv_ClassDef_validate( table + ClassDef, otvalid ); @@ -910,8 +910,8 @@ GlyphCount = FT_NEXT_USHORT( p ); Count = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); - OTV_TRACE(( " (Count = %d)\n", Count )); + OTV_TRACE(( " (GlyphCount = %u)\n", GlyphCount )); + OTV_TRACE(( " (Count = %u)\n", Count )); OTV_LIMIT_CHECK( GlyphCount * 2 + Count * 4 ); @@ -955,7 +955,7 @@ LookaheadClassDef = FT_NEXT_USHORT( p ); ChainClassSetCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (ChainClassSetCount = %d)\n", ChainClassSetCount )); + OTV_TRACE(( " (ChainClassSetCount = %u)\n", ChainClassSetCount )); otv_Coverage_validate( table + Coverage, otvalid, -1 ); @@ -1002,7 +1002,7 @@ OTV_LIMIT_CHECK( 2 ); BacktrackGlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount )); + OTV_TRACE(( " (BacktrackGlyphCount = %u)\n", BacktrackGlyphCount )); OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 ); @@ -1011,7 +1011,7 @@ InputGlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (InputGlyphCount = %d)\n", InputGlyphCount )); + OTV_TRACE(( " (InputGlyphCount = %u)\n", InputGlyphCount )); OTV_LIMIT_CHECK( InputGlyphCount * 2 + 2 ); @@ -1020,7 +1020,7 @@ LookaheadGlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (LookaheadGlyphCount = %d)\n", LookaheadGlyphCount )); + OTV_TRACE(( " (LookaheadGlyphCount = %u)\n", LookaheadGlyphCount )); OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 ); @@ -1029,7 +1029,7 @@ count2 = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (Count = %d)\n", count2 )); + OTV_TRACE(( " (Count = %u)\n", count2 )); OTV_LIMIT_CHECK( count2 * 4 ); diff --git a/modules/freetype2/src/otvalid/otvcommn.h b/modules/freetype2/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ * * OpenType common tables validation (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/otvalid/otverror.h b/modules/freetype2/src/otvalid/otverror.h @@ -4,7 +4,7 @@ * * OpenType validation module error codes (specification only). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/otvalid/otvgdef.c b/modules/freetype2/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ * * OpenType GDEF table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -59,7 +59,7 @@ Coverage = table + FT_NEXT_USHORT( p ); GlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + OTV_TRACE(( " (GlyphCount = %u)\n", GlyphCount )); otv_Coverage_validate( Coverage, otvalid, (FT_Int)GlyphCount ); if ( GlyphCount != otv_Coverage_get_count( Coverage ) ) @@ -104,7 +104,7 @@ CaretValueFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format = %d)\n", CaretValueFormat )); + OTV_TRACE(( " (format = %u)\n", CaretValueFormat )); switch ( CaretValueFormat ) { @@ -156,7 +156,7 @@ OTV_LIMIT_CHECK( 2 ); MarkGlyphSetCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (MarkGlyphSetCount = %d)\n", MarkGlyphSetCount )); + OTV_TRACE(( " (MarkGlyphSetCount = %u)\n", MarkGlyphSetCount )); OTV_LIMIT_CHECK( MarkGlyphSetCount * 4 ); /* CoverageOffsets */ diff --git a/modules/freetype2/src/otvalid/otvgpos.c b/modules/freetype2/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ * * OpenType GPOS table validation (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -69,7 +69,7 @@ Count = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (Count = %d)\n", Count )); + OTV_TRACE(( " (Count = %u)\n", Count )); OTV_LIMIT_CHECK( Count * otvalid->extra1 * 2 ); @@ -252,7 +252,7 @@ OTV_LIMIT_CHECK( 6 ); AnchorFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", AnchorFormat )); + OTV_TRACE(( " (format %u)\n", AnchorFormat )); p += 4; /* skip XCoordinate and YCoordinate */ @@ -318,7 +318,7 @@ OTV_LIMIT_CHECK( 2 ); MarkCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (MarkCount = %d)\n", MarkCount )); + OTV_TRACE(( " (MarkCount = %u)\n", MarkCount )); OTV_LIMIT_CHECK( MarkCount * 4 ); @@ -357,7 +357,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); otvalid->extra3 = table; @@ -387,7 +387,7 @@ ValueFormat = FT_NEXT_USHORT( p ); ValueCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (ValueCount = %d)\n", ValueCount )); + OTV_TRACE(( " (ValueCount = %u)\n", ValueCount )); len_value = otv_value_length( ValueFormat ); @@ -441,7 +441,7 @@ OTV_LIMIT_CHECK( 2 ); PairValueCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (PairValueCount = %d)\n", PairValueCount )); + OTV_TRACE(( " (PairValueCount = %u)\n", PairValueCount )); value_len1 = otv_value_length( format1 ); value_len2 = otv_value_length( format2 ); @@ -481,7 +481,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { @@ -496,7 +496,7 @@ ValueFormat2 = FT_NEXT_USHORT( p ); PairSetCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (PairSetCount = %d)\n", PairSetCount )); + OTV_TRACE(( " (PairSetCount = %u)\n", PairSetCount )); otv_Coverage_validate( table + Coverage, otvalid, -1 ); @@ -524,8 +524,8 @@ ClassCount1 = FT_NEXT_USHORT( p ); ClassCount2 = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (ClassCount1 = %d)\n", ClassCount1 )); - OTV_TRACE(( " (ClassCount2 = %d)\n", ClassCount2 )); + OTV_TRACE(( " (ClassCount1 = %u)\n", ClassCount1 )); + OTV_TRACE(( " (ClassCount2 = %u)\n", ClassCount2 )); len_value1 = otv_value_length( ValueFormat1 ); len_value2 = otv_value_length( ValueFormat2 ); @@ -588,7 +588,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { @@ -605,7 +605,7 @@ Coverage = FT_NEXT_USHORT( p ); EntryExitCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (EntryExitCount = %d)\n", EntryExitCount )); + OTV_TRACE(( " (EntryExitCount = %u)\n", EntryExitCount )); otv_Coverage_validate( table + Coverage, otvalid, @@ -666,7 +666,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { @@ -707,7 +707,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { @@ -748,7 +748,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { @@ -789,7 +789,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { @@ -848,7 +848,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { @@ -909,7 +909,7 @@ OTV_LIMIT_CHECK( 2 ); PosFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", PosFormat )); + OTV_TRACE(( " (format %u)\n", PosFormat )); switch ( PosFormat ) { diff --git a/modules/freetype2/src/otvalid/otvgpos.h b/modules/freetype2/src/otvalid/otvgpos.h @@ -4,7 +4,7 @@ * * OpenType GPOS table validator (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/otvalid/otvgsub.c b/modules/freetype2/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ * * OpenType GSUB table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 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 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -99,7 +99,7 @@ Coverage = FT_NEXT_USHORT( p ); GlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + OTV_TRACE(( " (GlyphCount = %u)\n", GlyphCount )); otv_Coverage_validate( table + Coverage, otvalid, @@ -145,7 +145,7 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -186,7 +186,7 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -233,7 +233,7 @@ CompCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (CompCount = %d)\n", CompCount )); + OTV_TRACE(( " (CompCount = %u)\n", CompCount )); if ( CompCount == 0 ) FT_INVALID_DATA; @@ -261,7 +261,7 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -301,7 +301,7 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -360,7 +360,7 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -421,7 +421,7 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -478,7 +478,7 @@ OTV_LIMIT_CHECK( 2 ); SubstFormat = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (format %d)\n", SubstFormat )); + OTV_TRACE(( " (format %u)\n", SubstFormat )); switch ( SubstFormat ) { @@ -487,7 +487,7 @@ Coverage = table + FT_NEXT_USHORT( p ); BacktrackGlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount )); + OTV_TRACE(( " (BacktrackGlyphCount = %u)\n", BacktrackGlyphCount )); otv_Coverage_validate( Coverage, otvalid, -1 ); @@ -498,7 +498,7 @@ LookaheadGlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (LookaheadGlyphCount = %d)\n", LookaheadGlyphCount )); + OTV_TRACE(( " (LookaheadGlyphCount = %u)\n", LookaheadGlyphCount )); OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 ); @@ -507,7 +507,7 @@ GlyphCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + OTV_TRACE(( " (GlyphCount = %u)\n", GlyphCount )); if ( GlyphCount != otv_Coverage_get_count( Coverage ) ) FT_INVALID_DATA; diff --git a/modules/freetype2/src/otvalid/otvjstf.c b/modules/freetype2/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ * * OpenType JSTF table validation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -163,7 +163,7 @@ OTV_OPTIONAL_OFFSET( DefJstfLangSys ); JstfLangSysCount = FT_NEXT_USHORT( p ); - OTV_TRACE(( " (JstfLangSysCount = %d)\n", JstfLangSysCount )); + OTV_TRACE(( " (JstfLangSysCount = %u)\n", JstfLangSysCount )); table_size = JstfLangSysCount * 6 + 6; @@ -227,7 +227,7 @@ JstfScriptCount = FT_NEXT_USHORT( p ); - FT_TRACE3(( " (JstfScriptCount = %d)\n", JstfScriptCount )); + FT_TRACE3(( " (JstfScriptCount = %u)\n", JstfScriptCount )); OTV_LIMIT_CHECK( JstfScriptCount * 6 ); diff --git a/modules/freetype2/src/otvalid/otvmath.c b/modules/freetype2/src/otvalid/otvmath.c @@ -4,7 +4,7 @@ * * OpenType MATH table validation (body). * - * Copyright (C) 2007-2024 by + * Copyright (C) 2007-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by George Williams. diff --git a/modules/freetype2/src/otvalid/otvmod.c b/modules/freetype2/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ * * FreeType's OpenType validation module implementation (body). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/otvalid/otvmod.h b/modules/freetype2/src/otvalid/otvmod.h @@ -5,7 +5,7 @@ * FreeType's OpenType validation module implementation * (specification). * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/otvalid/rules.mk b/modules/freetype2/src/otvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2024 by +# Copyright (C) 2004-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/pcf/pcfdrivr.c b/modules/freetype2/src/pcf/pcfdrivr.c @@ -461,7 +461,7 @@ THE SOFTWARE. FT_ULong bytes; - FT_TRACE1(( "PCF_Glyph_Load: glyph index %d\n", glyph_index )); + FT_TRACE1(( "PCF_Glyph_Load: glyph index %u\n", glyph_index )); if ( !face ) { diff --git a/modules/freetype2/src/pcf/pcfread.c b/modules/freetype2/src/pcf/pcfread.c @@ -121,7 +121,7 @@ THE SOFTWARE. toc->count > 9 ) { FT_TRACE0(( "pcf_read_TOC: adjusting number of tables" - " (from %ld to %ld)\n", + " (from %lu to %lu)\n", toc->count, FT_MIN( stream->size >> 4, 9 ) )); toc->count = FT_MIN( stream->size >> 4, 9 ); @@ -231,7 +231,7 @@ THE SOFTWARE. FT_TRACE4(( "pcf_read_TOC:\n" )); - FT_TRACE4(( " number of tables: %ld\n", face->toc.count )); + FT_TRACE4(( " number of tables: %lu\n", face->toc.count )); tables = face->toc.tables; for ( i = 0; i < toc->count; i++ ) @@ -241,8 +241,8 @@ THE SOFTWARE. if ( tables[i].type == 1UL << j ) name = tableNames[j]; - FT_TRACE4(( " %d: type=%s, format=0x%lX," - " size=%ld (0x%lX), offset=%ld (0x%lX)\n", + FT_TRACE4(( " %u: type=%s, format=0x%lX," + " size=%lu (0x%lX), offset=%lu (0x%lX)\n", i, name, tables[i].format, tables[i].size, tables[i].size, @@ -516,7 +516,7 @@ THE SOFTWARE. if ( error ) goto Bail; - FT_TRACE4(( " number of properties: %ld\n", orig_nprops )); + FT_TRACE4(( " number of properties: %lu\n", orig_nprops )); /* rough estimate */ if ( orig_nprops > size / PCF_PROPERTY_SIZE ) @@ -588,7 +588,7 @@ THE SOFTWARE. if ( error ) goto Bail; - FT_TRACE4(( " string size: %ld\n", string_size )); + FT_TRACE4(( " string size: %lu\n", string_size )); /* rough estimate */ if ( string_size > size - orig_nprops * PCF_PROPERTY_SIZE ) @@ -725,7 +725,7 @@ THE SOFTWARE. if ( error ) return FT_THROW( Invalid_File_Format ); - FT_TRACE4(( " number of metrics: %ld\n", orig_nmetrics )); + FT_TRACE4(( " number of metrics: %lu\n", orig_nmetrics )); /* rough estimate */ if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) @@ -776,7 +776,7 @@ THE SOFTWARE. FT_TRACE4(( "\n" )); for ( i = 1; i < face->nmetrics; i++, metrics++ ) { - FT_TRACE5(( " idx %ld:", i )); + FT_TRACE5(( " idx %lu:", i )); error = pcf_get_metric( stream, format, metrics ); metrics->bits = 0; @@ -797,7 +797,7 @@ THE SOFTWARE. metrics->descent = 0; FT_TRACE0(( "pcf_get_metrics:" - " invalid metrics for glyph %ld\n", i )); + " invalid metrics for glyph %lu\n", i )); } } @@ -858,7 +858,7 @@ THE SOFTWARE. if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return FT_THROW( Invalid_File_Format ); - FT_TRACE4(( " number of bitmaps: %ld\n", orig_nbitmaps )); + FT_TRACE4(( " number of bitmaps: %lu\n", orig_nbitmaps )); /* see comment in `pcf_get_metrics' */ if ( orig_nbitmaps > 65534 ) diff --git a/modules/freetype2/src/pfr/module.mk b/modules/freetype2/src/pfr/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2024 by +# Copyright (C) 2002-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/pfr/pfr.c b/modules/freetype2/src/pfr/pfr.c @@ -4,7 +4,7 @@ * * FreeType PFR driver component. * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrcmap.c b/modules/freetype2/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ * * FreeType PFR cmap handling (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrcmap.h b/modules/freetype2/src/pfr/pfrcmap.h @@ -4,7 +4,7 @@ * * FreeType PFR cmap handling (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrdrivr.c b/modules/freetype2/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ * * FreeType PFR driver interface (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrdrivr.h b/modules/freetype2/src/pfr/pfrdrivr.h @@ -4,7 +4,7 @@ * * High-level Type PFR driver interface (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrerror.h b/modules/freetype2/src/pfr/pfrerror.h @@ -4,7 +4,7 @@ * * PFR error codes (specification only). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrgload.c b/modules/freetype2/src/pfr/pfrgload.c @@ -4,7 +4,7 @@ * * FreeType PFR glyph loader (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 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 @@ break; case 2: /* horizontal line to */ - FT_TRACE6(( "- horizontal line to cx.%d", format_low )); + FT_TRACE6(( "- horizontal line to cx.%u", format_low )); if ( format_low >= x_count ) goto Failure; pos[0].x = glyph->x_control[format_low]; @@ -398,7 +398,7 @@ break; case 3: /* vertical line to */ - FT_TRACE6(( "- vertical line to cy.%d", format_low )); + FT_TRACE6(( "- vertical line to cy.%u", format_low )); if ( format_low >= y_count ) goto Failure; pos[0].x = pos[3].x; @@ -444,7 +444,7 @@ if ( idx >= x_count ) goto Failure; cur->x = glyph->x_control[idx]; - FT_TRACE7(( " cx#%d", idx )); + FT_TRACE7(( " cx#%u", idx )); break; case 1: /* 16-bit absolute value */ @@ -474,7 +474,7 @@ if ( idx >= y_count ) goto Failure; cur->y = glyph->y_control[idx]; - FT_TRACE7(( " cy#%d", idx )); + FT_TRACE7(( " cy#%u", idx )); break; case 1: /* 16-bit absolute value */ @@ -754,7 +754,7 @@ count = glyph->num_subs - old_count; - FT_TRACE4(( "compound glyph with %d element%s (offset %lu):\n", + FT_TRACE4(( "compound glyph with %u element%s (offset %lu):\n", count, count == 1 ? "" : "s", offset )); @@ -766,7 +766,7 @@ PFR_SubGlyph subglyph; - FT_TRACE4(( " subglyph %d:\n", n )); + FT_TRACE4(( " subglyph %u:\n", n )); subglyph = glyph->subs + old_count + n; old_points = base->n_points; @@ -810,7 +810,7 @@ /* proceed to next sub-glyph */ } - FT_TRACE4(( "end compound glyph with %d element%s\n", + FT_TRACE4(( "end compound glyph with %u element%s\n", count, count == 1 ? "" : "s" )); } diff --git a/modules/freetype2/src/pfr/pfrgload.h b/modules/freetype2/src/pfr/pfrgload.h @@ -4,7 +4,7 @@ * * FreeType PFR glyph loader (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrload.c b/modules/freetype2/src/pfr/pfrload.c @@ -4,7 +4,7 @@ * * FreeType PFR loader (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrload.h b/modules/freetype2/src/pfr/pfrload.h @@ -4,7 +4,7 @@ * * FreeType PFR loader (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrobjs.c b/modules/freetype2/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ * * FreeType PFR object methods (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -326,7 +326,7 @@ FT_ULong gps_offset; - FT_TRACE1(( "pfr_slot_load: glyph index %d\n", gindex )); + FT_TRACE1(( "pfr_slot_load: glyph index %u\n", gindex )); if ( gindex > 0 ) gindex--; @@ -355,11 +355,8 @@ goto Exit; } - gchar = face->phy_font.chars + gindex; - pfrslot->format = FT_GLYPH_FORMAT_OUTLINE; - outline->n_points = 0; - outline->n_contours = 0; - gps_offset = face->header.gps_section_offset; + gchar = face->phy_font.chars + gindex; + gps_offset = face->header.gps_section_offset; /* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */ error = pfr_glyph_load( &slot->glyph, face->root.stream, @@ -371,10 +368,9 @@ FT_Glyph_Metrics* metrics = &pfrslot->metrics; FT_Pos advance; FT_UInt em_metrics, em_outline; - FT_Bool scaling; - scaling = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) ); + pfrslot->format = FT_GLYPH_FORMAT_OUTLINE; /* copy outline data */ *outline = slot->glyph.loader->base.outline; @@ -429,7 +425,7 @@ #endif /* scale when needed */ - if ( scaling ) + if ( !( load_flags & FT_LOAD_NO_SCALE ) ) { FT_Int n; FT_Fixed x_scale = pfrsize->metrics.x_scale; diff --git a/modules/freetype2/src/pfr/pfrobjs.h b/modules/freetype2/src/pfr/pfrobjs.h @@ -4,7 +4,7 @@ * * FreeType PFR object methods (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrsbit.c b/modules/freetype2/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ * * FreeType PFR bitmap loader (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrsbit.h b/modules/freetype2/src/pfr/pfrsbit.h @@ -4,7 +4,7 @@ * * FreeType PFR bitmap loader (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/pfrtypes.h b/modules/freetype2/src/pfr/pfrtypes.h @@ -4,7 +4,7 @@ * * FreeType PFR data structures (specification only). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pfr/rules.mk b/modules/freetype2/src/pfr/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2024 by +# Copyright (C) 2002-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/psaux/afmparse.c b/modules/freetype2/src/psaux/afmparse.c @@ -4,7 +4,7 @@ * * AFM parser (body). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/afmparse.h b/modules/freetype2/src/psaux/afmparse.h @@ -4,7 +4,7 @@ * * AFM parser (specification). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/cffdecode.c b/modules/freetype2/src/psaux/cffdecode.c @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (body). * - * Copyright (C) 2017-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -2141,7 +2141,7 @@ decoder->locals_bias ); - FT_TRACE4(( " callsubr (idx %d, entering level %td)\n", + FT_TRACE4(( " callsubr (idx %u, entering level %td)\n", idx, zone - decoder->zones + 1 )); @@ -2185,7 +2185,7 @@ decoder->globals_bias ); - FT_TRACE4(( " callgsubr (idx %d, entering level %td)\n", + FT_TRACE4(( " callgsubr (idx %u, entering level %td)\n", idx, zone - decoder->zones + 1 )); diff --git a/modules/freetype2/src/psaux/cffdecode.h b/modules/freetype2/src/psaux/cffdecode.h @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (specification). * - * Copyright (C) 2017-2024 by + * Copyright (C) 2017-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/module.mk b/modules/freetype2/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/psaux/psaux.c b/modules/freetype2/src/psaux/psaux.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript driver component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/psauxerr.h b/modules/freetype2/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ * * PS auxiliary module error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/psauxmod.c b/modules/freetype2/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/psauxmod.h b/modules/freetype2/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -46,9 +46,6 @@ FT_BEGIN_HEADER const CFF_Decoder_FuncsRec cff_decoder_funcs; - FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; - - FT_DECLARE_MODULE( psaux_module_class ) diff --git a/modules/freetype2/src/psaux/psconv.c b/modules/freetype2/src/psaux/psconv.c @@ -4,7 +4,7 @@ * * Some convenience conversions (body). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/psconv.h b/modules/freetype2/src/psaux/psconv.h @@ -4,7 +4,7 @@ * * Some convenience conversions (specification). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/psintrp.c b/modules/freetype2/src/psaux/psintrp.c @@ -618,7 +618,7 @@ /* Our copy of it does not change that requirement. */ cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 ); - charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack ); + charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack ); /* catch errors so far */ if ( *error ) diff --git a/modules/freetype2/src/psaux/psobjs.c b/modules/freetype2/src/psaux/psobjs.c @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -460,6 +460,9 @@ case '%': skip_comment( &cur, limit ); break; + + default: + break; } } @@ -1145,7 +1148,7 @@ FT_ERROR(( "ps_parser_load_field:" " expected a name or string\n" )); FT_ERROR(( " " - " but found token of type %d instead\n", + " but found token of type %u instead\n", token.type )); error = FT_THROW( Invalid_File_Format ); goto Exit; @@ -1225,7 +1228,7 @@ if ( result < 0 || (FT_UInt)result < max_objects ) { FT_ERROR(( "ps_parser_load_field:" - " expected %d integer%s in the %s subarray\n", + " expected %u integer%s in the %s subarray\n", max_objects, max_objects > 1 ? "s" : "", i == 0 ? "first" : ( i == 1 ? "second" diff --git a/modules/freetype2/src/psaux/psobjs.h b/modules/freetype2/src/psaux/psobjs.h @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/rules.mk b/modules/freetype2/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/psaux/t1cmap.c b/modules/freetype2/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ * * Type 1 character map support (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/t1cmap.h b/modules/freetype2/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ * * Type 1 character map support (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psaux/t1decode.c b/modules/freetype2/src/psaux/t1decode.c @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1633,7 +1633,7 @@ default: FT_ERROR(( "t1_decoder_parse_charstrings:" - " unhandled opcode %d\n", op )); + " unhandled opcode %u\n", op )); goto Syntax_Error; } diff --git a/modules/freetype2/src/psaux/t1decode.h b/modules/freetype2/src/psaux/t1decode.h @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (specification). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/module.mk b/modules/freetype2/src/pshinter/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/pshinter/pshalgo.c b/modules/freetype2/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (body). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used @@ -100,7 +100,7 @@ if ( idx >= table->max_hints ) { - FT_TRACE0(( "psh_hint_table_record: invalid hint index %d\n", idx )); + FT_TRACE0(( "psh_hint_table_record: invalid hint index %u\n", idx )); return; } diff --git a/modules/freetype2/src/pshinter/pshalgo.h b/modules/freetype2/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (specification). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/pshglob.c b/modules/freetype2/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ * PostScript hinter global hinting management (body). * Inspired by the new auto-hinter module. * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/modules/freetype2/src/pshinter/pshglob.h b/modules/freetype2/src/pshinter/pshglob.h @@ -4,7 +4,7 @@ * * PostScript hinter global hinting management. * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/pshinter.c b/modules/freetype2/src/pshinter/pshinter.c @@ -4,7 +4,7 @@ * * FreeType PostScript Hinting module * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/pshmod.c b/modules/freetype2/src/pshinter/pshmod.c @@ -4,7 +4,7 @@ * * FreeType PostScript hinter module implementation (body). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/pshmod.h b/modules/freetype2/src/pshinter/pshmod.h @@ -4,7 +4,7 @@ * * PostScript hinter module interface (specification). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/pshnterr.h b/modules/freetype2/src/pshinter/pshnterr.h @@ -4,7 +4,7 @@ * * PS Hinter error codes (specification only). * - * Copyright (C) 2003-2024 by + * Copyright (C) 2003-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/pshrec.c b/modules/freetype2/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ * * FreeType PostScript hints recorder (body). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -467,7 +467,7 @@ table->num_masks--; } else - FT_TRACE0(( "ps_mask_table_merge: ignoring invalid indices (%d,%d)\n", + FT_TRACE0(( "ps_mask_table_merge: ignoring invalid indices (%u,%u)\n", index1, index2 )); Exit: @@ -817,7 +817,7 @@ /* limit "dimension" to 0..1 */ if ( dimension > 1 ) { - FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n", + FT_TRACE0(( "ps_hints_stem: invalid dimension (%u) used\n", dimension )); dimension = ( dimension != 0 ); } @@ -870,7 +870,7 @@ /* limit "dimension" to 0..1 */ if ( dimension > 1 ) { - FT_TRACE0(( "ps_hints_t1stem3: invalid dimension (%d) used\n", + FT_TRACE0(( "ps_hints_t1stem3: invalid dimension (%u) used\n", dimension )); dimension = ( dimension != 0 ); } @@ -976,7 +976,7 @@ if ( bit_count != count1 + count2 ) { FT_TRACE0(( "ps_hints_t2mask:" - " called with invalid bitcount %d (instead of %d)\n", + " called with invalid bitcount %u (instead of %u)\n", bit_count, count1 + count2 )); /* simply ignore the operator */ @@ -1022,7 +1022,7 @@ if ( bit_count != count1 + count2 ) { FT_TRACE0(( "ps_hints_t2counter:" - " called with invalid bitcount %d (instead of %d)\n", + " called with invalid bitcount %u (instead of %u)\n", bit_count, count1 + count2 )); /* simply ignore the operator */ diff --git a/modules/freetype2/src/pshinter/pshrec.h b/modules/freetype2/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ * * Postscript (Type1/Type2) hints recorder (specification). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/pshinter/rules.mk b/modules/freetype2/src/pshinter/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2001-2024 by +# Copyright (C) 2001-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/psnames/module.mk b/modules/freetype2/src/psnames/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/psnames/psmodule.c b/modules/freetype2/src/psnames/psmodule.c @@ -4,7 +4,7 @@ * * psnames module implementation (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psnames/psmodule.h b/modules/freetype2/src/psnames/psmodule.h @@ -4,7 +4,7 @@ * * High-level psnames module interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psnames/psnamerr.h b/modules/freetype2/src/psnames/psnamerr.h @@ -4,7 +4,7 @@ * * PS names module error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psnames/psnames.c b/modules/freetype2/src/psnames/psnames.c @@ -4,7 +4,7 @@ * * FreeType psnames module component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psnames/pstables.h b/modules/freetype2/src/psnames/pstables.h @@ -4,7 +4,7 @@ * * PostScript glyph names. * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/psnames/rules.mk b/modules/freetype2/src/psnames/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/raster/ftmisc.h b/modules/freetype2/src/raster/ftmisc.h @@ -5,7 +5,7 @@ * Miscellaneous macros for stand-alone rasterizer (specification * only). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/modules/freetype2/src/raster/ftraster.c b/modules/freetype2/src/raster/ftraster.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -251,7 +251,11 @@ /* 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_No_Round FT_MulDiv_No_Round +#ifdef FT_INT64 +#define SMulDiv( a, b, c ) (Long)( (FT_Int64)(a) * (b) / (c) ) +#else +#define SMulDiv FT_MulDiv_No_Round +#endif /* The rasterizer is a very general purpose component; please leave */ /* the following redefinitions there (you never know your target */ @@ -653,7 +657,7 @@ ras.cProfile->height = 0; } - ras.cProfile->flags = ras.dropOutControl; + ras.cProfile->flags = ras.dropOutControl; switch ( aState ) { @@ -967,14 +971,14 @@ goto Fin; } - Ix = SMulDiv_No_Round( e - y1, Dx, Dy ); + Ix = SMulDiv( e - y1, Dx, Dy ); x1 += Ix; *top++ = x1; if ( --size ) { Ax = Dx * ( e - y1 ) - Dy * Ix; /* remainder */ - Ix = FMulDiv( ras.precision, Dx, Dy ); + Ix = SMulDiv( ras.precision, Dx, Dy ); Rx = Dx * ras.precision - Dy * Ix; /* remainder */ Dx = 1; @@ -1090,8 +1094,8 @@ PLong top; - y1 = arc[degree].y; - y2 = arc[0].y; + y1 = arc[degree].y; + y2 = arc[0].y; if ( y2 < miny || y1 > maxy ) return SUCCESS; diff --git a/modules/freetype2/src/raster/ftraster.h b/modules/freetype2/src/raster/ftraster.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/modules/freetype2/src/raster/ftrend1.c b/modules/freetype2/src/raster/ftrend1.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/raster/ftrend1.h b/modules/freetype2/src/raster/ftrend1.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/raster/module.mk b/modules/freetype2/src/raster/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/raster/raster.c b/modules/freetype2/src/raster/raster.c @@ -4,7 +4,7 @@ * * FreeType monochrome rasterer module component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/raster/rasterrs.h b/modules/freetype2/src/raster/rasterrs.h @@ -4,7 +4,7 @@ * * monochrome renderer error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/raster/rules.mk b/modules/freetype2/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/sdf/ftbsdf.c b/modules/freetype2/src/sdf/ftbsdf.c @@ -4,7 +4,7 @@ * * Signed Distance Field support for bitmap fonts (body only). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. @@ -373,7 +373,7 @@ * @Input: * current :: * Array of Euclidean distances. `current` must point to the position - * for which the distance is to be caculated. We treat this array as + * for which the distance is to be calculated. We treat this array as * a two-dimensional array mapped to a one-dimensional array. * * x :: @@ -550,7 +550,7 @@ * * @Description: * Loops over all the pixels and call `compute_edge_distance` only for - * edge pixels. This maked the process a lot faster since + * edge pixels. This makes the process a lot faster since * `compute_edge_distance` uses functions such as `FT_Vector_NormLen', * which are quite slow. * @@ -848,11 +848,23 @@ FT_Int y_offset, FT_Int width ) { +#if USE_SQUARED_DISTANCES + FT_16D16 edge_threshold = ONE / 4; +#else + FT_16D16 edge_threshold = ONE / 2; +#endif ED* to_check; FT_16D16 dist; FT_16D16_Vec dist_vec; + /* + * Skip neighbor comparison if the distance is less than or equal to 0.5. + * When using squared distances, compare to 0.25 (= 0.5^2) instead. + */ + if ( current->dist <= edge_threshold ) + return; + to_check = current + ( y_offset * width ) + x_offset; /* diff --git a/modules/freetype2/src/sdf/ftsdf.c b/modules/freetype2/src/sdf/ftsdf.c @@ -4,7 +4,7 @@ * * Signed Distance Field support for outline fonts (body). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. @@ -1391,7 +1391,7 @@ SDF_Contour* contour = contour_list; - FT_TRACE5(( " Contour %d\n", num_contours )); + FT_TRACE5(( " Contour %u\n", num_contours )); edge_list = contour->edges; @@ -1400,7 +1400,7 @@ SDF_Edge* edge = edge_list; - FT_TRACE5(( " %3d: ", num_edges )); + FT_TRACE5(( " %3u: ", num_edges )); switch ( edge->edge_type ) { @@ -1443,11 +1443,11 @@ } FT_TRACE5(( "\n" )); - FT_TRACE5(( " total number of contours = %d\n", num_contours )); - FT_TRACE5(( " total number of edges = %d\n", total_edges )); - FT_TRACE5(( " |__lines = %d\n", total_lines )); - FT_TRACE5(( " |__conic = %d\n", total_conic )); - FT_TRACE5(( " |__cubic = %d\n", total_cubic )); + FT_TRACE5(( " total number of contours = %u\n", num_contours )); + FT_TRACE5(( " total number of edges = %u\n", total_edges )); + FT_TRACE5(( " |__lines = %u\n", total_lines )); + FT_TRACE5(( " |__conic = %u\n", total_conic )); + FT_TRACE5(( " |__cubic = %u\n", total_cubic )); } #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -3456,7 +3456,7 @@ * A complete shape which is used to generate SDF. * * spread :: - * Maximum distances to be allowed inthe output bitmap. + * Maximum distances to be allowed in the output bitmap. * * @Output: * bitmap :: diff --git a/modules/freetype2/src/sdf/ftsdf.h b/modules/freetype2/src/sdf/ftsdf.h @@ -4,7 +4,7 @@ * * Signed Distance Field support (specification). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. @@ -57,7 +57,7 @@ FT_BEGIN_HEADER * indicate positions inside of contours. * * flip_y :: - * Setting this parameter to true maked the output image flipped + * Setting this parameter to true makes the output image flipped * along the y-axis. * * overlaps :: diff --git a/modules/freetype2/src/sdf/ftsdfcommon.c b/modules/freetype2/src/sdf/ftsdfcommon.c @@ -4,7 +4,7 @@ * * Auxiliary data for Signed Distance Field support (body). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/modules/freetype2/src/sdf/ftsdfcommon.h b/modules/freetype2/src/sdf/ftsdfcommon.h @@ -4,7 +4,7 @@ * * Auxiliary data for Signed Distance Field support (specification). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/modules/freetype2/src/sdf/ftsdferrs.h b/modules/freetype2/src/sdf/ftsdferrs.h @@ -4,7 +4,7 @@ * * Signed Distance Field error codes (specification only). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/modules/freetype2/src/sdf/ftsdfrend.c b/modules/freetype2/src/sdf/ftsdfrend.c @@ -4,7 +4,7 @@ * * Signed Distance Field renderer interface (body). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/modules/freetype2/src/sdf/ftsdfrend.h b/modules/freetype2/src/sdf/ftsdfrend.h @@ -4,7 +4,7 @@ * * Signed Distance Field renderer interface (specification). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/modules/freetype2/src/sdf/module.mk b/modules/freetype2/src/sdf/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/sdf/rules.mk b/modules/freetype2/src/sdf/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2020-2024 by +# Copyright (C) 2020-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/sdf/sdf.c b/modules/freetype2/src/sdf/sdf.c @@ -4,7 +4,7 @@ * * FreeType Signed Distance Field renderer module component (body only). * - * Copyright (C) 2020-2024 by + * Copyright (C) 2020-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/modules/freetype2/src/sfnt/module.mk b/modules/freetype2/src/sfnt/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/sfnt/pngshim.c b/modules/freetype2/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * diff --git a/modules/freetype2/src/sfnt/pngshim.h b/modules/freetype2/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2024 by + * Copyright (C) 2013-2025 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * diff --git a/modules/freetype2/src/sfnt/rules.mk b/modules/freetype2/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/sfnt/sfdriver.c b/modules/freetype2/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -895,7 +895,7 @@ FT_TRACE0(( "sfnt_get_var_ps_name:" " Shortening variation PS name prefix\n" )); FT_TRACE0(( " " - " to %d characters\n", len )); + " to %u characters\n", len )); } face->var_postscript_prefix = result; diff --git a/modules/freetype2/src/sfnt/sfdriver.h b/modules/freetype2/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/sferrors.h b/modules/freetype2/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ * * SFNT error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/sfnt.c b/modules/freetype2/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ * * Single object library component. * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/sfobjs.c b/modules/freetype2/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ * * SFNT object management (base). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -579,6 +579,9 @@ if ( face_instance_index < 0 && face_index > 0 ) face_index--; + /* Note that `face_index` is also used to enumerate elements */ + /* of containers like a Mac Resource; this means we must */ + /* check whether we actually have a TTC. */ if ( face_index >= face->ttc_header.count ) { if ( face_instance_index >= 0 ) @@ -1127,9 +1130,9 @@ flags |= FT_FACE_FLAG_VERTICAL; /* kerning available ? */ - if ( TT_FACE_HAS_KERNING( face ) + if ( face->kern_avail_bits #ifdef TT_CONFIG_OPTION_GPOS_KERNING - || face->gpos_kerning_available + || face->num_gpos_lookups_kerning #endif ) flags |= FT_FACE_FLAG_KERNING; diff --git a/modules/freetype2/src/sfnt/sfobjs.h b/modules/freetype2/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ * * SFNT object management (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/sfwoff.c b/modules/freetype2/src/sfnt/sfwoff.c @@ -4,7 +4,7 @@ * * WOFF format management (base). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/sfwoff.h b/modules/freetype2/src/sfnt/sfwoff.h @@ -4,7 +4,7 @@ * * WOFFF format management (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/sfwoff2.c b/modules/freetype2/src/sfnt/sfwoff2.c @@ -4,7 +4,7 @@ * * WOFF2 format management (base). * - * Copyright (C) 2019-2024 by + * Copyright (C) 2019-2025 by * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -902,7 +902,7 @@ substreams[i].offset = pos + offset; substreams[i].size = substream_size; - FT_TRACE5(( " Substream %d: offset = %lu; size = %lu;\n", + FT_TRACE5(( " Substream %u: offset = %lu; size = %lu;\n", i, substreams[i].offset, substreams[i].size )); offset += substream_size; } @@ -1592,7 +1592,7 @@ WOFF2_TableRec table = *( indices[nn] ); - FT_TRACE3(( "Seeking to %ld with table size %ld.\n", + FT_TRACE3(( "Seeking to %lu with table size %lu.\n", table.src_offset, table.src_length )); FT_TRACE3(( "Table tag: %c%c%c%c.\n", (FT_Char)( table.Tag >> 24 ), @@ -1943,7 +1943,7 @@ src_offset += table->TransformLength; table->dst_offset = 0; - FT_TRACE2(( " %c%c%c%c %08d %08d %08ld %08ld %08ld\n", + FT_TRACE2(( " %c%c%c%c %08d %08d %08lu %08lu %08lu\n", (FT_Char)( table->Tag >> 24 ), (FT_Char)( table->Tag >> 16 ), (FT_Char)( table->Tag >> 8 ), diff --git a/modules/freetype2/src/sfnt/sfwoff2.h b/modules/freetype2/src/sfnt/sfwoff2.h @@ -4,7 +4,7 @@ * * WOFFF2 format management (specification). * - * Copyright (C) 2019-2024 by + * Copyright (C) 2019-2025 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/modules/freetype2/src/sfnt/ttbdf.c b/modules/freetype2/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (body). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttbdf.h b/modules/freetype2/src/sfnt/ttbdf.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (specification). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttcmap.c b/modules/freetype2/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -179,7 +179,7 @@ cmap_info->format = 0; - cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + cmap_info->language = TT_PEEK_USHORT( p ); return FT_Err_Ok; } @@ -596,7 +596,7 @@ cmap_info->format = 2; - cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + cmap_info->language = TT_PEEK_USHORT( p ); return FT_Err_Ok; } @@ -1539,7 +1539,7 @@ cmap_info->format = 4; - cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + cmap_info->language = TT_PEEK_USHORT( p ); return FT_Err_Ok; } @@ -1712,7 +1712,7 @@ cmap_info->format = 6; - cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + cmap_info->language = TT_PEEK_USHORT( p ); return FT_Err_Ok; } @@ -2009,7 +2009,7 @@ cmap_info->format = 8; - cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); + cmap_info->language = TT_PEEK_ULONG( p ); return FT_Err_Ok; } @@ -2184,7 +2184,7 @@ cmap_info->format = 10; - cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); + cmap_info->language = TT_PEEK_ULONG( p ); return FT_Err_Ok; } @@ -2528,7 +2528,7 @@ cmap_info->format = 12; - cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); + cmap_info->language = TT_PEEK_ULONG( p ); return FT_Err_Ok; } @@ -2844,7 +2844,7 @@ cmap_info->format = 13; - cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); + cmap_info->language = TT_PEEK_ULONG( p ); return FT_Err_Ok; } @@ -3792,7 +3792,7 @@ return FT_THROW( Invalid_Table ); /* Version 1.8.3 of the OpenType specification contains the following */ - /* (https://docs.microsoft.com/en-us/typography/opentype/spec/cmap): */ + /* (https://learn.microsoft.com/typography/opentype/spec/cmap): */ /* */ /* The 'cmap' table version number remains at 0x0000 for fonts that */ /* make use of the newer subtable formats. */ @@ -3803,7 +3803,7 @@ p += 2; num_cmaps = TT_NEXT_USHORT( p ); - FT_TRACE4(( "tt_face_build_cmaps: %d cmaps\n", num_cmaps )); + FT_TRACE4(( "tt_face_build_cmaps: %u cmaps\n", num_cmaps )); limit = table + face->cmap_size; for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- ) diff --git a/modules/freetype2/src/sfnt/ttcmap.h b/modules/freetype2/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttcmapc.h b/modules/freetype2/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ * * TT CMAP classes definitions (specification only). * - * Copyright (C) 2009-2024 by + * Copyright (C) 2009-2025 by * Oran Agra and Mickey Gabel. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttcolr.c b/modules/freetype2/src/sfnt/ttcolr.c @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (body). * - * Copyright (C) 2018-2024 by + * Copyright (C) 2018-2025 by * David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. @@ -51,7 +51,7 @@ #define COLOR_STOP_SIZE 6U #define VAR_IDX_BASE_SIZE 4U #define LAYER_SIZE 4U -/* https://docs.microsoft.com/en-us/typography/opentype/spec/colr#colr-header */ +/* https://learn.microsoft.com/typography/opentype/spec/colr#colr-header */ /* 3 * uint16 + 2 * Offset32 */ #define COLRV0_HEADER_SIZE 14U /* COLRV0_HEADER_SIZE + 5 * Offset32 */ diff --git a/modules/freetype2/src/sfnt/ttcolr.h b/modules/freetype2/src/sfnt/ttcolr.h @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (specification). * - * Copyright (C) 2018-2024 by + * Copyright (C) 2018-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/modules/freetype2/src/sfnt/ttcpal.c b/modules/freetype2/src/sfnt/ttcpal.c @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (body). * - * Copyright (C) 2018-2024 by + * Copyright (C) 2018-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/modules/freetype2/src/sfnt/ttcpal.h b/modules/freetype2/src/sfnt/ttcpal.h @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (specification). * - * Copyright (C) 2018-2024 by + * Copyright (C) 2018-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/modules/freetype2/src/sfnt/ttgpos.c b/modules/freetype2/src/sfnt/ttgpos.c @@ -2,36 +2,33 @@ * * 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. + * Routines to parse and access the 'GPOS' table for simple kerning (body). * - * 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 + * Copyright (C) 2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, * modified, and distributed under the terms of the FreeType project * license, LICENSE.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/freetype.h> +#include <freetype/tttables.h> +#include <freetype/tttags.h> + #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 @@ -42,292 +39,542 @@ #define FT_COMPONENT ttgpos - typedef enum coverage_table_format_type_ + /*********************************/ + /******** ********/ + /******** GPOS validation ********/ + /******** ********/ + /*********************************/ + + static FT_Bool + tt_face_validate_coverage( FT_Byte* table, + FT_Byte* table_limit, + FT_UInt max_num_coverage_indices ) { - COVERAGE_TABLE_FORMAT_LIST = 1, - COVERAGE_TABLE_FORMAT_RANGE = 2 + FT_UInt format; - } coverage_table_format_type; + FT_Byte* p = table; + FT_Byte* limit; - typedef enum class_def_table_format_type_ - { - CLASS_DEF_TABLE_FORMAT_ARRAY = 1, - CLASS_DEF_TABLE_FORMAT_RANGE_GROUPS = 2 + FT_Long last_id = -1; - } 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 + if ( table_limit < p + 4 ) + return FALSE; - } gpos_pair_adjustment_format; + format = FT_NEXT_USHORT( p ); + if ( format == 1 ) + { + FT_UInt glyphCount = FT_NEXT_USHORT( p ); - 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; + if ( glyphCount > max_num_coverage_indices ) + return FALSE; + limit = p + glyphCount * 2; + if ( table_limit < limit ) + return FALSE; - 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; + while ( p < limit ) + { + FT_UInt id = FT_NEXT_USHORT( p ); - /* Element for the current iteration. */ - FT_Byte* subtable; - gpos_lookup_type subtable_type; - } TT_GPOS_Subtable_Iterator_Context; + if ( last_id >= id ) + return FALSE; + last_id = id; + } + } + else if ( format == 2 ) + { + FT_UInt rangeCount = FT_NEXT_USHORT( p ); + + limit = p + rangeCount * 6; + if ( table_limit < limit ) + return FALSE; - /* 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 ) + while ( p < limit ) + { + FT_UInt startGlyphID = FT_NEXT_USHORT( p ); + FT_UInt endGlyphID = FT_NEXT_USHORT( p ); + FT_UInt startCoverageIndex = FT_NEXT_USHORT( p ); + + + if ( startGlyphID > endGlyphID ) + return FALSE; + + if ( last_id >= startGlyphID ) + return FALSE; + last_id = endGlyphID; + + /* XXX: Is this modulo 65536 arithmetic? */ + if ( startCoverageIndex + endGlyphID - startGlyphID >= + max_num_coverage_indices ) + return FALSE; + } + } + else + return FALSE; + + return TRUE; + } + + + static FT_Bool + tt_face_validate_class_def( FT_Byte* table, + FT_Byte* table_limit, + FT_UInt num_classes ) { - FT_Byte* lookup_list = gpos_table + FT_PEEK_USHORT( gpos_table + 8 ); - FT_UInt16 lookup_count = FT_PEEK_USHORT( lookup_list ); + FT_UInt format; + FT_Byte* p = table; + FT_Byte* limit; - if ( lookup_list_idx < lookup_count ) + FT_UInt max_class_value = 0; + + + if ( table_limit < p + 2 ) + return FALSE; + + format = FT_NEXT_USHORT( p ); + if ( format == 1 ) { - 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; + FT_UInt glyphCount; + + + if ( table_limit < p + 4 ) + return FALSE; + + p += 2; /* Skip `startGlyphID`. */ + + glyphCount = FT_NEXT_USHORT( p ); + limit = p + glyphCount * 2; + if ( table_limit < limit ) + return FALSE; + + while ( p < limit ) + { + FT_UInt class_value = FT_NEXT_USHORT( p ); + + + if ( class_value > max_class_value ) + max_class_value = class_value; + } } - else + else if ( format == 2 ) { - context->current_lookup_table = NULL; - context->current_lookup_type = GPOS_LOOKUP_TYPE_NONE; - context->subtable_count = 0; - context->subtable_offsets = NULL; + FT_UInt classRangeCount; + FT_Long last_id = -1; + + + if ( table_limit < p + 2 ) + return FALSE; + + classRangeCount = FT_NEXT_USHORT( p ); + limit = p + classRangeCount * 6; + if ( table_limit < limit ) + return FALSE; + + while ( p < limit ) + { + FT_UInt startGlyphID = FT_NEXT_USHORT( p ); + FT_UInt endGlyphID = FT_NEXT_USHORT( p ); + FT_UInt class_value = FT_NEXT_USHORT( p ); + + + if ( startGlyphID > endGlyphID ) + return FALSE; + + if ( last_id >= startGlyphID ) + return FALSE; + last_id = endGlyphID; + + if ( class_value > max_class_value ) + max_class_value = class_value; + } } + else + return FALSE; - context->subtable_idx = 0; - context->subtable = NULL; - context->subtable_type = GPOS_LOOKUP_TYPE_NONE; + if ( max_class_value + 1 != num_classes ) + return FALSE; + + return TRUE; } - /* 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 ) + tt_face_validate_feature( FT_Byte* table, + FT_Byte* table_limit, + FT_UInt use_lookup_table_size, + FT_Byte* use_lookup_table ) { - if ( context->subtable_idx < context->subtable_count ) + FT_UInt lookupIndexCount; + + FT_Byte* p = table; + FT_Byte* limit; + + + if ( table_limit < p + 4 ) + return FALSE; + + p += 2; /* Skip `featureParamsOffset`. */ + + lookupIndexCount = FT_NEXT_USHORT( p ); + limit = p + lookupIndexCount * 2; + if ( table_limit < limit ) + return FALSE; + + while ( p < limit ) { - FT_UShort subtable_offset = - FT_PEEK_USHORT( context->subtable_offsets + - 2 * context->subtable_idx ); + FT_UInt lookup_index = FT_NEXT_USHORT( p ); + + + if ( lookup_index >= use_lookup_table_size ) + return FALSE; + + use_lookup_table[lookup_index] = TRUE; + } + + return TRUE; + } + + + static FT_Bool + tt_face_validate_feature_table( FT_Byte* table, + FT_Byte* table_limit, + FT_UInt use_lookup_table_size, + FT_Byte* use_lookup_table ) + { + FT_UInt featureCount; + + FT_Byte* p = table; + FT_Byte* limit; + + if ( table_limit < p + 2 ) + return FALSE; - context->subtable = context->current_lookup_table + subtable_offset; + featureCount = FT_NEXT_USHORT( p ); + limit = p + featureCount * 6; + if ( table_limit < limit ) + return FALSE; - if ( context->current_lookup_type == - GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING ) + /* We completely ignore GPOS script information */ + /* and collect lookup tables of all 'kern' features. */ + while ( p < limit ) + { + FT_ULong featureTag = FT_NEXT_ULONG( p ); + FT_UInt featureOffset = FT_NEXT_USHORT( p ); + + + if ( featureTag == TTAG_kern ) { - /* 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 ); + if ( !tt_face_validate_feature( table + featureOffset, + table_limit, + use_lookup_table_size, + use_lookup_table ) ) + return FALSE; } - else - context->subtable_type = context->current_lookup_type; - - context->subtable_idx++; - return TRUE; } - return FALSE; + return TRUE; } - static FT_Int - tt_gpos_get_coverage_index( FT_Byte *coverage_table, - FT_UInt glyph ) + static FT_Bool + tt_face_validate_pair_set( FT_Byte* table, + FT_Byte* table_limit ) { - coverage_table_format_type coverage_format = - (coverage_table_format_type)FT_PEEK_USHORT( coverage_table ); + FT_UInt pairValueCount; + + FT_Byte* p = table; + FT_Byte* limit; + FT_Long last_id = -1; - switch ( coverage_format ) + + if ( table_limit < p + 2 ) + return FALSE; + + /* For our purposes, the first value record only contains X advances */ + /* while the second one is empty; a `PairValue` record has thus a */ + /* size of four bytes. */ + pairValueCount = FT_NEXT_USHORT( p ); + limit = p + pairValueCount * 4; + if ( table_limit < limit ) + return FALSE; + + /* We validate the order of `secondGlyph` so that binary search works. */ + while ( p < limit ) { - case COVERAGE_TABLE_FORMAT_LIST: - { - FT_UShort glyph_count = FT_PEEK_USHORT( coverage_table + 2 ); + FT_UInt id = FT_NEXT_USHORT( p ); - FT_Int l = 0; - FT_Int r = glyph_count - 1; - FT_Int m; - FT_Int straw; - FT_Int needle = (FT_Int)glyph; + if ( last_id >= id ) + return FALSE; + last_id = id; - /* Binary search. */ - while ( l <= r ) - { - FT_Byte *glyph_array = coverage_table + 4; - FT_UShort glyph_id; + p += 2; /* Skip `valueRecord1`. */ + } + return TRUE; + } - 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; - } + static FT_Bool + tt_face_validate_pair_pos1( FT_Byte* table, + FT_Byte* table_limit, + FT_Bool* is_fitting ) + { + FT_Byte* coverage; + FT_UInt valueFormat1; + FT_UInt valueFormat2; + + /* Subtable format is already checked. */ + FT_Byte* p = table + 2; + FT_Byte* limit; + + + /* The six bytes for the coverage table offset */ + /* and the value formats are already checked. */ + coverage = table + FT_NEXT_USHORT( p ); + + /* For the limited purpose of accessing the simplest type of kerning */ + /* (similar to what FreeType's 'kern' table handling provides) we */ + /* only consider tables that contains X advance values for the first */ + /* glyph and no data for the second glyph. */ + valueFormat1 = FT_NEXT_USHORT( p ); + valueFormat2 = FT_NEXT_USHORT( p ); + if ( valueFormat1 == 0x4 && valueFormat2 == 0 ) + { + FT_UInt pairSetCount; + + + if ( table_limit < p + 2 ) + return FALSE; + + pairSetCount = FT_NEXT_USHORT( p ); + limit = p + pairSetCount * 2; + if ( table_limit < limit ) + return FALSE; + + if ( !tt_face_validate_coverage( coverage, + table_limit, + pairSetCount ) ) + return FALSE; - case COVERAGE_TABLE_FORMAT_RANGE: + while ( p < limit ) { - FT_UShort range_count = FT_PEEK_USHORT( coverage_table + 2 ); - FT_Byte *range_array = coverage_table + 4; + FT_Byte* pair_set = table + FT_NEXT_USHORT( p ); - 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; + if ( !tt_face_validate_pair_set( pair_set, table_limit ) ) + return FALSE; + } + *is_fitting = TRUE; + } - /* Binary search. */ - while ( l <= r ) - { - FT_Byte *range_record; + return TRUE; + } - 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 ); + static FT_Bool + tt_face_validate_pair_pos2( FT_Byte* table, + FT_Byte* table_limit, + FT_Bool* is_fitting ) + { + FT_Byte* coverage; + FT_UInt valueFormat1; + FT_UInt valueFormat2; - 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 ); + /* Subtable format is already checked. */ + FT_Byte* p = table + 2; + FT_Byte* limit; - return (FT_Int)start_coverage_index + (FT_Int)glyph - straw_start; - } - } - break; - } + /* The six bytes for the coverage table offset */ + /* and the value formats are already checked. */ + coverage = table + FT_NEXT_USHORT( p ); + + valueFormat1 = FT_NEXT_USHORT( p ); + valueFormat2 = FT_NEXT_USHORT( p ); + if ( valueFormat1 == 0x4 && valueFormat2 == 0 ) + { + FT_Byte* class_def1; + FT_Byte* class_def2; + FT_UInt class1Count; + FT_UInt class2Count; + + + /* The number of coverage indices is not relevant here. */ + if ( !tt_face_validate_coverage( coverage, table_limit, FT_UINT_MAX ) ) + return FALSE; + + if ( table_limit < p + 8 ) + return FALSE; + + class_def1 = table + FT_NEXT_USHORT( p ); + class_def2 = table + FT_NEXT_USHORT( p ); + class1Count = FT_NEXT_USHORT( p ); + class2Count = FT_NEXT_USHORT( p ); + + if ( !tt_face_validate_class_def( class_def1, + table_limit, + class1Count ) ) + return FALSE; + if ( !tt_face_validate_class_def( class_def2, + table_limit, + class2Count ) ) + return FALSE; + + /* For our purposes, the first value record only contains */ + /* X advances while the second one is empty. */ + limit = p + class1Count * class2Count * 2; + if ( table_limit < limit ) + return FALSE; + + *is_fitting = TRUE; } - return -1; + return TRUE; } - static FT_Int - tt_gpos_get_glyph_class( FT_Byte *class_def_table, - FT_UInt glyph ) + /* The return value is the number of fitting subtables. */ + static FT_UInt + tt_face_validate_lookup_table( FT_Byte* table, + FT_Byte* table_limit ) { - class_def_table_format_type class_def_format = - (class_def_table_format_type)FT_PEEK_USHORT( class_def_table ); + FT_UInt lookupType; + FT_UInt real_lookupType = 0; + FT_UInt subtableCount; + + FT_Byte* p = table; + FT_Byte* limit; + + FT_UInt num_fitting_subtables = 0; + + + if ( table_limit < p + 6 ) + return 0; + lookupType = FT_NEXT_USHORT( p ); - switch ( class_def_format ) + p += 2; /* Skip `lookupFlag`. */ + + subtableCount = FT_NEXT_USHORT( p ); + limit = p + subtableCount * 2; + if ( table_limit < limit ) + return 0; + + while ( p < limit ) { - 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; + FT_Byte* subtable = table + FT_NEXT_USHORT( p ); + FT_UInt format; + FT_Bool is_fitting = FALSE; - 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: + if ( lookupType == 9 ) { - FT_UShort class_range_count = FT_PEEK_USHORT( class_def_table + 2 ); - FT_Byte *class_range_records = class_def_table + 4; + /* Positioning extension. */ + FT_Byte* q = subtable; - 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; + if ( table_limit < q + 8 ) + return 0; + if ( FT_NEXT_USHORT( q ) != 1 ) /* format */ + return 0; - while ( l <= r ) - { - FT_Byte *class_range_record; + if ( real_lookupType == 0 ) + real_lookupType = FT_NEXT_USHORT( q ); + else if ( real_lookupType != FT_NEXT_USHORT( q ) ) + return 0; + + subtable += FT_PEEK_ULONG( q ); + } + else + real_lookupType = lookupType; + /* Ensure the first eight bytes of the subtable formats. */ + if ( table_limit < subtable + 8 ) + return 0; - 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 ); + format = FT_PEEK_USHORT( subtable ); - 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 ); + if ( real_lookupType == 2 ) + { + if ( format == 1 ) + { + if ( !tt_face_validate_pair_pos1( subtable, + table_limit, + &is_fitting ) ) + return 0; } - break; + else if ( format == 2 ) + { + if ( !tt_face_validate_pair_pos2( subtable, + table_limit, + &is_fitting ) ) + return 0; + } + else + return 0; } + else + return 0; + + if ( is_fitting ) + num_fitting_subtables++; } - /* "All glyphs not assigned to a class fall into class 0." */ - /* (OpenType spec) */ - return 0; + return num_fitting_subtables; + } + + + static void + tt_face_get_subtable_offsets( FT_Byte* table, + FT_Byte* gpos, + FT_UInt32* gpos_lookups_kerning, + FT_UInt* idx ) + { + FT_UInt lookupType; + FT_UInt subtableCount; + + FT_Byte* p = table; + FT_Byte* limit; + + + lookupType = FT_NEXT_USHORT( p ); + + p += 2; + + subtableCount = FT_NEXT_USHORT( p ); + limit = p + subtableCount * 2; + while ( p < limit ) + { + FT_Byte* subtable = table + FT_NEXT_USHORT( p ); + FT_UInt valueFormat1; + FT_UInt valueFormat2; + + + if ( lookupType == 9 ) + subtable += FT_PEEK_ULONG( subtable + 4 ); + + /* Table offsets for `valueFormat[12]` values */ + /* are identical for both subtable formats. */ + valueFormat1 = FT_PEEK_USHORT( subtable + 4 ); + valueFormat2 = FT_PEEK_USHORT( subtable + 6 ); + if ( valueFormat1 == 0x4 && valueFormat2 == 0 ) + { + /* We store offsets relative to the start of the GPOS table. */ + gpos_lookups_kerning[(*idx)++] = (FT_UInt32)( subtable - gpos ); + } + } } @@ -335,57 +582,142 @@ tt_face_load_gpos( TT_Face face, FT_Stream stream ) { - FT_Error error; - FT_ULong table_size; + FT_Error error; + FT_Memory memory = face->root.memory; + + FT_ULong gpos_length; + FT_Byte* gpos; + FT_Byte* gpos_limit; + + FT_UInt32* gpos_lookups_kerning; + + FT_UInt featureListOffset; + + FT_UInt lookupListOffset; + FT_Byte* lookup_list; + FT_UInt lookupCount; + + FT_UInt i; + + FT_Byte* use_lookup_table = NULL; + FT_UInt num_fitting_subtables; + FT_Byte* p; + FT_Byte* limit; - /* The GPOS table is optional; exit silently if it is missing. */ - error = face->goto_table( face, TTAG_GPOS, stream, &table_size ); + + face->gpos_table = NULL; + face->gpos_lookups_kerning = NULL; + face->num_gpos_lookups_kerning = 0; + + gpos = NULL; + gpos_lookups_kerning = NULL; + + error = face->goto_table( face, TTAG_GPOS, stream, &gpos_length ); if ( error ) - goto Exit; + goto Fail; - 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( gpos_length, gpos ) ) + goto Fail; - if ( FT_FRAME_EXTRACT( table_size, face->gpos_table ) ) - { - FT_ERROR(( "tt_face_load_gpos:" - " could not extract GPOS table\n" )); - goto Exit; - } + if ( gpos_length < 10 ) + goto Fail; + + gpos_limit = gpos + gpos_length; - face->gpos_kerning_available = FALSE; + /* We first need the number of GPOS lookups. */ + lookupListOffset = FT_PEEK_USHORT( gpos + 8 ); - if ( face->gpos_table ) + lookup_list = gpos + lookupListOffset; + p = lookup_list; + if ( gpos_limit < p + 2 ) + goto Fail; + + lookupCount = FT_NEXT_USHORT( p ); + limit = p + lookupCount * 2; + if ( gpos_limit < limit ) + goto Fail; + + /* Allocate an auxiliary array for Boolean values that */ + /* gets filled while walking over all 'kern' features. */ + if ( FT_NEW_ARRAY( use_lookup_table, lookupCount ) ) + goto Fail; + + featureListOffset = FT_PEEK_USHORT( gpos + 6 ); + + if ( !tt_face_validate_feature_table( gpos + featureListOffset, + gpos_limit, + lookupCount, + use_lookup_table ) ) + goto Fail; + + /* Now walk over all lookup tables and get the */ + /* number of fitting subtables. */ + num_fitting_subtables = 0; + for ( i = 0; i < lookupCount; i++ ) { - 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 lookupOffset; + + + if ( !use_lookup_table[i] ) + continue; + lookupOffset = FT_PEEK_USHORT( p + i * 2 ); + + num_fitting_subtables += + tt_face_validate_lookup_table( lookup_list + lookupOffset, + gpos_limit ); + + } + + /* Loop again over all lookup tables and */ + /* collect offsets to those subtables. */ + if ( num_fitting_subtables ) + { FT_UInt idx; - for ( idx = 0; idx < feature_count; idx++, feature_records += 6 ) + if ( FT_QNEW_ARRAY( gpos_lookups_kerning, num_fitting_subtables ) ) + goto Fail; + + idx = 0; + for ( i = 0; i < lookupCount; i++ ) { - FT_ULong feature_tag = FT_PEEK_ULONG( feature_records ); + FT_UInt lookupOffset; - if ( feature_tag == TTAG_kern ) - { - face->gpos_kerning_available = TRUE; - break; - } + if ( !use_lookup_table[i] ) + continue; + + lookupOffset = FT_PEEK_USHORT( p + i * 2 ); + + tt_face_get_subtable_offsets( lookup_list + lookupOffset, + gpos, + gpos_lookups_kerning, + &idx ); } } + FT_FREE( use_lookup_table ); + use_lookup_table = NULL; + + face->gpos_table = gpos; + face->gpos_lookups_kerning = gpos_lookups_kerning; + face->num_gpos_lookups_kerning = num_fitting_subtables; + Exit: return error; + + Fail: + FT_FREE( gpos ); + FT_FREE( gpos_lookups_kerning ); + FT_FREE( use_lookup_table ); + + /* If we don't have an explicit error code, set it to a generic value. */ + if ( !error ) + error = FT_THROW( Invalid_Table ); + + goto Exit; } @@ -393,198 +725,250 @@ tt_face_done_gpos( TT_Face face ) { FT_Stream stream = face->root.stream; + FT_Memory memory = face->root.memory; FT_FRAME_RELEASE( face->gpos_table ); + FT_FREE( face->gpos_lookups_kerning ); } - FT_LOCAL_DEF( FT_Int ) - tt_face_get_gpos_kerning( TT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph ) + /*********************************/ + /******** ********/ + /******** GPOS access ********/ + /******** ********/ + /*********************************/ + + + static FT_Long + tt_face_get_coverage_index( FT_Byte* table, + FT_UInt glyph_index ) { - FT_Byte* feature_list; - FT_UInt16 feature_count; - FT_Byte* feature_records; - FT_UInt feature_idx; + FT_Byte* p = table; + FT_UInt format = FT_NEXT_USHORT( p ); + FT_UInt count = FT_NEXT_USHORT( p ); + FT_UInt min, max; - 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; + min = 0; + max = count; - for ( feature_idx = 0; - feature_idx < feature_count; - feature_idx++, feature_records += 6 ) + if ( format == 1 ) { - FT_ULong feature_tag = FT_PEEK_ULONG( feature_records ); - FT_Byte* feature_table; - FT_UInt16 lookup_idx_count; - FT_UInt16 lookup_idx; + while ( min < max ) + { + FT_UInt mid = min + ( max - min ) / 2; + FT_UInt mid_index = FT_PEEK_USHORT( p + mid * 2 ); - if ( feature_tag != TTAG_kern ) - continue; + if ( glyph_index > mid_index ) + min = mid + 1; + else if ( glyph_index < mid_index ) + max = mid; + else + return mid; + } + } + else + { + while ( min < max ) + { + FT_UInt mid = min + ( max - min ) / 2; + FT_UInt startGlyphID = FT_PEEK_USHORT( p + mid * 6 ); + FT_UInt endGlyphID = FT_PEEK_USHORT( p + mid * 6 + 2 ); - 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; + if ( glyph_index > endGlyphID ) + min = mid + 1; + else if ( glyph_index < startGlyphID ) + max = mid; + else + { + FT_UInt startCoverageIndex = FT_PEEK_USHORT( p + mid * 6 + 4 ); - tt_gpos_subtable_iterator_init( &subtable_iter, - face->gpos_table, - lookup_list_idx ); + return startCoverageIndex + glyph_index - startGlyphID; + } + } + } - while ( tt_gpos_subtable_iterator_next( &subtable_iter ) ) - { - FT_Byte* subtable; + return -1; + } - 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; + static FT_UInt + tt_face_get_class( FT_Byte* table, + FT_UInt glyph_index ) + { + FT_Byte* p = table; + FT_UInt format = FT_NEXT_USHORT( p ); - if ( subtable_iter.subtable_type != - GPOS_LOOKUP_TYPE_PAIR_ADJUSTMENT ) - continue; + if ( format == 1 ) + { + FT_UInt startGlyphID = FT_NEXT_USHORT( p ); + FT_UInt glyphCount = FT_NEXT_USHORT( p ); - 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 ); + /* XXX: Is this modulo 65536 arithmetic? */ + if ( startGlyphID <= glyph_index && + startGlyphID + glyphCount >= glyph_index ) + return FT_PEEK_USHORT( p + ( glyph_index - startGlyphID ) * 2 ); + } + else + { + FT_UInt count = FT_NEXT_USHORT( p ); - if ( !( value_format_1 == GPOS_VALUE_FORMAT_X_ADVANCE && - value_format_2 == GPOS_VALUE_FORMAT_NONE ) ) - continue; + FT_UInt min, max; - 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 ); + min = 0; + max = count; - if ( coverage_index == -1 ) - continue; + while ( min < max ) + { + FT_UInt mid = min + ( max - min ) / 2; + FT_UInt startGlyphID = FT_PEEK_USHORT( p + mid * 6 ); + FT_UInt endGlyphID = FT_PEEK_USHORT( p + mid * 6 + 2 ); - 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; + if ( glyph_index > endGlyphID ) + min = mid + 1; + else if ( glyph_index < startGlyphID ) + max = mid; + else + return FT_PEEK_USHORT( p + mid * 6 + 4 ); + } + } - FT_UShort pair_set_count = FT_PEEK_USHORT( subtable + 8 ); - FT_UShort pair_pos_offset; + return 0; + } - FT_Byte* pair_value_table; - FT_UShort pair_value_count; - FT_Byte* pair_value_array; + + static FT_Bool + tt_face_get_pair_pos1_kerning( FT_Byte* table, + FT_UInt first_glyph, + FT_UInt second_glyph, + FT_Int* kerning ) + { + FT_Byte* coverage = table + FT_PEEK_USHORT( table + 2 ); + FT_Long coverage_index = tt_face_get_coverage_index( coverage, + first_glyph ); + + FT_UInt pair_set_offset; + FT_Byte* p; + FT_UInt count; + + FT_UInt min, max; - if ( coverage_index >= pair_set_count ) - return 0; + if ( coverage_index < 0 ) + return FALSE; - pair_pos_offset = - FT_PEEK_USHORT( subtable + 10 + 2 * coverage_index ); + pair_set_offset = FT_PEEK_USHORT( table + 10 + coverage_index * 2 ); + p = table + pair_set_offset; + count = FT_NEXT_USHORT( p ); - pair_value_table = subtable + pair_pos_offset; - pair_value_count = FT_PEEK_USHORT( pair_value_table ); - pair_value_array = pair_value_table + 2; + min = 0; + max = count; - needle = (FT_Int)right_glyph; - r = pair_value_count - 1; - l = 0; + while ( min < max ) + { + FT_UInt mid = min + ( max - min ) / 2; + FT_UInt mid_index = FT_PEEK_USHORT( p + mid * 4 ); - /* Binary search. */ - while ( l <= r ) - { - FT_UShort second_glyph; - FT_Byte* pair_value; + if ( second_glyph > mid_index ) + min = max + 1; + else if ( second_glyph < mid_index ) + max = mid; + else + { + *kerning = FT_PEEK_SHORT( p + mid * 4 + 2 ); - 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; + return TRUE; + } + } - 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 FALSE; + } - return x_advance; - } - } - break; - } + static FT_Bool + tt_face_get_pair_pos2_kerning( FT_Byte* table, + FT_UInt first_glyph, + FT_UInt second_glyph, + FT_Int* kerning ) + { + FT_Byte* coverage = table + FT_PEEK_USHORT( table + 2 ); + FT_Long coverage_index = tt_face_get_coverage_index( coverage, + first_glyph ); - 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_Byte* class_def1; + FT_Byte* class_def2; + FT_UInt first_class; + FT_UInt second_class; + FT_UInt class2Count; - 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 ); + if ( coverage_index < 0 ) + return FALSE; - FT_Byte *class1_records, *class2_records; - FT_Short x_advance; + class_def1 = table + FT_PEEK_USHORT( table + 8 ); + class_def2 = table + FT_PEEK_USHORT( table + 10 ); + class2Count = FT_PEEK_USHORT( table + 14 ); - 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 */ + first_class = tt_face_get_class( class_def1, first_glyph ); + second_class = tt_face_get_class( class_def2, second_glyph ); - if ( right_glyph_class == 0 ) - continue; /* right glyph not found in this table */ + *kerning = + FT_PEEK_SHORT( table + 16 + + ( first_class * class2Count + second_class ) * 2 ); - class1_records = subtable + 16; - class2_records = - class1_records + 2 * ( left_glyph_class * class2_count ); + return TRUE; + } - x_advance = - FT_PEEK_SHORT( class2_records + 2 * right_glyph_class ); - return x_advance; - } - } - } + FT_LOCAL_DEF( FT_Int ) + tt_face_get_gpos_kerning( TT_Face face, + FT_UInt first_glyph, + FT_UInt second_glyph ) + { + FT_Int kerning = 0; + + FT_UInt i; + + + /* We only have `PairPos` subtables. */ + for ( i = 0; i < face->num_gpos_lookups_kerning; i++ ) + { + FT_Byte* subtable = face->gpos_table + face->gpos_lookups_kerning[i]; + FT_Byte* p = subtable; + + FT_UInt format = FT_NEXT_USHORT( p ); + + + if ( format == 1 ) + { + if ( tt_face_get_pair_pos1_kerning( subtable, + first_glyph, + second_glyph, + &kerning ) ) + break; + } + else + { + if ( tt_face_get_pair_pos2_kerning( subtable, + first_glyph, + second_glyph, + &kerning ) ) + break; } } - return 0; + return kerning; } #else /* !TT_CONFIG_OPTION_GPOS_KERNING */ diff --git a/modules/freetype2/src/sfnt/ttgpos.h b/modules/freetype2/src/sfnt/ttgpos.h @@ -1,12 +1,11 @@ /**************************************************************************** * - * ttgpos.c + * ttgpos.h * - * Load the TrueType GPOS table. The only GPOS layout feature this - * currently supports is kerning, from x advances in the pair adjustment - * layout feature. + * Routines to parse and access the 'GPOS' table for simple kerning + * (specification). * - * Copyright (C) 2024 by + * Copyright (C) 2024-2025 by * David Saltzman * * This file is part of the FreeType project, and may only be used, @@ -39,8 +38,8 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Int ) tt_face_get_gpos_kerning( TT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph ); + FT_UInt first_glyph, + FT_UInt second_glyph ); #endif /* TT_CONFIG_OPTION_GPOS_KERNING */ diff --git a/modules/freetype2/src/sfnt/ttkern.c b/modules/freetype2/src/sfnt/ttkern.c @@ -2,10 +2,9 @@ * * ttkern.c * - * Load the basic TrueType kerning table. This doesn't handle - * kerning data within the GPOS table at the moment. + * Routines to parse and access the 'kern' table for kerning (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttkern.h b/modules/freetype2/src/sfnt/ttkern.h @@ -2,10 +2,10 @@ * * ttkern.h * - * Load the basic TrueType kerning table. This doesn't handle - * kerning data within the GPOS table at the moment. + * Routines to parse and access the 'kern' table for kerning + * (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -40,8 +40,6 @@ FT_BEGIN_HEADER FT_UInt left_glyph, FT_UInt right_glyph ); -#define TT_FACE_HAS_KERNING( face ) ( (face)->kern_avail_bits != 0 ) - FT_END_HEADER diff --git a/modules/freetype2/src/sfnt/ttload.c b/modules/freetype2/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-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -535,7 +535,8 @@ * The tag of table to load. Use the value 0 if you want * to access the whole font file, else set this parameter * to a valid TrueType table tag that you can forge with - * the MAKE_TT_TAG macro. + * the MAKE_TT_TAG macro. Use value 1 to access the table + * directory. * * offset :: * The starting offset in the table (or the file if @@ -577,7 +578,29 @@ FT_ULong size; - if ( tag != 0 ) + if ( tag == 0 ) + { + /* The whole font file. */ + size = face->root.stream->size; + } + else if ( tag == 1 ) + { + /* The currently selected font's table directory. */ + /* */ + /* Note that `face_index` is also used to enumerate elements */ + /* of containers like a Mac Resource; this means we must */ + /* check whether we actually have a TTC (with multiple table */ + /* directories). */ + FT_Long idx = face->root.face_index & 0xFFFF; + + + if ( idx >= face->ttc_header.count ) + idx = 0; + + offset += face->ttc_header.offsets[idx]; + size = 4 + 8 + 16 * face->num_tables; + } + else { /* look for tag in font directory */ table = tt_face_lookup_table( face, tag ); @@ -590,9 +613,6 @@ offset += table->Offset; size = table->Length; } - else - /* tag == 0 -- the user wants to access the font file directly */ - size = face->root.stream->size; if ( length && *length == 0 ) { diff --git a/modules/freetype2/src/sfnt/ttload.h b/modules/freetype2/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-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttmtx.c b/modules/freetype2/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (body). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -306,7 +306,7 @@ } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( var && face->blend ) + if ( var && FT_IS_VARIATION( &face->root ) ) { FT_Face f = FT_FACE( face ); FT_Int a = (FT_Int)*aadvance; diff --git a/modules/freetype2/src/sfnt/ttmtx.h b/modules/freetype2/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (specification). * - * Copyright (C) 2006-2024 by + * Copyright (C) 2006-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttpost.c b/modules/freetype2/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttpost.h b/modules/freetype2/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttsbit.c b/modules/freetype2/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (body). * - * Copyright (C) 2005-2024 by + * Copyright (C) 2005-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Copyright 2013 by Google, Inc. @@ -342,7 +342,7 @@ FT_TRACE2(( "tt_face_load_strike_metrics:" " sanitizing invalid ascender and descender\n" )); FT_TRACE2(( " " - " values for strike %ld (%dppem, %dppem)\n", + " values for strike %lu (%dppem, %dppem)\n", strike_index, metrics->x_ppem, metrics->y_ppem )); @@ -993,7 +993,7 @@ goto Fail; } - FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d component%s\n", + FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %u component%s\n", num_components, num_components == 1 ? "" : "s" )); @@ -1419,7 +1419,7 @@ image_start = image_offset + image_start; FT_TRACE3(( "tt_sbit_decoder_load_image:" - " found sbit (format %d) for glyph index %d\n", + " found sbit (format %u) for glyph index %u\n", image_format, glyph_index )); return tt_sbit_decoder_load_bitmap( decoder, @@ -1438,13 +1438,13 @@ if ( recurse_count ) { FT_TRACE4(( "tt_sbit_decoder_load_image:" - " missing subglyph sbit with glyph index %d\n", + " missing subglyph sbit with glyph index %u\n", glyph_index )); return FT_THROW( Invalid_Composite ); } FT_TRACE4(( "tt_sbit_decoder_load_image:" - " no sbit found for glyph index %d\n", glyph_index )); + " no sbit found for glyph index %u\n", glyph_index )); return FT_THROW( Missing_Bitmap ); } @@ -1462,12 +1462,13 @@ FT_Int originOffsetX, originOffsetY; FT_Tag graphicType; FT_Int recurse_depth = 0; + FT_Bool flipped = FALSE; FT_Error error; FT_Byte* p; - FT_UNUSED( map ); #ifndef FT_CONFIG_OPTION_USE_PNG + FT_UNUSED( map ); FT_UNUSED( metrics_only ); #endif @@ -1517,12 +1518,16 @@ switch ( graphicType ) { + case FT_MAKE_TAG( 'f', 'l', 'i', 'p' ): + flipped = !flipped; + FALL_THROUGH; + case FT_MAKE_TAG( 'd', 'u', 'p', 'e' ): - if ( recurse_depth < 4 ) + if ( recurse_depth++ < 4 ) { glyph_index = FT_GET_USHORT(); FT_FRAME_EXIT(); - recurse_depth++; + goto retry; } error = FT_THROW( Invalid_File_Format ); @@ -1540,6 +1545,38 @@ glyph_end - glyph_start - 8, TRUE, metrics_only ); + if ( flipped && !metrics_only && !error ) + { + FT_UInt32* curr_pos = (FT_UInt32*)map->buffer; + + /* `Load_SBit_Png` always returns a pixmap with 32 bits per pixel */ + /* and no extra pitch bytes. */ + FT_UInt width = map->width; + FT_UInt y; + + + for ( y = 0; y < map->rows; y++ ) + { + FT_UInt32* left = curr_pos; + FT_UInt32* right = curr_pos + width - 1; + + + while ( left < right ) + { + FT_UInt32 value; + + + value = *right; + *right = *left; + *left = value; + + left++; + right--; + } + + curr_pos += width; + } + } #else error = FT_THROW( Unimplemented_Feature ); #endif diff --git a/modules/freetype2/src/sfnt/ttsbit.h b/modules/freetype2/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/sfnt/ttsvg.c b/modules/freetype2/src/sfnt/ttsvg.c @@ -4,7 +4,7 @@ * * OpenType SVG Color (specification). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 by * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,7 @@ * * 'SVG' table specification: * - * https://docs.microsoft.com/en-us/typography/opentype/spec/svg + * https://learn.microsoft.com/typography/opentype/spec/svg * */ @@ -46,6 +46,9 @@ SVG_DOCUMENT_LIST_MINIMUM_SIZE) + /* An arbitrary, heuristic size limit (67MByte) for expanded SVG data. */ +#define MAX_SVG_SIZE ( 1 << 26 ) + typedef struct Svg_ { FT_UShort version; /* table version (starting at 0) */ @@ -346,6 +349,13 @@ (FT_ULong)doc[doc_length - 3] << 8 | (FT_ULong)doc[doc_length - 4]; + if ( uncomp_size >= MAX_SVG_SIZE ) + { + FT_ERROR(( "Uncompressed SVG document too large.\n" )); + error = FT_THROW( Array_Too_Large ); + goto Exit; + } + if ( FT_QALLOC( uncomp_buffer, uncomp_size ) ) goto Exit; diff --git a/modules/freetype2/src/sfnt/ttsvg.h b/modules/freetype2/src/sfnt/ttsvg.h @@ -4,7 +4,7 @@ * * OpenType SVG Color (specification). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 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/modules/freetype2/src/sfnt/woff2tags.c b/modules/freetype2/src/sfnt/woff2tags.c @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (base). * - * Copyright (C) 2019-2024 by + * Copyright (C) 2019-2025 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/modules/freetype2/src/sfnt/woff2tags.h b/modules/freetype2/src/sfnt/woff2tags.h @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (specification). * - * Copyright (C) 2019-2024 by + * Copyright (C) 2019-2025 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/modules/freetype2/src/smooth/ftgrays.c b/modules/freetype2/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ * * A new `perfect' anti-aliasing renderer (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -157,10 +157,6 @@ #define ft_memset memset -#define ft_setjmp setjmp -#define ft_longjmp longjmp -#define ft_jmp_buf jmp_buf - typedef ptrdiff_t FT_PtrDist; @@ -170,8 +166,8 @@ typedef ptrdiff_t FT_PtrDist; #define Smooth_Err_Invalid_Argument -3 #define Smooth_Err_Raster_Overflow -4 -#define FT_BEGIN_HEADER -#define FT_END_HEADER +#define FT_BEGIN_HEADER /* nothing */ +#define FT_END_HEADER /* nothing */ #include "ftimage.h" #include "ftgrays.h" @@ -495,6 +491,7 @@ typedef ptrdiff_t FT_PtrDist; TCoord min_ey, max_ey; TCoord count_ey; /* same as (max_ey - min_ey) */ + int error; /* pool overflow exception */ PCell cell; /* current cell */ PCell cell_free; /* call allocation next free slot */ PCell cell_null; /* last cell, used as dumpster and limit */ @@ -510,8 +507,6 @@ 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 ) @@ -613,9 +608,14 @@ typedef ptrdiff_t FT_PtrDist; } /* insert new cell */ - cell = ras.cell_free++; - if ( cell >= ras.cell_null ) - ft_longjmp( ras.jump_buffer, 1 ); + cell = ras.cell_free; + if ( cell == ras.cell_null ) + { + ras.error = FT_THROW( Raster_Overflow ); + goto Found; + } + + ras.cell_free = cell + 1; cell->x = ex; cell->area = 0; @@ -1353,7 +1353,8 @@ typedef ptrdiff_t FT_PtrDist; ras.x = x; ras.y = y; - return 0; + + return ras.error; } @@ -1365,7 +1366,8 @@ typedef ptrdiff_t FT_PtrDist; gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) ); - return 0; + + return ras.error; } @@ -1378,7 +1380,8 @@ typedef ptrdiff_t FT_PtrDist; gray_render_conic( RAS_VAR_ control, to ); - return 0; + + return ras.error; } @@ -1392,7 +1395,8 @@ typedef ptrdiff_t FT_PtrDist; gray_render_cubic( RAS_VAR_ control1, control2, to ); - return 0; + + return ras.error; } @@ -1700,30 +1704,22 @@ typedef ptrdiff_t FT_PtrDist; gray_convert_glyph_inner( RAS_ARG_ int continued ) { - volatile int error; + int error; - if ( ft_setjmp( ras.jump_buffer ) == 0 ) - { - if ( continued ) - FT_Trace_Disable(); - error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); - if ( continued ) - FT_Trace_Enable(); - - FT_TRACE7(( "band [%d..%d]: %td cell%s remaining\n", - ras.min_ey, - ras.max_ey, - ras.cell_null - ras.cell_free, - ras.cell_null - ras.cell_free == 1 ? "" : "s" )); - } - else - { - error = FT_THROW( Raster_Overflow ); + if ( continued ) + FT_Trace_Disable(); + error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); + if ( continued ) + FT_Trace_Enable(); - FT_TRACE7(( "band [%d..%d]: to be bisected\n", - ras.min_ey, ras.max_ey )); - } + FT_TRACE7(( error == Smooth_Err_Raster_Overflow + ? "band [%d..%d]: to be bisected\n" + : "band [%d..%d]: %td cell%s remaining\n", + ras.min_ey, + ras.max_ey, + ras.cell_null - ras.cell_free, + ras.cell_null - ras.cell_free == 1 ? "" : "s" )); return error; } @@ -1873,6 +1869,7 @@ typedef ptrdiff_t FT_PtrDist; TCoord* band; int continued = 0; + int error = Smooth_Err_Ok; /* Initialize the null cell at the end of the poll. */ @@ -1907,7 +1904,6 @@ typedef ptrdiff_t FT_PtrDist; do { TCoord i; - int error; ras.min_ex = band[1]; @@ -1922,6 +1918,7 @@ typedef ptrdiff_t FT_PtrDist; ras.cell_free = buffer + n; ras.cell = ras.cell_null; + ras.error = Smooth_Err_Ok; error = gray_convert_glyph_inner( RAS_VAR_ continued ); continued = 1; @@ -1936,7 +1933,7 @@ typedef ptrdiff_t FT_PtrDist; continue; } else if ( error != Smooth_Err_Raster_Overflow ) - return error; + goto Exit; /* render pool overflow; we will reduce the render band by half */ i = ( band[0] - band[1] ) >> 1; @@ -1945,7 +1942,8 @@ typedef ptrdiff_t FT_PtrDist; if ( i == 0 ) { FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" )); - return FT_THROW( Raster_Overflow ); + error = FT_THROW( Raster_Overflow ); + goto Exit; } band++; @@ -1954,7 +1952,11 @@ typedef ptrdiff_t FT_PtrDist; } while ( band >= bands ); } - return Smooth_Err_Ok; + Exit: + ras.cell = ras.cell_free = ras.cell_null = NULL; + ras.ycells = NULL; + + return error; } diff --git a/modules/freetype2/src/smooth/ftgrays.h b/modules/freetype2/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ * * FreeType smooth renderer declaration * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,11 +19,6 @@ #ifndef FTGRAYS_H_ #define FTGRAYS_H_ -#ifdef __cplusplus - extern "C" { -#endif - - #ifdef STANDALONE_ #include "ftimage.h" #else @@ -31,6 +26,7 @@ #include <freetype/ftimage.h> #endif +FT_BEGIN_HEADER /************************************************************************** * @@ -46,10 +42,7 @@ FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_grays_raster; - -#ifdef __cplusplus - } -#endif +FT_END_HEADER #endif /* FTGRAYS_H_ */ diff --git a/modules/freetype2/src/smooth/ftsmerrs.h b/modules/freetype2/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ * * smooth renderer error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/smooth/ftsmooth.c b/modules/freetype2/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (body). * - * Copyright (C) 2000-2024 by + * Copyright (C) 2000-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/smooth/ftsmooth.h b/modules/freetype2/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/smooth/module.mk b/modules/freetype2/src/smooth/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/smooth/rules.mk b/modules/freetype2/src/smooth/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/smooth/smooth.c b/modules/freetype2/src/smooth/smooth.c @@ -4,7 +4,7 @@ * * FreeType anti-aliasing rasterer module component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/svg/ftsvg.c b/modules/freetype2/src/svg/ftsvg.c @@ -4,7 +4,7 @@ * * The FreeType SVG renderer interface (body). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 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/modules/freetype2/src/svg/ftsvg.h b/modules/freetype2/src/svg/ftsvg.h @@ -4,7 +4,7 @@ * * The FreeType SVG renderer interface (specification). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 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/modules/freetype2/src/svg/module.mk b/modules/freetype2/src/svg/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2022-2024 by +# Copyright (C) 2022-2025 by # David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/svg/rules.mk b/modules/freetype2/src/svg/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2022-2024 by +# Copyright (C) 2022-2025 by # David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/svg/svg.c b/modules/freetype2/src/svg/svg.c @@ -4,7 +4,7 @@ * * FreeType SVG renderer module component (body only). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 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/modules/freetype2/src/svg/svgtypes.h b/modules/freetype2/src/svg/svgtypes.h @@ -4,7 +4,7 @@ * * The FreeType SVG renderer internal types (specification). * - * Copyright (C) 2022-2024 by + * Copyright (C) 2022-2025 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/modules/freetype2/src/tools/afblue.pl b/modules/freetype2/src/tools/afblue.pl @@ -5,7 +5,7 @@ # # Process a blue zone character data file. # -# Copyright (C) 2013-2024 by +# Copyright (C) 2013-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/tools/apinames.c b/modules/freetype2/src/tools/apinames.c @@ -42,6 +42,7 @@ typedef enum OutputFormat_ } OutputFormat; +#define SUFFIX_VMS_64ADDR "64__" static void panic( const char* fmt, @@ -76,11 +77,12 @@ static int max_names; static void -names_add( const char* name, - const char* end ) +names_add( const char* name, + const char* end, + OutputFormat format ) { unsigned int h; - int nn, len; + int nn, len, len_suffix; Name nm; @@ -116,8 +118,18 @@ names_add( const char* name, } nm = &the_names[num_names++]; + switch ( format ) + { + case OUTPUT_VMS_OPT: + /* VMS mode would join the symbol name with a suffix */ + len_suffix = sizeof ( SUFFIX_VMS_64ADDR ); + break; + default: + len_suffix = 0; + } + nm->hash = h; - nm->name = (char*)malloc( len + 1 ); + nm->name = (char*)malloc( len + len_suffix + 1 ); if ( !nm->name ) panic( "not enough memory" ); @@ -181,6 +193,7 @@ names_dump( FILE* out, case OUTPUT_WATCOM_LBC: { + char temp[512]; const char* dot; @@ -195,7 +208,6 @@ names_dump( FILE* out, dot = strchr( dll_name, '.' ); if ( dot ) { - char temp[512]; int len = dot - dll_name; @@ -229,7 +241,7 @@ names_dump( FILE* out, /* Also emit a 64-bit symbol, as created by the `vms_auto64` tool. */ /* It has the string '64__' appended to its name. */ - strcat( the_names[nn].name , "64__" ); + strcat( the_names[nn].name , SUFFIX_VMS_64ADDR ); if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 ) panic( "could not shorten name '%s'", the_names[nn].name ); fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol ); @@ -277,8 +289,9 @@ typedef enum State_ static int -read_header_file( FILE* file, - int verbose ) +read_header_file( FILE* file, + int verbose, + OutputFormat format ) { static char buff[LINEBUFF_SIZE + 1]; State state = STATE_START; @@ -350,7 +363,7 @@ read_header_file( FILE* file, if ( verbose ) fprintf( stderr, ">>> %.*s\n", (int)( p - name ), name ); - names_add( name, p ); + names_add( name, p, format ); } state = STATE_START; @@ -380,7 +393,7 @@ usage( void ) "It receives a list of header files as an argument and\n" "generates a sorted list of unique identifiers in various formats.\n" "\n" - "usage: %s header1 [options] [header2 ...]\n" + "usage: %s [options] header1 [header2 ...]\n" "\n" "options: - parse the contents of stdin, ignore arguments\n" " -v verbose mode, output sent to standard error\n" @@ -519,7 +532,7 @@ main( int argc, } /* end of while loop */ if ( from_stdin ) - read_header_file( stdin, verbose ); + read_header_file( stdin, verbose, format ); else { for ( --argc, argv++; argc > 0; argc--, argv++ ) @@ -534,7 +547,7 @@ main( int argc, if ( verbose ) fprintf( stderr, "opening '%s'\n", argv[0] ); - read_header_file( file, verbose ); + read_header_file( file, verbose, format ); fclose( file ); } } diff --git a/modules/freetype2/src/tools/glnames.py b/modules/freetype2/src/tools/glnames.py @@ -3,7 +3,7 @@ # # FreeType 2 glyph name builder # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/tools/update-copyright-year b/modules/freetype2/src/tools/update-copyright-year @@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}' & eval 'exec perl -wS -i "$0" $argv:q' if 0; -# Copyright (C) 2015-2024 by +# Copyright (C) 2015-2025 by # Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/truetype/module.mk b/modules/freetype2/src/truetype/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/truetype/rules.mk b/modules/freetype2/src/truetype/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/truetype/truetype.c b/modules/freetype2/src/truetype/truetype.c @@ -4,7 +4,7 @@ * * FreeType TrueType driver component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/truetype/ttdriver.c b/modules/freetype2/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ * * TrueType font driver implementation (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -220,12 +220,12 @@ { /* Use 'kern' table if available since that can be faster; otherwise */ /* use GPOS kerning pairs if available. */ - if ( ttface->kern_avail_bits != 0 ) + if ( ttface->kern_avail_bits ) kerning->x = sfnt->get_kerning( ttface, left_glyph, right_glyph ); #ifdef TT_CONFIG_OPTION_GPOS_KERNING - else if ( ttface->gpos_kerning_available ) + else if ( ttface->num_gpos_lookups_kerning ) kerning->x = sfnt->get_gpos_kerning( ttface, left_glyph, right_glyph ); diff --git a/modules/freetype2/src/truetype/ttdriver.h b/modules/freetype2/src/truetype/ttdriver.h @@ -4,7 +4,7 @@ * * High-level TrueType driver interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/truetype/tterrors.h b/modules/freetype2/src/truetype/tterrors.h @@ -4,7 +4,7 @@ * * TrueType error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/truetype/ttgload.c b/modules/freetype2/src/truetype/ttgload.c @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -660,7 +660,7 @@ } while ( subglyph->flags & MORE_COMPONENTS ); gloader->current.num_subglyphs = num_subglyphs; - FT_TRACE5(( " %d component%s\n", + FT_TRACE5(( " %u component%s\n", num_subglyphs, num_subglyphs > 1 ? "s" : "" )); @@ -674,7 +674,7 @@ for ( i = 0; i < num_subglyphs; i++ ) { if ( num_subglyphs > 1 ) - FT_TRACE7(( " subglyph %d:\n", i )); + FT_TRACE7(( " subglyph %u:\n", i )); FT_TRACE7(( " glyph index: %d\n", subglyph->index )); @@ -777,15 +777,11 @@ TT_Hint_Glyph( TT_Loader loader, FT_Bool is_composite ) { -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - TT_Face face = loader->face; - TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); -#endif - TT_GlyphZone zone = &loader->zone; #ifdef TT_USE_BYTECODE_INTERPRETER TT_ExecContext exec = loader->exec; + TT_Size size = loader->size; FT_Long n_ins = exec->glyphSize; #else FT_UNUSED( is_composite ); @@ -797,9 +793,6 @@ if ( n_ins > 0 ) FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points ); - /* Reset graphics state. */ - exec->GS = loader->size->GS; - /* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */ /* completely refer to the (already) hinted subglyphs. */ if ( is_composite ) @@ -811,8 +804,8 @@ } else { - exec->metrics.x_scale = loader->size->metrics->x_scale; - exec->metrics.y_scale = loader->size->metrics->y_scale; + exec->metrics.x_scale = size->metrics->x_scale; + exec->metrics.y_scale = size->metrics->y_scale; } #endif @@ -838,7 +831,7 @@ exec->is_composite = is_composite; exec->pts = *zone; - error = TT_Run_Context( exec ); + error = TT_Run_Context( exec, size ); if ( error && exec->pedantic_hinting ) return error; @@ -854,8 +847,7 @@ /* to change bearings or advance widths. */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - exec->backward_compatibility ) + if ( exec->backward_compatibility ) return FT_Err_Ok; #endif @@ -1152,30 +1144,15 @@ x = FT_MulFix( x, x_scale ); y = FT_MulFix( y, y_scale ); - if ( subglyph->flags & ROUND_XY_TO_GRID ) + if ( subglyph->flags & ROUND_XY_TO_GRID && + IS_HINTED( loader->load_flags ) ) { - TT_Face face = loader->face; - TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); - +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL + if ( !loader->exec->backward_compatibility ) +#endif + x = FT_PIX_ROUND( x ); - if ( IS_HINTED( loader->load_flags ) ) - { - /* - * We round the horizontal offset only if there is hinting along - * the x axis; this corresponds to integer advance width values. - * - * Theoretically, a glyph's bytecode can toggle ClearType's - * `backward compatibility' mode, which would allow modification - * of the advance width. In reality, however, applications - * neither allow nor expect modified advance widths if subpixel - * rendering is active. - * - */ - if ( driver->interpreter_version == TT_INTERPRETER_VERSION_35 ) - x = FT_PIX_ROUND( x ); - - y = FT_PIX_ROUND( y ); - } + y = FT_PIX_ROUND( y ); } } } @@ -1204,8 +1181,6 @@ { FT_Error error; FT_Outline* outline = &loader->gloader->base.outline; - FT_Stream stream = loader->stream; - FT_UShort n_ins; FT_UInt i; @@ -1224,8 +1199,10 @@ #ifdef TT_USE_BYTECODE_INTERPRETER { - TT_ExecContext exec = loader->exec; + TT_ExecContext exec = loader->exec; FT_Memory memory = exec->memory; + FT_Stream stream = loader->stream; + FT_UShort n_ins; if ( exec->glyphSize ) @@ -1378,8 +1355,9 @@ if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && loader->exec && - loader->exec->subpixel_hinting_lean && - loader->exec->grayscale_cleartype ) + loader->exec->mode != FT_RENDER_MODE_MONO && + loader->exec->mode != FT_RENDER_MODE_LCD && + loader->exec->mode != FT_RENDER_MODE_LCD_V ) { loader->pp3.x = loader->advance / 2; loader->pp4.x = loader->advance / 2; @@ -1444,13 +1422,13 @@ #ifdef FT_DEBUG_LEVEL_TRACE if ( recurse_count ) - FT_TRACE5(( " nesting level: %d\n", recurse_count )); + FT_TRACE5(( " nesting level: %u\n", recurse_count )); #endif /* some fonts have an incorrect value of `maxComponentDepth' */ if ( recurse_count > face->max_profile.maxComponentDepth ) { - FT_TRACE1(( "load_truetype_glyph: maxComponentDepth set to %d\n", + FT_TRACE1(( "load_truetype_glyph: maxComponentDepth set to %u\n", recurse_count )); face->max_profile.maxComponentDepth = (FT_UShort)recurse_count; } @@ -1566,18 +1544,18 @@ if ( header_only ) goto Exit; - if ( loader->byte_len == 0 || loader->n_contours == 0 ) - { #ifdef FT_CONFIG_OPTION_INCREMENTAL - tt_get_metrics_incremental( loader, glyph_index ); + tt_get_metrics_incremental( loader, glyph_index ); #endif - tt_loader_set_pp( loader ); + tt_loader_set_pp( loader ); + /* shortcut for empty glyphs */ + if ( loader->byte_len == 0 || loader->n_contours == 0 ) + { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || - FT_IS_VARIATION( FT_FACE( face ) ) ) + if ( !IS_DEFAULT_INSTANCE( FT_FACE( face ) ) ) { /* a small outline structure with four elements for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ @@ -1627,11 +1605,6 @@ goto Exit; } -#ifdef FT_CONFIG_OPTION_INCREMENTAL - tt_get_metrics_incremental( loader, glyph_index ); -#endif - tt_loader_set_pp( loader ); - /***********************************************************************/ /***********************************************************************/ @@ -1735,8 +1708,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || - FT_IS_VARIATION( FT_FACE( face ) ) ) + if ( !IS_DEFAULT_INSTANCE( FT_FACE( face ) ) ) { FT_UShort i, limit; FT_SubGlyph subglyph; @@ -1953,6 +1925,9 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL + /* restore the original stream */ + loader->stream = face->root.stream; + if ( glyph_data_loaded ) face->root.internal->incremental_interface->funcs->free_glyph_data( face->root.internal->incremental_interface->object, @@ -2112,7 +2087,6 @@ { TT_Face face = (TT_Face)glyph->face; SFNT_Service sfnt = (SFNT_Service)face->sfnt; - FT_Stream stream = face->root.stream; FT_Error error; TT_SBit_MetricsRec sbit_metrics; @@ -2121,14 +2095,11 @@ size->strike_index, glyph_index, (FT_UInt)load_flags, - stream, + face->root.stream, &glyph->bitmap, &sbit_metrics ); if ( !error ) { - glyph->outline.n_points = 0; - glyph->outline.n_contours = 0; - glyph->metrics.width = (FT_Pos)sbit_metrics.width * 64; glyph->metrics.height = (FT_Pos)sbit_metrics.height * 64; @@ -2153,6 +2124,50 @@ glyph->bitmap_top = sbit_metrics.horiBearingY; } } + /* a missing glyph in a bitmap-only font is assumed whitespace */ + /* that needs to be constructed using metrics data from `hmtx' */ + /* and, optionally, `vmtx' tables */ + else if ( FT_ERR_EQ( error, Missing_Bitmap ) && + !FT_IS_SCALABLE( glyph->face ) && + face->horz_metrics_size ) + { + FT_Fixed x_scale = size->root.metrics.x_scale; + FT_Fixed y_scale = size->root.metrics.y_scale; + + FT_Short left_bearing = 0; + FT_Short top_bearing = 0; + + FT_UShort advance_width = 0; + FT_UShort advance_height = 0; + + + TT_Get_HMetrics( face, glyph_index, + &left_bearing, + &advance_width ); + TT_Get_VMetrics( face, glyph_index, + 0, + &top_bearing, + &advance_height ); + + glyph->metrics.width = 0; + glyph->metrics.height = 0; + + glyph->metrics.horiBearingX = FT_MulFix( left_bearing, x_scale ); + glyph->metrics.horiBearingY = 0; + glyph->metrics.horiAdvance = FT_MulFix( advance_width, x_scale ); + + glyph->metrics.vertBearingX = 0; + glyph->metrics.vertBearingY = FT_MulFix( top_bearing, y_scale ); + glyph->metrics.vertAdvance = FT_MulFix( advance_height, y_scale ); + + glyph->format = FT_GLYPH_FORMAT_BITMAP; + glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO; + + glyph->bitmap_left = 0; + glyph->bitmap_top = 0; + + error = FT_Err_Ok; + } return error; } @@ -2168,15 +2183,6 @@ FT_Bool glyf_table_only ) { TT_Face face = (TT_Face)glyph->face; - FT_Stream stream = face->root.stream; - -#ifdef TT_USE_BYTECODE_INTERPRETER - FT_Error error; - FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC ); -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( glyph->face ); -#endif -#endif FT_ZERO( loader ); @@ -2186,122 +2192,78 @@ /* load execution context */ if ( IS_HINTED( load_flags ) && !glyf_table_only ) { + FT_Error error; TT_ExecContext exec; - FT_Bool grayscale = TRUE; + FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); + FT_Bool grayscale = FT_BOOL( mode != FT_RENDER_MODE_MONO ); + FT_Bool reexecute = FALSE; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - FT_Bool subpixel_hinting_lean; - FT_Bool grayscale_cleartype; + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( glyph->face ); #endif - FT_Bool reexecute = FALSE; - - if ( size->bytecode_ready < 0 || size->cvt_ready < 0 ) + if ( size->bytecode_ready > 0 ) + return size->bytecode_ready; + if ( size->bytecode_ready < 0 ) { - error = tt_size_ready_bytecode( size, pedantic ); + FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC ); + + + error = tt_size_init_bytecode( size, pedantic ); if ( error ) return error; } - else if ( size->bytecode_ready ) - return size->bytecode_ready; - else if ( size->cvt_ready ) - return size->cvt_ready; - /* query new execution context */ exec = size->context; - if ( !exec ) - return FT_THROW( Could_Not_Find_Context ); - - grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != - FT_RENDER_MODE_MONO ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 ) { - subpixel_hinting_lean = - FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != - FT_RENDER_MODE_MONO ); - grayscale_cleartype = - FT_BOOL( subpixel_hinting_lean && - !( ( load_flags & - FT_LOAD_TARGET_LCD ) || - ( load_flags & - FT_LOAD_TARGET_LCD_V ) ) ); - exec->vertical_lcd_lean = - FT_BOOL( subpixel_hinting_lean && - ( load_flags & - FT_LOAD_TARGET_LCD_V ) ); - grayscale = FT_BOOL( grayscale && !subpixel_hinting_lean ); - } - else - { - subpixel_hinting_lean = FALSE; - grayscale_cleartype = FALSE; - exec->vertical_lcd_lean = FALSE; - } -#endif - - error = TT_Load_Context( exec, face, size ); - if ( error ) - return error; + grayscale = FALSE; - { -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 ) + /* any mode change requires a re-execution of the CVT program */ + if ( mode != exec->mode ) { - /* a change from mono to subpixel rendering (and vice versa) */ - /* requires a re-execution of the CVT program */ - if ( subpixel_hinting_lean != exec->subpixel_hinting_lean ) - { - FT_TRACE4(( "tt_loader_init: subpixel hinting change," - " re-executing `prep' table\n" )); - - exec->subpixel_hinting_lean = subpixel_hinting_lean; - reexecute = TRUE; - } - - /* a change from colored to grayscale subpixel rendering (and */ - /* vice versa) requires a re-execution of the CVT program */ - if ( grayscale_cleartype != exec->grayscale_cleartype ) - { - FT_TRACE4(( "tt_loader_init: grayscale subpixel hinting change," - " re-executing `prep' table\n" )); + FT_TRACE4(( "tt_loader_init: render mode change," + " re-executing `prep' table\n" )); - exec->grayscale_cleartype = grayscale_cleartype; - reexecute = TRUE; - } + exec->mode = mode; + reexecute = TRUE; } + } #endif - /* a change from mono to grayscale rendering (and vice versa) */ - /* requires a re-execution of the CVT program */ - if ( grayscale != exec->grayscale ) - { - FT_TRACE4(( "tt_loader_init: grayscale hinting change," - " re-executing `prep' table\n" )); + /* a change from mono to grayscale rendering (and vice versa) */ + /* requires a re-execution of the CVT program */ + if ( grayscale != exec->grayscale ) + { + FT_TRACE4(( "tt_loader_init: grayscale hinting change," + " re-executing `prep' table\n" )); - exec->grayscale = grayscale; - reexecute = TRUE; - } + exec->grayscale = grayscale; + reexecute = TRUE; } - if ( reexecute ) + if ( size->cvt_ready > 0 ) + return size->cvt_ready; + if ( size->cvt_ready < 0 || reexecute ) { - error = tt_size_run_prep( size, pedantic ); - if ( error ) - return error; - error = TT_Load_Context( exec, face, size ); + error = tt_size_run_prep( size ); if ( error ) return error; } + error = TT_Load_Context( exec, face, size ); + if ( error ) + return error; + /* check whether the cvt program has disabled hinting */ - if ( exec->GS.instruct_control & 1 ) + if ( size->GS.instruct_control & 1 ) load_flags |= FT_LOAD_NO_HINTING; - /* load default graphics state -- if needed */ - if ( exec->GS.instruct_control & 2 ) - exec->GS = tt_default_graphics_state; + /* check whether GS modifications should be reverted */ + if ( size->GS.instruct_control & 2 ) + size->GS = tt_default_graphics_state; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* @@ -2318,28 +2280,25 @@ * */ if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - subpixel_hinting_lean && + mode != FT_RENDER_MODE_MONO && !FT_IS_TRICKY( glyph->face ) ) - exec->backward_compatibility = !( exec->GS.instruct_control & 4 ); + exec->backward_compatibility = ( size->GS.instruct_control & 4 ) ^ 4; else - exec->backward_compatibility = FALSE; + exec->backward_compatibility = 0; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */ - exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC ); loader->exec = exec; - loader->instructions = exec->glyphIns; /* Use the hdmx table if any unless FT_LOAD_COMPUTE_METRICS */ /* is set or backward compatibility mode of the v38 or v40 */ /* interpreters is active. See `ttinterp.h' for details on */ /* backward compatibility mode. */ - if ( IS_HINTED( loader->load_flags ) && - !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) && + if ( IS_HINTED( load_flags ) && + !( load_flags & FT_LOAD_COMPUTE_METRICS ) && #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - exec->backward_compatibility ) && + !exec->backward_compatibility && #endif - !face->postscript.isFixedPitch ) + !face->postscript.isFixedPitch ) { loader->widthp = size->widthp; } @@ -2364,7 +2323,7 @@ loader->face = face; loader->size = size; loader->glyph = (FT_GlyphSlot)glyph; - loader->stream = stream; + loader->stream = face->root.stream; loader->composites.head = NULL; loader->composites.tail = NULL; @@ -2426,84 +2385,26 @@ TT_LoaderRec loader; - FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index )); + FT_TRACE1(( "TT_Load_Glyph: glyph index %u\n", glyph_index )); #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* try to load embedded bitmap (if any) */ - if ( size->strike_index != 0xFFFFFFFFUL && - ( load_flags & FT_LOAD_NO_BITMAP ) == 0 && - IS_DEFAULT_INSTANCE( glyph->face ) ) + if ( size->strike_index != 0xFFFFFFFFUL && + !( load_flags & FT_LOAD_NO_BITMAP && + FT_IS_SCALABLE( glyph->face ) ) && + IS_DEFAULT_INSTANCE( glyph->face ) ) { - FT_Fixed x_scale = size->root.metrics.x_scale; - FT_Fixed y_scale = size->root.metrics.y_scale; - - error = load_sbit_image( size, glyph, glyph_index, load_flags ); - if ( FT_ERR_EQ( error, Missing_Bitmap ) ) - { - /* the bitmap strike is incomplete and misses the requested glyph; */ - /* if we have a bitmap-only font, return an empty glyph */ - if ( !FT_IS_SCALABLE( glyph->face ) ) - { - FT_Short left_bearing = 0; - FT_Short top_bearing = 0; - - FT_UShort advance_width = 0; - FT_UShort advance_height = 0; - - - /* to return an empty glyph, however, we need metrics data */ - /* from the `hmtx' (or `vmtx') table; the assumption is that */ - /* empty glyphs are missing intentionally, representing */ - /* whitespace - not having at least horizontal metrics is */ - /* thus considered an error */ - if ( !face->horz_metrics_size ) - return error; - - /* we now construct an empty bitmap glyph */ - TT_Get_HMetrics( face, glyph_index, - &left_bearing, - &advance_width ); - TT_Get_VMetrics( face, glyph_index, - 0, - &top_bearing, - &advance_height ); - - glyph->outline.n_points = 0; - glyph->outline.n_contours = 0; - - glyph->metrics.width = 0; - glyph->metrics.height = 0; - - glyph->metrics.horiBearingX = FT_MulFix( left_bearing, x_scale ); - glyph->metrics.horiBearingY = 0; - glyph->metrics.horiAdvance = FT_MulFix( advance_width, x_scale ); - - glyph->metrics.vertBearingX = 0; - glyph->metrics.vertBearingY = FT_MulFix( top_bearing, y_scale ); - glyph->metrics.vertAdvance = FT_MulFix( advance_height, y_scale ); - - glyph->format = FT_GLYPH_FORMAT_BITMAP; - glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO; - - glyph->bitmap_left = 0; - glyph->bitmap_top = 0; - - return FT_Err_Ok; - } - } - else if ( error ) - { - /* return error if font is not scalable */ - if ( !FT_IS_SCALABLE( glyph->face ) ) - return error; - } - else + if ( !error ) { if ( FT_IS_SCALABLE( glyph->face ) || FT_HAS_SBIX( glyph->face ) ) { + FT_Fixed x_scale = size->root.metrics.x_scale; + FT_Fixed y_scale = size->root.metrics.y_scale; + + /* for the bbox we need the header only */ (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE ); (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE ); @@ -2550,8 +2451,10 @@ y_scale ); } - return FT_Err_Ok; + goto Exit; } + else if ( !FT_IS_SCALABLE( glyph->face ) ) + goto Exit; } if ( load_flags & FT_LOAD_SBITS_ONLY ) @@ -2563,7 +2466,7 @@ #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ /* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */ - if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid ) + if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.ppem ) { error = FT_THROW( Invalid_Size_Handle ); goto Exit; @@ -2614,7 +2517,7 @@ glyph->metrics.horiAdvance = FT_MulFix( advanceX, x_scale ); glyph->metrics.vertAdvance = FT_MulFix( advanceY, y_scale ); - return error; + goto Exit; } FT_TRACE3(( "Failed to load SVG glyph\n" )); @@ -2642,10 +2545,6 @@ goto Done; } - glyph->format = FT_GLYPH_FORMAT_OUTLINE; - glyph->num_subglyphs = 0; - glyph->outline.flags = 0; - /* main loading loop */ error = load_truetype_glyph( &loader, glyph_index, 0, FALSE ); if ( !error ) @@ -2657,9 +2556,18 @@ } else { + glyph->format = FT_GLYPH_FORMAT_OUTLINE; + glyph->outline = loader.gloader->base.outline; glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS; + /* Set the `high precision' bit flag. This is _critical_ to */ + /* get correct output for monochrome TrueType glyphs at all */ + /* sizes using the bytecode interpreter. */ + if ( !( load_flags & FT_LOAD_NO_SCALE ) && + size->metrics->y_ppem < 24 ) + glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; + /* Translate array so that (0,0) is the glyph's origin. Note */ /* that this behaviour is independent on the value of bit 1 of */ /* the `flags' field in the `head' table -- at least major */ @@ -2708,14 +2616,6 @@ error = compute_glyph_metrics( &loader, glyph_index ); } - /* Set the `high precision' bit flag. */ - /* This is _critical_ to get correct output for monochrome */ - /* TrueType glyphs at all sizes using the bytecode interpreter. */ - /* */ - if ( !( load_flags & FT_LOAD_NO_SCALE ) && - size->metrics->y_ppem < 24 ) - glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; - FT_TRACE1(( " subglyphs = %u, contours = %hu, points = %hu," " flags = 0x%.3x\n", loader.gloader->base.num_subglyphs, @@ -2727,11 +2627,8 @@ tt_loader_done( &loader ); Exit: -#ifdef FT_DEBUG_LEVEL_TRACE - if ( error ) - FT_TRACE1(( " failed (error code 0x%x)\n", - error )); -#endif + FT_TRACE1(( error ? " failed (error code 0x%x)\n" : "", + error )); return error; } diff --git a/modules/freetype2/src/truetype/ttgload.h b/modules/freetype2/src/truetype/ttgload.h @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/truetype/ttgxvar.c b/modules/freetype2/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. * * This file is part of the FreeType project, and may only be used, @@ -489,8 +489,9 @@ FT_UShort axis_count; FT_UInt region_count; - FT_UInt i, j; - FT_Bool long_words; + FT_UInt i, j; + FT_Byte* bytes; + FT_Bool long_words; GX_Blend blend = ttface->blend; FT_ULong* dataOffsetArray = NULL; @@ -526,11 +527,15 @@ if ( FT_QNEW_ARRAY( dataOffsetArray, data_count ) ) goto Exit; + if ( FT_FRAME_ENTER( data_count * 4 ) ) + goto Exit; + + bytes = stream->cursor; + for ( i = 0; i < data_count; i++ ) - { - if ( FT_READ_ULONG( dataOffsetArray[i] ) ) - goto Exit; - } + dataOffsetArray[i] = FT_NEXT_ULONG( bytes ); + + FT_FRAME_EXIT(); /* parse array of region records (region list) */ if ( FT_STREAM_SEEK( offset + region_offset ) ) @@ -564,13 +569,26 @@ goto Exit; itemStore->regionCount = region_count; - for ( i = 0; i < itemStore->regionCount; i++ ) + if ( FT_FRAME_ENTER( (FT_Long)region_count * axis_count * 6 ) ) + { + FT_TRACE2(( "tt_var_load_item_variation_store:" + " not enough data for variation regions\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + bytes = stream->cursor; + + for ( i = 0; i < region_count; i++ ) { GX_AxisCoords axisCoords; if ( FT_NEW_ARRAY( itemStore->varRegionList[i].axisList, axis_count ) ) + { + FT_FRAME_EXIT(); goto Exit; + } axisCoords = itemStore->varRegionList[i].axisList; @@ -579,10 +597,9 @@ FT_Int start, peak, end; - if ( FT_READ_SHORT( start ) || - FT_READ_SHORT( peak ) || - FT_READ_SHORT( end ) ) - goto Exit; + start = FT_NEXT_SHORT( bytes ); + peak = FT_NEXT_SHORT( bytes ); + end = FT_NEXT_SHORT( bytes ); /* immediately tag invalid ranges with special peak = 0 */ if ( ( start < 0 && end > 0 ) || start > peak || peak > end ) @@ -594,6 +611,8 @@ } } + FT_FRAME_EXIT(); + /* end of region list parse */ /* use dataOffsetArray now to parse varData items */ @@ -625,7 +644,7 @@ /* check some data consistency */ if ( word_delta_count > region_idx_count ) { - FT_TRACE2(( "bad short count %d or region count %d\n", + FT_TRACE2(( "bad short count %d or region count %u\n", word_delta_count, region_idx_count )); error = FT_THROW( Invalid_Table ); @@ -634,7 +653,7 @@ if ( region_idx_count > itemStore->regionCount ) { - FT_TRACE2(( "inconsistent regionCount %d in varData[%d]\n", + FT_TRACE2(( "inconsistent regionCount %u in varData[%u]\n", region_idx_count, i )); error = FT_THROW( Invalid_Table ); @@ -648,20 +667,32 @@ varData->wordDeltaCount = word_delta_count; varData->longWords = long_words; + if ( FT_FRAME_ENTER( region_idx_count * 2 ) ) + { + FT_TRACE2(( "tt_var_load_item_variation_store:" + " not enough data for region indices\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + bytes = stream->cursor; + for ( j = 0; j < varData->regionIdxCount; j++ ) { - if ( FT_READ_USHORT( varData->regionIndices[j] ) ) - goto Exit; + varData->regionIndices[j] = FT_NEXT_USHORT( bytes ); if ( varData->regionIndices[j] >= itemStore->regionCount ) { - FT_TRACE2(( "bad region index %d\n", + FT_TRACE2(( "bad region index %u\n", varData->regionIndices[j] )); + FT_FRAME_EXIT(); error = FT_THROW( Invalid_Table ); goto Exit; } } + FT_FRAME_EXIT(); + per_region_size = word_delta_count + region_idx_count; if ( long_words ) per_region_size *= 2; @@ -706,6 +737,7 @@ FT_UInt innerIndexMask; FT_ULong i; FT_UInt j; + FT_Byte* bytes; if ( FT_STREAM_SEEK( offset ) || @@ -757,6 +789,16 @@ if ( FT_NEW_ARRAY( map->outerIndex, map->mapCount ) ) goto Exit; + if ( FT_FRAME_ENTER( map->mapCount * entrySize ) ) + { + FT_TRACE2(( "tt_var_load_delta_set_index_mapping:" + " invalid number of delta-set index mappings\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + bytes = stream->cursor; + for ( i = 0; i < map->mapCount; i++ ) { FT_UInt mapData = 0; @@ -769,9 +811,7 @@ FT_Byte data; - if ( FT_READ_BYTE( data ) ) - goto Exit; - + data = FT_NEXT_BYTE( bytes ); mapData = ( mapData << 8 ) | data; } @@ -789,7 +829,7 @@ if ( outerIndex >= itemStore->dataCount ) { - FT_TRACE2(( "outerIndex[%ld] == %d out of range\n", + FT_TRACE2(( "outerIndex[%lu] == %u out of range\n", i, outerIndex )); error = FT_THROW( Invalid_Table ); @@ -802,7 +842,7 @@ if ( innerIndex >= itemStore->varData[outerIndex].itemCount ) { - FT_TRACE2(( "innerIndex[%ld] == %d out of range\n", + FT_TRACE2(( "innerIndex[%lu] == %u out of range\n", i, innerIndex )); error = FT_THROW( Invalid_Table ); @@ -812,6 +852,8 @@ map->innerIndex[i] = innerIndex; } + FT_FRAME_EXIT(); + Exit: return error; } @@ -965,28 +1007,181 @@ } + static FT_Fixed + tt_calculate_scalar( GX_AxisCoords axis, + FT_UInt axisCount, + FT_Fixed* normalizedcoords ) + { + FT_Fixed scalar = 0x10000L; + FT_UInt j; + + + /* Inner loop steps through axes in this region. */ + for ( j = 0; j < axisCount; j++, axis++ ) + { + FT_Fixed ncv = normalizedcoords[j]; + + + /* 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 coordinates are out of range. */ + else if ( ncv <= axis->startCoord || + ncv >= axis->endCoord ) + { + scalar = 0; + break; + } + + /* Cumulative product of all the axis scalars. */ + 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 */ + + return scalar; + } + + + static FT_Int64 + ft_mul_add_delta_scalar( FT_Int64 returnValue, + FT_Int32 delta, + FT_Int32 scalar ) + { + +#ifdef FT_INT64 + + return returnValue + (FT_Int64)delta * scalar; + +#else /* !FT_INT64 */ + + if ( (FT_UInt32)( delta + 0x8000 ) <= 0x20000 ) + { + /* Fast path: multiplication result fits into 32 bits. */ + + FT_Int32 lo = delta * scalar; + + + returnValue.lo += (FT_UInt32)lo; + + if ( returnValue.lo < (FT_UInt32)lo ) + returnValue.hi += ( lo < 0 ) ? 0 : 1; + + if ( lo < 0 ) + returnValue.hi -= 1; + + return returnValue; + } + else + { + /* Slow path: full 32x32 -> 64-bit signed multiplication. */ + + FT_Int64 product; + + /* Get absolute values. */ + FT_UInt32 a = ( delta < 0 ) ? -delta : delta; + FT_UInt32 b = ( scalar < 0 ) ? -scalar : scalar; + + /* Prepare unsigned multiplication. */ + FT_UInt32 a_lo = a & 0xFFFF; + FT_UInt32 a_hi = a >> 16; + + FT_UInt32 b_lo = b & 0xFFFF; + FT_UInt32 b_hi = b >> 16; + + /* Partial products. */ + FT_UInt32 p0 = a_lo * b_lo; + FT_UInt32 p1 = a_lo * b_hi; + FT_UInt32 p2 = a_hi * b_lo; + FT_UInt32 p3 = a_hi * b_hi; + + /* Combine: result = p3 << 32 + (p1 + p2) << 16 + p0 */ + FT_UInt32 mid = p1 + p2; + FT_UInt32 mid_carry = ( mid < p1 ); + + FT_UInt32 carry; + + + product.lo = ( mid << 16 ) + ( p0 & 0xFFFF ); + carry = ( product.lo < ( p0 & 0xFFFF ) ) ? 1 : 0; + product.hi = p3 + ( mid >> 16 ) + mid_carry + carry; + + /* If result should be negative, negate. */ + if ( ( delta < 0 ) ^ ( scalar < 0 ) ) + { + product.lo = ~product.lo + 1; + product.hi = ~product.hi + ( product.lo == 0 ? 1 : 0 ); + } + + /* Add to `returnValue`. */ + returnValue.lo += product.lo; + if ( returnValue.lo < product.lo ) + returnValue.hi++; + returnValue.hi += product.hi; + + return returnValue; + } + +#endif /* !FT_INT64 */ + + } + + + static FT_ItemVarDelta + ft_round_and_shift16( FT_Int64 returnValue ) + { + +#ifdef FT_INT64 + + return (FT_ItemVarDelta)( returnValue + 0x8000L ) >> 16; + +#else /* !FT_INT64 */ + + FT_UInt hi = returnValue.hi; + FT_UInt lo = returnValue.lo; + + FT_UInt delta; + + + /* Add 0x8000 to round. */ + lo += 0x8000; + if ( lo < 0x8000 ) /* overflow occurred */ + hi += 1; + + /* Shift right by 16 bits. */ + delta = ( hi << 16 ) | ( lo >> 16 ); + + return (FT_ItemVarDelta)delta; + +#endif /* !FT_INT64 */ + + } + + FT_LOCAL_DEF( FT_ItemVarDelta ) tt_var_get_item_delta( FT_Face face, /* TT_Face */ GX_ItemVarStore itemStore, FT_UInt outerIndex, FT_UInt innerIndex ) { - TT_Face ttface = (TT_Face)face; - FT_Stream stream = FT_FACE_STREAM( face ); - FT_Memory memory = stream->memory; - FT_Error error = FT_Err_Ok; - - GX_ItemVarData varData; - FT_ItemVarDelta* deltaSet = NULL; - FT_ItemVarDelta deltaSetStack[16]; + TT_Face ttface = (TT_Face)face; - FT_Fixed* scalars = NULL; - FT_Fixed scalarsStack[16]; + GX_ItemVarData varData; - FT_UInt master, j; - FT_ItemVarDelta returnValue = 0; - FT_UInt per_region_size; - FT_Byte* bytes; + FT_UInt master; + FT_Int64 returnValue = FT_INT64_ZERO; + FT_UInt shift_base = 1; + FT_UInt per_region_size; + FT_Byte* bytes; if ( !ttface->blend || !ttface->blend->normalizedcoords ) @@ -1011,113 +1206,63 @@ if ( varData->regionIdxCount == 0 ) return 0; /* Avoid "applying zero offset to null pointer". */ - if ( varData->regionIdxCount < 16 ) - { - deltaSet = deltaSetStack; - scalars = scalarsStack; - } - else - { - if ( FT_QNEW_ARRAY( deltaSet, varData->regionIdxCount ) ) - goto Exit; - if ( FT_QNEW_ARRAY( scalars, varData->regionIdxCount ) ) - goto Exit; - } - /* Parse delta set. */ /* */ /* Deltas are (word_delta_count + region_idx_count) bytes each */ /* if `longWords` isn't set, and twice as much otherwise. */ per_region_size = varData->wordDeltaCount + varData->regionIdxCount; if ( varData->longWords ) + { + shift_base = 2; per_region_size *= 2; + } bytes = varData->deltaSet + per_region_size * innerIndex; - if ( varData->longWords ) - { - for ( master = 0; master < varData->wordDeltaCount; master++ ) - deltaSet[master] = FT_NEXT_LONG( bytes ); - for ( ; master < varData->regionIdxCount; master++ ) - deltaSet[master] = FT_NEXT_SHORT( bytes ); - } - else - { - for ( master = 0; master < varData->wordDeltaCount; master++ ) - deltaSet[master] = FT_NEXT_SHORT( bytes ); - for ( ; master < varData->regionIdxCount; master++ ) - deltaSet[master] = FT_NEXT_CHAR( bytes ); - } - /* outer loop steps through master designs to be blended */ for ( master = 0; master < varData->regionIdxCount; master++ ) { - FT_Fixed scalar = 0x10000L; - FT_UInt regionIndex = varData->regionIndices[master]; + FT_UInt regionIndex = varData->regionIndices[master]; GX_AxisCoords axis = itemStore->varRegionList[regionIndex].axisList; + FT_Fixed scalar = tt_calculate_scalar( + axis, + itemStore->axisCount, + ttface->blend->normalizedcoords ); - /* inner loop steps through axes in this region */ - for ( j = 0; j < itemStore->axisCount; j++, axis++ ) - { - FT_Fixed ncv = ttface->blend->normalizedcoords[j]; + if ( scalar ) + { + FT_Int delta; - /* 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 ( ncv <= axis->startCoord || - ncv >= axis->endCoord ) + if ( varData->longWords ) { - scalar = 0; - break; + if ( master < varData->wordDeltaCount ) + delta = FT_NEXT_LONG( bytes ); + else + delta = FT_NEXT_SHORT( bytes ); + } + else + { + if ( master < varData->wordDeltaCount ) + delta = FT_NEXT_SHORT( bytes ); + else + delta = FT_NEXT_CHAR( bytes ); } - /* cumulative product of all the axis scalars */ - 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 */ - - scalars[master] = scalar; + returnValue = ft_mul_add_delta_scalar( returnValue, delta, scalar ); + } + else + { + /* Branch-free, yay. */ + bytes += shift_base << ( master < varData->wordDeltaCount ); + } } /* per-region loop */ - - /* Compute the scaled delta for this region. - * - * From: https://docs.microsoft.com/en-us/typography/opentype/spec/otvarcommonformats#item-variation-store-header-and-item-variation-data-subtables: - * - * `Fixed` is a 32-bit (16.16) type and, in the general case, requires - * 32-bit deltas. As described above, the `DeltaSet` record can - * accommodate deltas that are, logically, either 16-bit or 32-bit. - * When scaled deltas are applied to `Fixed` values, the `Fixed` value - * is treated like a 32-bit integer. - * - * `FT_MulAddFix` internally uses 64-bit precision; it thus can handle - * deltas ranging from small 8-bit to large 32-bit values that are - * applied to 16.16 `FT_Fixed` / OpenType `Fixed` values. - */ - returnValue = FT_MulAddFix( scalars, deltaSet, varData->regionIdxCount ); - - Exit: - if ( scalars != scalarsStack ) - FT_FREE( scalars ); - if ( deltaSet != deltaSetStack ) - FT_FREE( deltaSet ); - - return returnValue; + return ft_round_and_shift16( returnValue ); } @@ -1643,6 +1788,7 @@ GX_Blend blend = face->blend; FT_Error error; FT_UInt i, j; + FT_Byte* bytes; FT_ULong table_len; FT_ULong gvar_start; FT_ULong offsetToData; @@ -1734,6 +1880,8 @@ if ( FT_FRAME_ENTER( offsets_len ) ) goto Exit; + bytes = stream->cursor; + /* offsets (one more offset than glyphs, to mark size of last) */ if ( FT_QNEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) ) goto Fail2; @@ -1744,16 +1892,24 @@ FT_ULong max_offset = 0; + if ( stream->limit - stream->cursor < gvar_head.glyphCount * 4 ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation data offset not enough\n" )); + error = FT_THROW( Invalid_Table ); + goto Fail; + } + for ( i = 0; i <= gvar_head.glyphCount; i++ ) { - blend->glyphoffsets[i] = offsetToData + FT_GET_ULONG(); + blend->glyphoffsets[i] = offsetToData + FT_NEXT_ULONG( bytes ); if ( max_offset <= blend->glyphoffsets[i] ) max_offset = blend->glyphoffsets[i]; else { FT_TRACE2(( "ft_var_load_gvar:" - " glyph variation data offset %d not monotonic\n", + " glyph variation data offset %u not monotonic\n", i )); blend->glyphoffsets[i] = max_offset; } @@ -1762,7 +1918,7 @@ if ( limit < blend->glyphoffsets[i] ) { FT_TRACE2(( "ft_var_load_gvar:" - " glyph variation data offset %d out of range\n", + " glyph variation data offset %u out of range\n", i )); blend->glyphoffsets[i] = limit; } @@ -1774,16 +1930,24 @@ FT_ULong max_offset = 0; + if ( stream->limit - stream->cursor < gvar_head.glyphCount * 2 ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation data offset not enough\n" )); + error = FT_THROW( Invalid_Table ); + goto Fail; + } + for ( i = 0; i <= gvar_head.glyphCount; i++ ) { - blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2; + blend->glyphoffsets[i] = offsetToData + FT_NEXT_USHORT( bytes ) * 2; if ( max_offset <= blend->glyphoffsets[i] ) max_offset = blend->glyphoffsets[i]; else { FT_TRACE2(( "ft_var_load_gvar:" - " glyph variation data offset %d not monotonic\n", + " glyph variation data offset %u not monotonic\n", i )); blend->glyphoffsets[i] = max_offset; } @@ -1792,7 +1956,7 @@ if ( limit < blend->glyphoffsets[i] ) { FT_TRACE2(( "ft_var_load_gvar:" - " glyph variation data offset %d out of range\n", + " glyph variation data offset %u out of range\n", i )); blend->glyphoffsets[i] = limit; } @@ -1814,6 +1978,8 @@ goto Fail; } + bytes = stream->cursor; + if ( FT_QNEW_ARRAY( blend->tuplecoords, gvar_head.axisCount * gvar_head.globalCoordCount ) ) goto Fail2; @@ -1824,13 +1990,17 @@ for ( j = 0; j < (FT_UInt)gvar_head.axisCount; j++ ) { blend->tuplecoords[i * gvar_head.axisCount + j] = - FT_fdot14ToFixed( FT_GET_SHORT() ); + FT_fdot14ToFixed( FT_NEXT_SHORT( bytes ) ); FT_TRACE5(( "%.5f ", (double)blend->tuplecoords[i * gvar_head.axisCount + j] / 65536 )); } FT_TRACE5(( "]\n" )); } + if ( FT_NEW_ARRAY( blend->tuplescalars, + gvar_head.globalCoordCount ) ) + goto Fail2; + blend->tuplecount = gvar_head.globalCoordCount; FT_TRACE5(( "\n" )); @@ -1896,15 +2066,25 @@ for ( i = 0; i < blend->num_axis; i++ ) { - FT_Fixed ncv = blend->normalizedcoords[i]; + FT_Fixed ncv; + + + if ( tuple_coords[i] == 0 ) + { + FT_TRACE6(( " tuple coordinate is zero, ignore\n" )); + continue; + } + ncv = blend->normalizedcoords[i]; - FT_TRACE6(( " axis %d coordinate %.5f:\n", i, (double)ncv / 65536 )); + FT_TRACE6(( " axis %u 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 ( ncv == 0 ) + { + FT_TRACE6(( " axis coordinate is zero, stop\n" )); + apply = 0; + break; + } if ( tuple_coords[i] == ncv ) { @@ -1914,12 +2094,6 @@ continue; } - if ( tuple_coords[i] == 0 ) - { - FT_TRACE6(( " tuple coordinate is zero, ignore\n" )); - continue; - } - if ( !( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) ) { /* not an intermediate tuple */ @@ -2001,7 +2175,7 @@ if ( num_coords > mmvar->num_axis ) { FT_TRACE2(( "ft_var_to_normalized:" - " only using first %d of %d coordinates\n", + " only using first %u of %u coordinates\n", mmvar->num_axis, num_coords )); num_coords = mmvar->num_axis; } @@ -2016,7 +2190,7 @@ FT_Fixed coord = coords[i]; - FT_TRACE5(( " %d: %.5f\n", i, (double)coord / 65536 )); + FT_TRACE5(( " %u: %.5f\n", i, (double)coord / 65536 )); if ( coord > a->maximum || coord < a->minimum ) { FT_TRACE1(( "ft_var_to_normalized: design coordinate %.5f\n", @@ -2156,7 +2330,7 @@ if ( num_coords > blend->num_axis ) { FT_TRACE2(( "ft_var_to_design:" - " only using first %d of %d coordinates\n", + " only using first %u of %u coordinates\n", blend->num_axis, num_coords )); nc = blend->num_axis; } @@ -2516,7 +2690,7 @@ " minimum default maximum flags\n" )); /* " XXXX.XXXXX XXXX.XXXXX XXXX.XXXXX 0xXXXX" */ - FT_TRACE5(( " %3d `%s'" + FT_TRACE5(( " %3u `%s'" " %10.5f %10.5f %10.5f 0x%04X%s\n", i, a->name, @@ -2608,7 +2782,7 @@ (void)FT_STREAM_SEEK( pos ); - FT_TRACE5(( " named instance %d (%s%s%s, %s%s%s)\n", + FT_TRACE5(( " named instance %u (%s%s%s, %s%s%s)\n", i, strname ? "name: `" : "", strname ? strname : "unnamed", @@ -2636,7 +2810,7 @@ FT_UInt strid = ~0U; - /* The default instance is missing in array the */ + /* The default instance is missing in the array */ /* of named instances; try to synthesize an entry. */ /* If this fails, `default_named_instance` remains */ /* at value zero, which doesn't do any harm. */ @@ -2766,10 +2940,18 @@ } manageCvt; - face->doblend = FALSE; - if ( !face->blend ) { + face->doblend = FALSE; + for ( i = 0; i < num_coords; i++ ) + if ( coords[i] ) + { + face->doblend = TRUE; + break; + } + if ( !face->doblend ) + goto Exit; + if ( FT_SET_ERROR( TT_Get_MM_Var( FT_FACE( face ), NULL ) ) ) goto Exit; } @@ -2780,7 +2962,7 @@ if ( num_coords > mmvar->num_axis ) { FT_TRACE2(( "TT_Set_MM_Blend:" - " only using first %d of %d coordinates\n", + " only using first %u of %u coordinates\n", mmvar->num_axis, num_coords )); num_coords = mmvar->num_axis; } @@ -2882,11 +3064,7 @@ /* return value -1 indicates `no change' */ if ( !have_diff ) - { - face->doblend = TRUE; - return -1; - } for ( ; i < mmvar->num_axis; i++ ) { @@ -2915,7 +3093,15 @@ blend->normalizedcoords, blend->coords ); - face->doblend = TRUE; + face->doblend = FALSE; + for ( i = 0; i < blend->num_axis; i++ ) + { + if ( blend->normalizedcoords[i] ) + { + face->doblend = TRUE; + break; + } + } if ( face->cvt ) { @@ -2941,6 +3127,9 @@ } } + for ( i = 0 ; i < blend->tuplecount ; i++ ) + blend->tuplescalars[i] = (FT_Fixed)-0x20000L; + Exit: return error; } @@ -2980,7 +3169,24 @@ FT_UInt num_coords, FT_Fixed* coords ) { - return tt_set_mm_blend( (TT_Face)face, num_coords, coords, 1 ); + FT_Error error; + + + error = tt_set_mm_blend( (TT_Face)face, num_coords, coords, 1 ); + if ( error == FT_Err_Ok ) + { + FT_UInt i; + + + for ( i = 0; i < num_coords; i++ ) + if ( coords[i] ) + { + error = -2; /* -2 means is_variable. */ + break; + } + } + + return error; } @@ -3043,7 +3249,7 @@ if ( num_coords > blend->num_axis ) { FT_TRACE2(( "TT_Get_MM_Blend:" - " only using first %d of %d coordinates\n", + " only using first %u of %u coordinates\n", blend->num_axis, num_coords )); nc = blend->num_axis; } @@ -3125,7 +3331,7 @@ if ( num_coords > mmvar->num_axis ) { FT_TRACE2(( "TT_Set_Var_Design:" - " only using first %d of %d coordinates\n", + " only using first %u of %u coordinates\n", mmvar->num_axis, num_coords )); num_coords = mmvar->num_axis; } @@ -3201,6 +3407,15 @@ if ( error ) goto Exit; + for ( i = 0; i < num_coords; i++ ) + { + if ( normalized[i] ) + { + error = -2; /* -2 means is_variable. */ + break; + } + } + Exit: FT_FREE( normalized ); return error; @@ -3237,10 +3452,12 @@ FT_UInt num_coords, FT_Fixed* coords ) { - TT_Face ttface = (TT_Face)face; - FT_Error error = FT_Err_Ok; - GX_Blend blend; - FT_UInt i, nc; + TT_Face ttface = (TT_Face)face; + FT_Error error = FT_Err_Ok; + GX_Blend blend; + FT_MM_Var* mmvar; + FT_Var_Axis* a; + FT_UInt i, nc; if ( !ttface->blend ) @@ -3263,24 +3480,26 @@ if ( num_coords > blend->num_axis ) { FT_TRACE2(( "TT_Get_Var_Design:" - " only using first %d of %d coordinates\n", + " only using first %u of %u coordinates\n", blend->num_axis, num_coords )); nc = blend->num_axis; } + mmvar = blend->mmvar; + a = mmvar->axis; if ( ttface->doblend ) { - for ( i = 0; i < nc; i++ ) + for ( i = 0; i < nc; i++, a++ ) coords[i] = blend->coords[i]; } else { - for ( i = 0; i < nc; i++ ) - coords[i] = 0; + for ( i = 0; i < nc; i++, a++ ) + coords[i] = a->def; } - for ( ; i < num_coords; i++ ) - coords[i] = 0; + for ( ; i < num_coords; i++, a++ ) + coords[i] = a->def; return FT_Err_Ok; } @@ -3373,6 +3592,9 @@ error = TT_Set_Var_Design( face, 0, NULL ); } + if ( error == -1 || error == -2 ) + error = FT_Err_Ok; + Exit: return error; } @@ -3591,7 +3813,7 @@ FT_Stream_SeekSet( stream, here ); } - FT_TRACE5(( "cvar: there %s %d tuple%s:\n", + FT_TRACE5(( "cvar: there %s %u tuple%s:\n", ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "is" : "are", tupleCount & GX_TC_TUPLE_COUNT_MASK, ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" )); @@ -3610,7 +3832,7 @@ FT_Fixed apply; - FT_TRACE6(( " tuple %d:\n", i )); + FT_TRACE6(( " tuple %u:\n", i )); tupleDataSize = FT_GET_USHORT(); tupleIndex = FT_GET_USHORT(); @@ -3676,7 +3898,7 @@ if ( !points || !deltas ) ; /* failure, ignore it */ - else if ( localpoints == ALL_POINTS ) + else if ( points == ALL_POINTS ) { #ifdef FT_DEBUG_LEVEL_TRACE int count = 0; @@ -3697,7 +3919,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE if ( old_cvt_delta != cvt_deltas[j] ) { - FT_TRACE7(( " %d: %f -> %f\n", + FT_TRACE7(( " %u: %f -> %f\n", j, (double)( FT_fdot6ToFixed( face->cvt[j] ) + old_cvt_delta ) / 65536, @@ -4027,7 +4249,7 @@ FT_Outline* outline, FT_Vector* unrounded ) { - FT_Error error; + FT_Error error = FT_Err_Ok; TT_Face face = loader->face; FT_Stream stream = face->root.stream; FT_Memory memory = stream->memory; @@ -4047,6 +4269,15 @@ FT_ULong here; FT_UInt i, j; + FT_UInt peak_coords_size; + FT_UInt point_deltas_x_size; + FT_UInt points_org_size; + FT_UInt points_out_size; + FT_UInt has_delta_size; + FT_UInt pool_size; + FT_Byte* pool = NULL; + FT_Byte* p; + FT_Fixed* peak_coords = NULL; FT_Fixed* tuple_coords; FT_Fixed* im_start_coords; @@ -4067,21 +4298,24 @@ FT_Fixed* point_deltas_y = NULL; - if ( !face->doblend || !blend ) - return FT_THROW( Invalid_Argument ); - for ( i = 0; i < n_points; i++ ) { unrounded[i].x = INT_TO_F26DOT6( outline->points[i].x ); unrounded[i].y = INT_TO_F26DOT6( outline->points[i].y ); } + if ( !face->doblend ) + goto Exit; + + if ( !blend ) + return FT_THROW( Invalid_Argument ); + if ( glyph_index >= blend->gv_glyphcnt || blend->glyphoffsets[glyph_index] == blend->glyphoffsets[glyph_index + 1] ) { FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" - " no variation data for glyph %d\n", glyph_index )); + " no variation data for glyph %u\n", glyph_index )); return FT_Err_Ok; } @@ -4125,18 +4359,41 @@ FT_Stream_SeekSet( stream, here ); } - FT_TRACE5(( "gvar: there %s %d tuple%s:\n", + FT_TRACE5(( "gvar: there %s %u tuple%s:\n", ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "is" : "are", tupleCount & GX_TC_TUPLE_COUNT_MASK, ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" )); - 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 ) ) + peak_coords_size = ALIGN_SIZE( 3 * blend->num_axis * + sizeof ( *peak_coords ) ); + point_deltas_x_size = ALIGN_SIZE( 2 * n_points * + sizeof ( *point_deltas_x ) ); + points_org_size = ALIGN_SIZE( n_points * sizeof ( *points_org ) ); + points_out_size = ALIGN_SIZE( n_points * sizeof ( *points_out ) ); + has_delta_size = ALIGN_SIZE( n_points * sizeof ( *has_delta ) ); + + pool_size = peak_coords_size + + point_deltas_x_size + + points_org_size + + points_out_size + + has_delta_size; + + if ( FT_ALLOC( pool, pool_size ) ) goto Exit; + p = pool; + peak_coords = (FT_Fixed*)p; + p += peak_coords_size; + point_deltas_x = (FT_Fixed*)p; + p += point_deltas_x_size; + points_org = (FT_Vector*)p; + p += points_org_size; + points_out = (FT_Vector*)p; + p += points_out_size; + has_delta = (FT_Bool*)p; + + FT_ARRAY_ZERO( point_deltas_x, 2 * n_points ); + 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; @@ -4147,27 +4404,70 @@ points_org[j].y = FT_intToFixed( outline->points[j].y ); } - for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ ) + p = stream->cursor; + + tupleCount &= GX_TC_TUPLE_COUNT_MASK; + for ( i = 0; i < tupleCount; i++ ) { - FT_UInt tupleDataSize; - FT_UInt tupleIndex; - FT_Fixed apply; + FT_UInt tupleDataSize; + FT_UInt tupleIndex; + FT_Fixed apply; + FT_Fixed* tupleScalars; - FT_TRACE6(( " tuple %d:\n", i )); + FT_TRACE6(( " tuple %u:\n", i )); - tupleDataSize = FT_GET_USHORT(); - tupleIndex = FT_GET_USHORT(); + tupleScalars = blend->tuplescalars; + + /* Enter frame for four bytes. */ + if ( 4 > stream->limit - p ) + { + FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" + " invalid glyph variation array header\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + tupleDataSize = FT_NEXT_USHORT( p ); + tupleIndex = FT_NEXT_USHORT( p ); + + if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) + tupleScalars = NULL; if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { + if ( 2 * blend->num_axis > (FT_UInt)( stream->limit - p ) ) + { + FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" + " invalid glyph variation array header\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + for ( j = 0; j < blend->num_axis; j++ ) - peak_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); + peak_coords[j] = FT_fdot14ToFixed( FT_NEXT_SHORT( p ) ); + tuple_coords = peak_coords; + tupleScalars = NULL; } else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) < blend->tuplecount ) + { + FT_Fixed scalar = + tupleScalars + ? tupleScalars[tupleIndex & GX_TI_TUPLE_INDEX_MASK] + : (FT_Fixed)-0x20000; + + + if ( scalar != (FT_Fixed)-0x20000 ) + { + apply = scalar; + goto apply_found; + } + tuple_coords = blend->tuplecoords + - ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis; + ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * + blend->num_axis; + } else { FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" @@ -4179,10 +4479,18 @@ if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { + if ( 4 * blend->num_axis > (FT_UInt)( stream->limit - p ) ) + { + FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" + " invalid glyph variation array header\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + for ( j = 0; j < blend->num_axis; j++ ) - im_start_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); + im_start_coords[j] = FT_fdot14ToFixed( FT_NEXT_SHORT( p ) ); for ( j = 0; j < blend->num_axis; j++ ) - im_end_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() ); + im_end_coords[j] = FT_fdot14ToFixed( FT_NEXT_SHORT( p ) ); } apply = ft_var_apply_tuple( blend, @@ -4191,6 +4499,11 @@ im_start_coords, im_end_coords ); + if ( tupleScalars ) + tupleScalars[tupleIndex & GX_TI_TUPLE_INDEX_MASK] = apply; + + apply_found: + if ( apply == 0 ) /* tuple isn't active for our blend */ { offsetToData += tupleDataSize; @@ -4247,7 +4560,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE if ( point_delta_x || point_delta_y ) { - FT_TRACE7(( " %d: (%f, %f) -> (%f, %f)\n", + FT_TRACE7(( " %u: (%f, %f) -> (%f, %f)\n", j, (double)( FT_intToFixed( outline->points[j].x ) + old_point_delta_x ) / 65536, @@ -4321,7 +4634,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE if ( point_delta_x || point_delta_y ) { - FT_TRACE7(( " %d: (%f, %f) -> (%f, %f)\n", + FT_TRACE7(( " %u: (%f, %f) -> (%f, %f)\n", j, (double)( FT_intToFixed( outline->points[j].x ) + old_point_delta_x ) / 65536, @@ -4402,11 +4715,7 @@ Exit: if ( sharedpoints != ALL_POINTS ) FT_FREE( sharedpoints ); - FT_FREE( points_org ); - FT_FREE( points_out ); - FT_FREE( has_delta ); - FT_FREE( peak_coords ); - FT_FREE( point_deltas_x ); + FT_FREE( pool ); FExit: FT_FRAME_EXIT(); @@ -4577,6 +4886,7 @@ FT_FREE( blend->mvar_table ); } + FT_FREE( blend->tuplescalars ); FT_FREE( blend->tuplecoords ); FT_FREE( blend->glyphoffsets ); FT_FREE( blend ); diff --git a/modules/freetype2/src/truetype/ttgxvar.h b/modules/freetype2/src/truetype/ttgxvar.h @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader (specification) * - * Copyright (C) 2004-2024 by + * Copyright (C) 2004-2025 by * David Turner, Robert Wilhelm, Werner Lemberg and George Williams. * * This file is part of the FreeType project, and may only be used, @@ -255,6 +255,10 @@ FT_BEGIN_HEADER * A two-dimensional array that holds the shared tuple coordinates * in the `gvar' table. * + * tuplescalars :: + * A one-dimensional array that holds the shared tuple + * scalars in the `gvar' table for current face coordinates. + * * gv_glyphcnt :: * The number of glyphs handled in the `gvar' table. * @@ -293,6 +297,7 @@ FT_BEGIN_HEADER FT_UInt tuplecount; FT_Fixed* tuplecoords; /* tuplecoords[tuplecount][num_axis] */ + FT_Fixed* tuplescalars; /* tuplescalars[tuplecount] */ FT_UInt gv_glyphcnt; FT_ULong* glyphoffsets; /* glyphoffsets[gv_glyphcnt + 1] */ diff --git a/modules/freetype2/src/truetype/ttinterp.c b/modules/freetype2/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -27,6 +27,8 @@ #include <freetype/ftdriver.h> #include <freetype/ftmm.h> +#ifdef TT_USE_BYTECODE_INTERPRETER + #include "ttinterp.h" #include "tterrors.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT @@ -34,9 +36,6 @@ #endif -#ifdef TT_USE_BYTECODE_INTERPRETER - - /************************************************************************** * * The macro FT_COMPONENT is used in trace mode. It is an implicit @@ -89,58 +88,37 @@ #define FAILURE 1 - /************************************************************************** - * - * CODERANGE FUNCTIONS - * - */ + /* The default value for `scan_control' is documented as FALSE in the */ + /* TrueType specification. This is confusing since it implies a */ + /* Boolean value. However, this is not the case, thus both the */ + /* default values of our `scan_type' and `scan_control' fields (which */ + /* the documentation's `scan_control' variable is split into) are */ + /* zero. */ + /* */ + /* The rounding compensation should logically belong here but poorly */ + /* described in the OpenType specs. It was probably important in the */ + /* days of dot matrix printers. The values are referenced by color */ + /* as Gray, Black, and White in order. The Apple specification says */ + /* that the Gray compensation is always zero. The fourth value is */ + /* not described at all, but Greg says that it is the same as Gray. */ + /* FreeType sets all compensation values to zero. */ + + const TT_GraphicsState tt_default_graphics_state = + { + 0, 0, 0, 1, 1, 1, + { 0x4000, 0 }, { 0x4000, 0 }, { 0x4000, 0 }, + 1, 1, { 0, 0, 0, 0 }, + + 64, 68, 0, 0, 9, 3, + TRUE, 0, FALSE, 0 + }; /************************************************************************** * - * @Function: - * TT_Goto_CodeRange - * - * @Description: - * Switches to a new code range (updates the code related elements in - * `exec', and `IP'). - * - * @Input: - * range :: - * The new execution code range. - * - * IP :: - * The new IP in the new code range. + * CODERANGE FUNCTIONS * - * @InOut: - * exec :: - * The target execution context. */ - FT_LOCAL_DEF( void ) - TT_Goto_CodeRange( TT_ExecContext exec, - FT_Int range, - FT_Long IP ) - { - TT_CodeRange* coderange; - - - FT_ASSERT( range >= 1 && range <= 3 ); - - coderange = &exec->codeRangeTable[range - 1]; - - FT_ASSERT( coderange->base ); - - /* NOTE: Because the last instruction of a program may be a CALL */ - /* which will return to the first byte *after* the code */ - /* range, we test for IP <= Size instead of IP < Size. */ - /* */ - FT_ASSERT( IP <= coderange->size ); - - exec->code = coderange->base; - exec->codeSize = coderange->size; - exec->IP = IP; - exec->curRange = range; - } /************************************************************************** @@ -168,13 +146,19 @@ FT_LOCAL_DEF( void ) TT_Set_CodeRange( TT_ExecContext exec, FT_Int range, - void* base, + FT_Byte* base, FT_Long length ) { FT_ASSERT( range >= 1 && range <= 3 ); - exec->codeRangeTable[range - 1].base = (FT_Byte*)base; + exec->codeRangeTable[range - 1].base = base; exec->codeRangeTable[range - 1].size = length; + + exec->code = base; + exec->codeSize = length; + exec->IP = 0; + exec->curRange = range; + exec->iniRange = range; } @@ -224,9 +208,6 @@ * exec :: * A handle to the target execution context. * - * memory :: - * A handle to the parent memory object. - * * @Note: * Only the glyph loader and debugger should call this function. */ @@ -240,10 +221,6 @@ exec->maxPoints = 0; exec->maxContours = 0; - /* free stack */ - FT_FREE( exec->stack ); - exec->stackSize = 0; - /* free glyf cvt working area */ FT_FREE( exec->glyfCvt ); exec->glyfCvtSize = 0; @@ -300,72 +277,26 @@ TT_Face face, TT_Size size ) { - FT_Int i; - TT_MaxProfile* maxp; - FT_Error error; - FT_Memory memory = exec->memory; + FT_Memory memory = exec->memory; exec->face = face; - maxp = &face->max_profile; exec->size = size; - if ( size ) - { - exec->numFDefs = size->num_function_defs; - exec->maxFDefs = size->max_function_defs; - exec->numIDefs = size->num_instruction_defs; - exec->maxIDefs = size->max_instruction_defs; - exec->FDefs = size->function_defs; - exec->IDefs = size->instruction_defs; - exec->pointSize = size->point_size; - exec->tt_metrics = size->ttmetrics; - exec->metrics = *size->metrics; - - exec->maxFunc = size->max_func; - exec->maxIns = size->max_ins; - - for ( i = 0; i < TT_MAX_CODE_RANGES; i++ ) - exec->codeRangeTable[i] = size->codeRangeTable[i]; - - /* set graphics state */ - exec->GS = size->GS; - - exec->cvtSize = size->cvt_size; - exec->cvt = size->cvt; - - exec->storeSize = size->storage_size; - exec->storage = size->storage; - - exec->twilight = size->twilight; - - /* In case of multi-threading it can happen that the old size object */ - /* no longer exists, thus we must clear all glyph zone references. */ - FT_ZERO( &exec->zp0 ); - exec->zp1 = exec->zp0; - exec->zp2 = exec->zp0; - } - - /* XXX: We reserve a little more elements on the stack to deal safely */ - /* with broken fonts like arialbs, courbs, timesbs, etc. */ - if ( FT_QRENEW_ARRAY( exec->stack, - exec->stackSize, - maxp->maxStackElements + 32 ) ) - return error; - exec->stackSize = maxp->maxStackElements + 32; + /* CVT and storage are not persistent in FreeType */ + /* reset them after they might have been modifief */ + exec->storage = exec->stack + exec->stackSize; + exec->cvt = exec->storage + exec->storeSize; /* free previous glyph code range */ FT_FREE( exec->glyphIns ); exec->glyphSize = 0; - exec->pts.n_points = 0; - exec->pts.n_contours = 0; - - exec->zp1 = exec->pts; - exec->zp2 = exec->pts; - exec->zp0 = exec->pts; + exec->pointSize = size->point_size; + exec->tt_metrics = size->ttmetrics; + exec->metrics = *size->metrics; - exec->instruction_trap = FALSE; + exec->twilight = size->twilight; return FT_Err_Ok; } @@ -394,89 +325,22 @@ TT_Save_Context( TT_ExecContext exec, TT_Size size ) { - FT_Int i; - - - /* XXX: Will probably disappear soon with all the code range */ - /* management, which is now rather obsolete. */ - /* */ - size->num_function_defs = exec->numFDefs; - size->num_instruction_defs = exec->numIDefs; - - size->max_func = exec->maxFunc; - size->max_ins = exec->maxIns; - - for ( i = 0; i < TT_MAX_CODE_RANGES; i++ ) - size->codeRangeTable[i] = exec->codeRangeTable[i]; - } - - - /************************************************************************** - * - * @Function: - * TT_Run_Context - * - * @Description: - * Executes one or more instructions in the execution context. - * - * @Input: - * exec :: - * A handle to the target execution context. - * - * @Return: - * TrueType error code. 0 means success. - */ - FT_LOCAL_DEF( FT_Error ) - TT_Run_Context( TT_ExecContext exec ) - { - TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ); - - exec->zp0 = exec->pts; - exec->zp1 = exec->pts; - exec->zp2 = exec->pts; - - exec->GS.gep0 = 1; - exec->GS.gep1 = 1; - exec->GS.gep2 = 1; - - exec->GS.projVector.x = 0x4000; - exec->GS.projVector.y = 0x0000; - - exec->GS.freeVector = exec->GS.projVector; - exec->GS.dualVector = exec->GS.projVector; + /* UNDOCUMENTED! */ + /* Only these GS values can be modified by the CVT program. */ - exec->GS.round_state = 1; - exec->GS.loop = 1; - - /* some glyphs leave something on the stack. so we clean it */ - /* before a new execution. */ - exec->top = 0; - exec->callTop = 0; - - return exec->face->interpreter( exec ); + size->GS.minimum_distance = exec->GS.minimum_distance; + size->GS.control_value_cutin = exec->GS.control_value_cutin; + size->GS.single_width_cutin = exec->GS.single_width_cutin; + size->GS.single_width_value = exec->GS.single_width_value; + size->GS.delta_base = exec->GS.delta_base; + size->GS.delta_shift = exec->GS.delta_shift; + size->GS.auto_flip = exec->GS.auto_flip; + size->GS.instruct_control = exec->GS.instruct_control; + size->GS.scan_control = exec->GS.scan_control; + size->GS.scan_type = exec->GS.scan_type; } - /* The default value for `scan_control' is documented as FALSE in the */ - /* TrueType specification. This is confusing since it implies a */ - /* Boolean value. However, this is not the case, thus both the */ - /* default values of our `scan_type' and `scan_control' fields (which */ - /* the documentation's `scan_control' variable is split into) are */ - /* zero. */ - - const TT_GraphicsState tt_default_graphics_state = - { - 0, 0, 0, - { 0x4000, 0 }, - { 0x4000, 0 }, - { 0x4000, 0 }, - - 1, 64, 1, - TRUE, 68, 0, 0, 9, 3, - 0, FALSE, 0, 1, 1, 1 - }; - - /* documentation is in ttinterp.h */ FT_EXPORT_DEF( TT_ExecContext ) @@ -485,7 +349,8 @@ FT_Memory memory; FT_Error error; - TT_ExecContext exec = NULL; + TT_ExecContext exec = NULL; + FT_DebugHook_Func interp; if ( !driver ) @@ -497,6 +362,15 @@ if ( FT_NEW( exec ) ) goto Fail; + /* set `exec->interpreter' according to the debug hook present, */ + /* which is used by 'ttdebug'. */ + interp = driver->root.root.library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE]; + + if ( interp ) + exec->interpreter = (TT_Interpreter)interp; + else + exec->interpreter = (TT_Interpreter)TT_RunIns; + /* create callStack here, other allocations delayed */ exec->memory = memory; exec->callSize = 32; @@ -1160,20 +1034,35 @@ #undef PACK -#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER +#ifdef FT_INT64 + +#define TT_MulFix14( a, b ) TT_MulFix14_64( a, b ) + + static inline FT_F26Dot6 + TT_MulFix14_64( FT_F26Dot6 a, + FT_F2Dot14 b ) + { + FT_Int64 ab = MUL_INT64( a, b ); + + + ab = ADD_INT64( ab, 0x2000 + ( ab >> 63 ) ); /* rounding phase */ + + return (FT_F26Dot6)( ab >> 14 ); + } + +#elif !defined( FT_CONFIG_OPTION_NO_ASSEMBLER ) #if defined( __arm__ ) && \ ( defined( __thumb2__ ) || !defined( __thumb__ ) ) #define TT_MulFix14 TT_MulFix14_arm - static FT_Int32 + static __inline FT_Int32 TT_MulFix14_arm( FT_Int32 a, - FT_Int b ) + FT_Int32 b ) { FT_Int32 t, t2; - #if defined( __CC_ARM ) || defined( __ARMCC__ ) __asm @@ -1199,8 +1088,8 @@ #endif "adds %1, %1, %0\n\t" /* %1 += %0 */ "adc %2, %2, #0\n\t" /* %2 += carry */ - "mov %0, %1, lsr #14\n\t" /* %0 = %1 >> 16 */ - "orr %0, %0, %2, lsl #18\n\t" /* %0 |= %2 << 16 */ + "mov %0, %1, lsr #14\n\t" /* %0 = %1 >> 14 */ + "orr %0, %0, %2, lsl #18\n\t" /* %0 |= %2 << 18 */ : "=r"(a), "=&r"(t2), "=&r"(t) : "r"(a), "r"(b) : "cc" ); @@ -1210,49 +1099,60 @@ return a; } -#endif /* __arm__ && ( __thumb2__ || !__thumb__ ) */ - -#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ - - -#if defined( __GNUC__ ) && \ - ( defined( __i386__ ) || defined( __x86_64__ ) ) +#elif defined( __i386__ ) || defined( _M_IX86 ) -#define TT_MulFix14 TT_MulFix14_long_long +#define TT_MulFix14 TT_MulFix14_i386 - /* Temporarily disable the warning that C90 doesn't support `long long'. */ -#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 -#pragma GCC diagnostic push -#endif -#pragma GCC diagnostic ignored "-Wlong-long" + /* documentation is in freetype.h */ - /* This is declared `noinline' because inlining the function results */ - /* in slower code. The `pure' attribute indicates that the result */ - /* only depends on the parameters. */ - static __attribute__(( noinline )) - __attribute__(( pure )) FT_Int32 - TT_MulFix14_long_long( FT_Int32 a, - FT_Int b ) + static __inline FT_Int32 + TT_MulFixi14_i386( FT_Int32 a, + FT_Int32 b ) { + FT_Int32 result; - long long ret = (long long)a * b; +#if defined( __GNUC__ ) - /* The following line assumes that right shifting of signed values */ - /* will actually preserve the sign bit. The exact behaviour is */ - /* undefined, but this is true on x86 and x86_64. */ - long long tmp = ret >> 63; + __asm__ __volatile__ ( + "imul %%edx\n" + "movl %%edx, %%ecx\n" + "sarl $31, %%ecx\n" + "addl $0x2000, %%ecx\n" + "addl %%ecx, %%eax\n" + "adcl $0, %%edx\n" + "shrl $14, %%eax\n" + "shll $18, %%edx\n" + "addl %%edx, %%eax\n" + : "=a"(result), "=d"(b) + : "a"(a), "d"(b) + : "%ecx", "cc" ); + +#elif defined( _MSC_VER) + __asm + { + mov eax, a + mov edx, b + imul edx + mov ecx, edx + sar ecx, 31 + add ecx, 2000h + add eax, ecx + adc edx, 0 + shr eax, 14 + shl edx, 18 + add eax, edx + mov result, eax + } - ret += 0x2000 + tmp; +#endif - return (FT_Int32)( ret >> 14 ); + return result; } -#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 -#pragma GCC diagnostic pop -#endif +#endif /* __i386__ || _M_IX86 */ -#endif /* __GNUC__ && ( __i386__ || __x86_64__ ) */ +#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ #ifndef TT_MulFix14 @@ -1262,92 +1162,59 @@ /* for platforms where sizeof(int) == 2. */ static FT_Int32 TT_MulFix14( FT_Int32 a, - FT_Int b ) + FT_Int16 b ) { - FT_Int32 sign; - FT_UInt32 ah, al, mid, lo, hi; - - - sign = a ^ b; + FT_Int32 m, hi; + FT_UInt32 l, lo; - if ( a < 0 ) - a = -a; - if ( b < 0 ) - b = -b; - ah = (FT_UInt32)( ( a >> 16 ) & 0xFFFFU ); - al = (FT_UInt32)( a & 0xFFFFU ); + /* compute a*b as 64-bit (hi_lo) value */ + l = (FT_UInt32)( ( a & 0xFFFFU ) * b ); + m = ( a >> 16 ) * b; - lo = al * b; - mid = ah * b; - hi = mid >> 16; - mid = ( mid << 16 ) + ( 1 << 13 ); /* rounding */ - lo += mid; - if ( lo < mid ) - hi += 1; + lo = l + ( (FT_UInt32)m << 16 ); + hi = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo < l ); - mid = ( lo >> 14 ) | ( hi << 18 ); + /* divide the result by 2^14 with rounding */ + l = lo + 0x2000U + (FT_UInt32)( hi >> 31 ); /* rounding phase */ + hi += ( l < lo ); - return sign >= 0 ? (FT_Int32)mid : -(FT_Int32)mid; + return (FT_F26Dot6)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) ); } #endif /* !TT_MulFix14 */ -#if defined( __GNUC__ ) && \ - ( defined( __i386__ ) || \ - defined( __x86_64__ ) || \ - defined( __arm__ ) ) - -#define TT_DotFix14 TT_DotFix14_long_long - -#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 -#pragma GCC diagnostic push -#endif -#pragma GCC diagnostic ignored "-Wlong-long" +#ifdef FT_INT64 - static __attribute__(( pure )) FT_Int32 - TT_DotFix14_long_long( FT_Int32 ax, - FT_Int32 ay, - FT_Int bx, - FT_Int by ) + /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */ + static inline FT_F26Dot6 + TT_DotFix14( FT_F26Dot6 ax, + FT_F26Dot6 ay, + FT_F2Dot14 bx, + FT_F2Dot14 by ) { - /* Temporarily disable the warning that C90 doesn't support */ - /* `long long'. */ - - long long temp1 = (long long)ax * bx; - long long temp2 = (long long)ay * by; - + FT_Int64 c = ADD_INT64( MUL_INT64( ax, bx ), MUL_INT64( ay, by ) ); - temp1 += temp2; - temp2 = temp1 >> 63; - temp1 += 0x2000 + temp2; - return (FT_Int32)( temp1 >> 14 ); + c = ADD_INT64( c, 0x2000 + ( c >> 63 ) ); /* rounding phase */ + return (FT_F26Dot6)( c >> 14 ); } -#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406 -#pragma GCC diagnostic pop -#endif - -#endif /* __GNUC__ && (__arm__ || __i386__ || __x86_64__) */ - - -#ifndef TT_DotFix14 +#else - /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */ - static FT_Int32 - TT_DotFix14( FT_Int32 ax, - FT_Int32 ay, - FT_Int bx, - FT_Int by ) + static inline FT_F26Dot6 + TT_DotFix14( FT_F26Dot6 ax, + FT_F26Dot6 ay, + FT_F2Dot14 bx, + FT_F2Dot14 by ) { - FT_Int32 m, s, hi1, hi2, hi; + FT_Int32 m, hi1, hi2, hi; FT_UInt32 l, lo1, lo2, lo; - /* compute ax*bx as 64-bit value */ + /* compute ax*bx as 64-bit (hi_lo) value */ l = (FT_UInt32)( ( ax & 0xFFFFU ) * bx ); m = ( ax >> 16 ) * bx; @@ -1366,18 +1233,13 @@ hi = hi1 + hi2 + ( lo < lo1 ); /* divide the result by 2^14 with rounding */ - s = hi >> 31; - l = lo + (FT_UInt32)s; - hi += s + ( l < lo ); - lo = l; - - l = lo + 0x2000U; + l = lo + 0x2000U + (FT_UInt32)( hi >> 31 ); /* rounding phase */ hi += ( l < lo ); - return (FT_Int32)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) ); + return (FT_F26Dot6)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) ); } -#endif /* TT_DotFix14 */ +#endif /* !FT_INT64 */ /************************************************************************** @@ -1534,31 +1396,6 @@ /************************************************************************** * * @Function: - * GetShortIns - * - * @Description: - * Returns a short integer taken from the instruction stream at - * address IP. - * - * @Return: - * Short read at code[IP]. - * - * @Note: - * This one could become a macro. - */ - static FT_Short - GetShortIns( TT_ExecContext exc ) - { - /* Reading a byte stream so there is no endianness (DaveP) */ - exc->IP += 2; - return (FT_Short)( ( exc->code[exc->IP - 2] << 8 ) + - exc->code[exc->IP - 1] ); - } - - - /************************************************************************** - * - * @Function: * Ins_Goto_CodeRange * * @Description: @@ -1609,6 +1446,7 @@ exc->code = range->base; exc->codeSize = range->size; exc->IP = aIP; + exc->length = 0; exc->curRange = aRange; return SUCCESS; @@ -1671,48 +1509,33 @@ FT_UShort point, FT_F26Dot6 distance ) { - FT_F26Dot6 v; + FT_Fixed v; - v = exc->GS.freeVector.x; - + v = exc->moveVector.x; if ( v != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* Exception to the post-IUP curfew: Allow the x component of */ /* diagonal moves, but only post-IUP. DejaVu tries to adjust */ /* diagonal stems like on `Z' and `z' post-IUP. */ - if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x = ADD_LONG( zone->cur[point].x, - FT_MulDiv( distance, - v, - exc->F_dot_P ) ); - else + if ( !exc->backward_compatibility ) #endif - - if ( NO_SUBPIXEL_HINTING ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, - FT_MulDiv( distance, - v, - exc->F_dot_P ) ); + FT_MulFix( distance, v ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } - v = exc->GS.freeVector.y; - + v = exc->moveVector.y; if ( v != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility && - exc->iupx_called && - exc->iupy_called ) ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( exc->backward_compatibility != 0x7 ) #endif zone->cur[point].y = ADD_LONG( zone->cur[point].y, - FT_MulDiv( distance, - v, - exc->F_dot_P ) ); + FT_MulFix( distance, v ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1745,24 +1568,20 @@ FT_UShort point, FT_F26Dot6 distance ) { - FT_F26Dot6 v; + FT_Fixed v; - v = exc->GS.freeVector.x; + v = exc->moveVector.x; if ( v != 0 ) zone->org[point].x = ADD_LONG( zone->org[point].x, - FT_MulDiv( distance, - v, - exc->F_dot_P ) ); + FT_MulFix( distance, v ) ); - v = exc->GS.freeVector.y; + v = exc->moveVector.y; if ( v != 0 ) zone->org[point].y = ADD_LONG( zone->org[point].y, - FT_MulDiv( distance, - v, - exc->F_dot_P ) ); + FT_MulFix( distance, v ) ); } @@ -1784,12 +1603,8 @@ FT_F26Dot6 distance ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) - zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); - else + if ( !exc->backward_compatibility ) #endif - - if ( NO_SUBPIXEL_HINTING ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; @@ -1805,9 +1620,8 @@ FT_UNUSED( exc ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility && - exc->iupx_called && exc->iupy_called ) ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( exc->backward_compatibility != 0x7 ) #endif zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance ); @@ -1860,8 +1674,8 @@ * distance :: * The distance (not) to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * The compensated distance. @@ -1869,10 +1683,10 @@ static FT_F26Dot6 Round_None( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; + FT_UNUSED( exc ); if ( distance >= 0 ) @@ -1903,8 +1717,8 @@ * distance :: * The distance to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * Rounded distance. @@ -1912,10 +1726,10 @@ static FT_F26Dot6 Round_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; + FT_UNUSED( exc ); if ( distance >= 0 ) @@ -1948,8 +1762,8 @@ * distance :: * The distance to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * Rounded distance. @@ -1957,10 +1771,10 @@ static FT_F26Dot6 Round_To_Half_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; + FT_UNUSED( exc ); if ( distance >= 0 ) @@ -1995,8 +1809,8 @@ * distance :: * The distance to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * Rounded distance. @@ -2004,10 +1818,10 @@ static FT_F26Dot6 Round_Down_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; + FT_UNUSED( exc ); if ( distance >= 0 ) @@ -2039,8 +1853,8 @@ * distance :: * The distance to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * Rounded distance. @@ -2048,10 +1862,10 @@ static FT_F26Dot6 Round_Up_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; + FT_UNUSED( exc ); if ( distance >= 0 ) @@ -2084,8 +1898,8 @@ * distance :: * The distance to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * Rounded distance. @@ -2093,10 +1907,10 @@ static FT_F26Dot6 Round_To_Double_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; + FT_UNUSED( exc ); if ( distance >= 0 ) @@ -2129,8 +1943,8 @@ * distance :: * The distance to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * Rounded distance. @@ -2144,9 +1958,8 @@ static FT_F26Dot6 Round_Super( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; @@ -2185,8 +1998,8 @@ * distance :: * The distance to round. * - * color :: - * The engine compensation color. + * compensation :: + * The engine compensation. * * @Return: * Rounded distance. @@ -2198,9 +2011,8 @@ static FT_F26Dot6 Round_Super_45( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ) + FT_F26Dot6 compensation ) { - FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; @@ -2230,59 +2042,6 @@ /************************************************************************** * * @Function: - * Compute_Round - * - * @Description: - * Sets the rounding mode. - * - * @Input: - * round_mode :: - * The rounding mode to be used. - */ - static void - Compute_Round( TT_ExecContext exc, - FT_Byte round_mode ) - { - switch ( round_mode ) - { - case TT_Round_Off: - exc->func_round = (TT_Round_Func)Round_None; - break; - - case TT_Round_To_Grid: - exc->func_round = (TT_Round_Func)Round_To_Grid; - break; - - case TT_Round_Up_To_Grid: - exc->func_round = (TT_Round_Func)Round_Up_To_Grid; - break; - - case TT_Round_Down_To_Grid: - exc->func_round = (TT_Round_Func)Round_Down_To_Grid; - break; - - case TT_Round_To_Half_Grid: - exc->func_round = (TT_Round_Func)Round_To_Half_Grid; - break; - - case TT_Round_To_Double_Grid: - exc->func_round = (TT_Round_Func)Round_To_Double_Grid; - break; - - case TT_Round_Super: - exc->func_round = (TT_Round_Func)Round_Super; - break; - - case TT_Round_Super_45: - exc->func_round = (TT_Round_Func)Round_Super_45; - break; - } - } - - - /************************************************************************** - * - * @Function: * SetSuperRound * * @Description: @@ -2481,14 +2240,45 @@ static void Compute_Funcs( TT_ExecContext exc ) { - if ( exc->GS.freeVector.x == 0x4000 ) - exc->F_dot_P = exc->GS.projVector.x; - else if ( exc->GS.freeVector.y == 0x4000 ) - exc->F_dot_P = exc->GS.projVector.y; + FT_Long F_dot_P = + ( (FT_Long)exc->GS.projVector.x * exc->GS.freeVector.x + + (FT_Long)exc->GS.projVector.y * exc->GS.freeVector.y + + 0x2000L ) >> 14; + + + if ( F_dot_P >= 0x3FFEL ) + { + /* commonly collinear */ + exc->moveVector.x = exc->GS.freeVector.x * 4; + exc->moveVector.y = exc->GS.freeVector.y * 4; + } + else if ( -0x400L < F_dot_P && F_dot_P < 0x400L ) + { + /* prohibitively orthogonal */ + exc->moveVector.x = 0; + exc->moveVector.y = 0; + } + else + { + exc->moveVector.x = exc->GS.freeVector.x * 0x10000L / F_dot_P; + exc->moveVector.y = exc->GS.freeVector.y * 0x10000L / F_dot_P; + } + + if ( F_dot_P >= 0x3FFEL && exc->GS.freeVector.x == 0x4000 ) + { + exc->func_move = (TT_Move_Func)Direct_Move_X; + exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_X; + } + else if ( F_dot_P >= 0x3FFEL && exc->GS.freeVector.y == 0x4000 ) + { + exc->func_move = (TT_Move_Func)Direct_Move_Y; + exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y; + } else - exc->F_dot_P = - ( (FT_Long)exc->GS.projVector.x * exc->GS.freeVector.x + - (FT_Long)exc->GS.projVector.y * exc->GS.freeVector.y ) >> 14; + { + exc->func_move = (TT_Move_Func)Direct_Move; + exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig; + } if ( exc->GS.projVector.x == 0x4000 ) exc->func_project = (TT_Project_Func)Project_x; @@ -2504,29 +2294,6 @@ else exc->func_dualproj = (TT_Project_Func)Dual_Project; - exc->func_move = (TT_Move_Func)Direct_Move; - exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig; - - if ( exc->F_dot_P == 0x4000L ) - { - if ( exc->GS.freeVector.x == 0x4000 ) - { - exc->func_move = (TT_Move_Func)Direct_Move_X; - exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_X; - } - else if ( exc->GS.freeVector.y == 0x4000 ) - { - exc->func_move = (TT_Move_Func)Direct_Move_Y; - exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y; - } - } - - /* at small sizes, F_dot_P can become too small, resulting */ - /* in overflows and `spikes' in a number of glyphs like `w'. */ - - if ( FT_ABS( exc->F_dot_P ) < 0x400L ) - exc->F_dot_P = 0x4000L; - /* Disable cached aspect ratio */ exc->tt_metrics.ratio = 0; } @@ -2799,7 +2566,7 @@ Ins_ODD( TT_ExecContext exc, FT_Long* args ) { - args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 64 ); + args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 64 ) == 64 ); } @@ -2813,7 +2580,7 @@ Ins_EVEN( TT_ExecContext exc, FT_Long* args ) { - args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 0 ); + args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 64 ) == 0 ); } @@ -3020,7 +2787,7 @@ FT_MEM_QRENEW_ARRAY( exc->glyfStorage, exc->glyfStoreSize, exc->storeSize ); - exc->error = error; + exc->error = error; if ( error ) return; @@ -3143,7 +2910,8 @@ Ins_ROUND( TT_ExecContext exc, FT_Long* args ) { - args[0] = exc->func_round( exc, args[0], exc->opcode & 3 ); + args[0] = exc->func_round( exc, args[0], + exc->GS.compensation[exc->opcode & 3] ); } @@ -3157,7 +2925,8 @@ Ins_NROUND( TT_ExecContext exc, FT_Long* args ) { - args[0] = Round_None( exc, args[0], exc->opcode & 3 ); + args[0] = Round_None( exc, args[0], + exc->GS.compensation[exc->opcode & 3] ); } @@ -3211,13 +2980,11 @@ } else { - K = exc->stack[exc->args - L]; + K = args[-L]; - FT_ARRAY_MOVE( &exc->stack[exc->args - L ], - &exc->stack[exc->args - L + 1], - ( L - 1 ) ); + FT_ARRAY_MOVE( args - L, args - L + 1, L - 1 ); - exc->stack[exc->args - 1] = K; + args[-1] = K; } } @@ -3244,7 +3011,7 @@ args[0] = 0; } else - args[0] = exc->stack[exc->args - L]; + args[0] = args[-L]; } @@ -3314,8 +3081,7 @@ exc->length = 2 - exc->length * exc->code[exc->IP + 1]; } - if ( exc->IP + exc->length <= exc->codeSize ) - return SUCCESS; + return SUCCESS; } Fail_Overflow: @@ -3363,6 +3129,9 @@ nIfs--; Out = FT_BOOL( nIfs == 0 ); break; + + default: + break; } } while ( Out == 0 ); } @@ -3396,6 +3165,9 @@ case 0x59: /* EIF */ nIfs--; break; + + default: + break; } } while ( nIfs != 0 ); } @@ -3439,7 +3211,7 @@ return; } - exc->step_ins = FALSE; + exc->length = 0; if ( args[0] < 0 ) { @@ -3540,10 +3312,10 @@ return; } - rec->range = exc->curRange; - rec->opc = (FT_UInt16)n; - rec->start = exc->IP + 1; - rec->active = TRUE; + rec->range = exc->curRange; + rec->opc = (FT_UInt16)n; + rec->start = exc->IP + 1; + rec->active = TRUE; if ( n > exc->maxFunc ) exc->maxFunc = (FT_UInt16)n; @@ -3555,14 +3327,17 @@ { switch ( exc->opcode ) { - case 0x89: /* IDEF */ - case 0x2C: /* FDEF */ + case 0x89: /* IDEF */ + case 0x2C: /* FDEF */ exc->error = FT_THROW( Nested_DEFS ); return; case 0x2D: /* ENDF */ rec->end = exc->IP; return; + + default: + break; } } } @@ -3592,12 +3367,11 @@ pRec->Cur_Count--; - exc->step_ins = FALSE; - if ( pRec->Cur_Count > 0 ) { exc->callTop++; - exc->IP = pRec->Def->start; + exc->IP = pRec->Def->start; + exc->length = 0; } else /* Loop through the current function */ @@ -3685,8 +3459,6 @@ Ins_Goto_CodeRange( exc, def->range, def->start ); - exc->step_ins = FALSE; - return; Fail: @@ -3764,8 +3536,6 @@ Ins_Goto_CodeRange( exc, def->range, def->start ); - exc->step_ins = FALSE; - exc->loopcall_counter += (FT_ULong)args[0]; if ( exc->loopcall_counter > exc->loopcall_counter_max ) exc->error = FT_THROW( Execution_Too_Long ); @@ -3845,10 +3615,14 @@ case 0x2C: /* FDEF */ exc->error = FT_THROW( Nested_DEFS ); return; + case 0x2D: /* ENDF */ def->end = exc->IP; return; - } + + default: + break; + } } } @@ -3870,10 +3644,23 @@ Ins_NPUSHB( TT_ExecContext exc, FT_Long* args ) { - FT_UShort L, K; + FT_Long IP = exc->IP; + FT_Int L, K; - L = (FT_UShort)exc->code[exc->IP + 1]; + if ( ++IP >= exc->codeSize ) + { + exc->error = FT_THROW( Code_Overflow ); + return; + } + + L = exc->code[IP]; + + if ( IP + L >= exc->codeSize ) + { + exc->error = FT_THROW( Code_Overflow ); + return; + } if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) ) { @@ -3881,10 +3668,11 @@ return; } - for ( K = 1; K <= L; K++ ) - args[K - 1] = exc->code[exc->IP + K + 1]; + for ( K = 0; K < L; K++ ) + args[K] = exc->code[++IP]; exc->new_top += L; + exc->IP = IP; } @@ -3898,10 +3686,23 @@ Ins_NPUSHW( TT_ExecContext exc, FT_Long* args ) { - FT_UShort L, K; + FT_Long IP = exc->IP; + FT_Int L, K; - L = (FT_UShort)exc->code[exc->IP + 1]; + if ( ++IP >= exc->codeSize ) + { + exc->error = FT_THROW( Code_Overflow ); + return; + } + + L = exc->code[IP]; + + if ( IP + 2 * L >= exc->codeSize ) + { + exc->error = FT_THROW( Code_Overflow ); + return; + } if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) ) { @@ -3909,13 +3710,12 @@ return; } - exc->IP += 2; - - for ( K = 0; K < L; K++ ) - args[K] = GetShortIns( exc ); + /* note casting for sign-extension */ + for ( K = 0; K < L; K++, IP += 2 ) + args[K] = (FT_Short)( exc->code[IP + 1] << 8 ) | exc->code[IP + 2]; - exc->step_ins = FALSE; exc->new_top += L; + exc->IP = IP; } @@ -3929,10 +3729,17 @@ Ins_PUSHB( TT_ExecContext exc, FT_Long* args ) { - FT_UShort L, K; + FT_Long IP = exc->IP; + FT_Int L, K; - L = (FT_UShort)( exc->opcode - 0xB0 + 1 ); + L = exc->opcode - 0xB0 + 1; + + if ( IP + L >= exc->codeSize ) + { + exc->error = FT_THROW( Code_Overflow ); + return; + } if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) ) { @@ -3940,8 +3747,10 @@ return; } - for ( K = 1; K <= L; K++ ) - args[K - 1] = exc->code[exc->IP + K]; + for ( K = 0; K < L; K++ ) + args[K] = exc->code[++IP]; + + exc->IP = IP; } @@ -3955,10 +3764,17 @@ Ins_PUSHW( TT_ExecContext exc, FT_Long* args ) { - FT_UShort L, K; + FT_Long IP = exc->IP; + FT_Int L, K; + + L = exc->opcode - 0xB8 + 1; - L = (FT_UShort)( exc->opcode - 0xB8 + 1 ); + if ( IP + 2 * L >= exc->codeSize ) + { + exc->error = FT_THROW( Code_Overflow ); + return; + } if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) ) { @@ -3966,12 +3782,11 @@ return; } - exc->IP++; - - for ( K = 0; K < L; K++ ) - args[K] = GetShortIns( exc ); + /* note casting for sign-extension */ + for ( K = 0; K < L; K++, IP += 2 ) + args[K] = (FT_Short)( exc->code[IP + 1] << 8 ) | exc->code[IP + 2]; - exc->step_ins = FALSE; + exc->IP = IP; } @@ -4142,15 +3957,12 @@ Ins_SPVFS( TT_ExecContext exc, FT_Long* args ) { - FT_Short S; FT_Long X, Y; /* Only use low 16bits, then sign extend */ - S = (FT_Short)args[1]; - Y = (FT_Long)S; - S = (FT_Short)args[0]; - X = (FT_Long)S; + Y = (FT_Short)args[1]; + X = (FT_Short)args[0]; Normalize( X, Y, &exc->GS.projVector ); @@ -4169,15 +3981,12 @@ Ins_SFVFS( TT_ExecContext exc, FT_Long* args ) { - FT_Short S; FT_Long X, Y; /* Only use low 16bits, then sign extend */ - S = (FT_Short)args[1]; - Y = (FT_Long)S; - S = (FT_Short)args[0]; - X = S; + Y = (FT_Short)args[1]; + X = (FT_Short)args[0]; Normalize( X, Y, &exc->GS.freeVector ); Compute_Funcs( exc ); @@ -4915,7 +4724,7 @@ /* compatibility hacks and lets them program points to the grid like */ /* it's 1996. They might sign a waiver for just one glyph, though. */ if ( SUBPIXEL_HINTING_MINIMAL ) - exc->backward_compatibility = !FT_BOOL( L == 4 ); + exc->backward_compatibility = ( L & 4 ) ^ 4; #endif } else if ( exc->pedantic_hinting ) @@ -4999,32 +4808,31 @@ * Stack: uint32... --> */ static void - Ins_FLIPPT( TT_ExecContext exc ) + Ins_FLIPPT( TT_ExecContext exc, + FT_Long* args ) { + FT_Long loop = exc->GS.loop; FT_UShort point; -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backward compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility && - exc->iupx_called && - exc->iupy_called ) - goto Fail; -#endif - - if ( exc->top < exc->GS.loop ) + if ( exc->new_top < loop ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Too_Few_Arguments ); goto Fail; } - while ( exc->GS.loop > 0 ) - { - exc->args--; + exc->new_top -= loop; - point = (FT_UShort)exc->stack[exc->args]; +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( exc->backward_compatibility == 0x7 ) + goto Fail; +#endif + + while ( loop-- ) + { + point = (FT_UShort)*(--args); if ( BOUNDS( point, exc->pts.n_points ) ) { @@ -5036,13 +4844,10 @@ } else exc->pts.tags[point] ^= FT_CURVE_TAG_ON; - - exc->GS.loop--; } Fail: exc->GS.loop = 1; - exc->new_top = exc->args; } @@ -5061,10 +4866,7 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* See `ttinterp.h' for details on backward compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility && - exc->iupx_called && - exc->iupy_called ) + if ( exc->backward_compatibility == 0x7 ) return; #endif @@ -5099,10 +4901,7 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* See `ttinterp.h' for details on backward compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility && - exc->iupx_called && - exc->iupy_called ) + if ( exc->backward_compatibility == 0x7 ) return; #endif @@ -5158,8 +4957,8 @@ d = PROJECT( zp.cur + p, zp.org + p ); - *x = FT_MulDiv( d, (FT_Long)exc->GS.freeVector.x, exc->F_dot_P ); - *y = FT_MulDiv( d, (FT_Long)exc->GS.freeVector.y, exc->F_dot_P ); + *x = FT_MulFix( d, exc->moveVector.x ); + *y = FT_MulFix( d, exc->moveVector.y ); return SUCCESS; } @@ -5176,8 +4975,8 @@ if ( exc->GS.freeVector.x != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility ) ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( !exc->backward_compatibility ) #endif exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx ); @@ -5188,10 +4987,8 @@ if ( exc->GS.freeVector.y != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility && - exc->iupx_called && - exc->iupy_called ) ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( exc->backward_compatibility != 0x7 ) #endif exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy ); @@ -5208,8 +5005,10 @@ * Stack: uint32... --> */ static void - Ins_SHP( TT_ExecContext exc ) + Ins_SHP( TT_ExecContext exc, + FT_Long* args ) { + FT_Long loop = exc->GS.loop; TT_GlyphZoneRec zp; FT_UShort refp; @@ -5217,20 +5016,21 @@ FT_UShort point; - if ( exc->top < exc->GS.loop ) + if ( exc->new_top < loop ) { if ( exc->pedantic_hinting ) - exc->error = FT_THROW( Invalid_Reference ); + exc->error = FT_THROW( Too_Few_Arguments ); goto Fail; } + exc->new_top -= loop; + if ( Compute_Point_Displacement( exc, &dx, &dy, &zp, &refp ) ) return; - while ( exc->GS.loop > 0 ) + while ( loop-- ) { - exc->args--; - point = (FT_UShort)exc->stack[exc->args]; + point = (FT_UShort)*(--args); if ( BOUNDS( point, exc->zp2.n_points ) ) { @@ -5242,13 +5042,10 @@ } else Move_Zp2_Point( exc, point, dx, dy, TRUE ); - - exc->GS.loop--; } Fail: exc->GS.loop = 1; - exc->new_top = exc->args; } @@ -5364,6 +5161,7 @@ Ins_SHPIX( TT_ExecContext exc, FT_Long* args ) { + FT_Long loop = exc->GS.loop; FT_F26Dot6 dx, dy; FT_UShort point; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL @@ -5373,22 +5171,21 @@ #endif - - if ( exc->top < exc->GS.loop + 1 ) + if ( exc->new_top < loop ) { if ( exc->pedantic_hinting ) - exc->error = FT_THROW( Invalid_Reference ); + exc->error = FT_THROW( Too_Few_Arguments ); goto Fail; } + exc->new_top -= loop; + dx = TT_MulFix14( args[0], exc->GS.freeVector.x ); dy = TT_MulFix14( args[0], exc->GS.freeVector.y ); - while ( exc->GS.loop > 0 ) + while ( loop-- ) { - exc->args--; - - point = (FT_UShort)exc->stack[exc->args]; + point = (FT_UShort)*(--args); if ( BOUNDS( point, exc->zp2.n_points ) ) { @@ -5400,8 +5197,7 @@ } else #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility ) + if ( exc->backward_compatibility ) { /* Special case: allow SHPIX to move points in the twilight zone. */ /* Otherwise, treat SHPIX the same as DELTAP. Unbreaks various */ @@ -5409,7 +5205,7 @@ /* that would glitch severely after calling ALIGNRP after a */ /* blocked SHPIX. */ if ( in_twilight || - ( !( exc->iupx_called && exc->iupy_called ) && + ( exc->backward_compatibility != 0x7 && ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) ) ) ) Move_Zp2_Point( exc, point, 0, dy, TRUE ); @@ -5417,13 +5213,10 @@ else #endif Move_Zp2_Point( exc, point, dx, dy, TRUE ); - - exc->GS.loop--; } Fail: exc->GS.loop = 1; - exc->new_top = exc->args; } @@ -5502,7 +5295,7 @@ if ( ( exc->opcode & 1 ) != 0 ) { cur_dist = FAST_PROJECT( &exc->zp0.cur[point] ); - distance = SUB_LONG( exc->func_round( exc, cur_dist, 3 ), cur_dist ); + distance = SUB_LONG( exc->func_round( exc, cur_dist, 0 ), cur_dist ); } else distance = 0; @@ -5566,7 +5359,7 @@ if ( exc->GS.gep0 == 0 ) /* If in twilight zone */ { exc->zp0.org[point].x = TT_MulFix14( distance, - exc->GS.freeVector.x ); + exc->GS.freeVector.x ); exc->zp0.org[point].y = TT_MulFix14( distance, exc->GS.freeVector.y ); exc->zp0.cur[point] = exc->zp0.org[point]; @@ -5587,7 +5380,7 @@ if ( delta > control_value_cutin ) distance = org_dist; - distance = exc->func_round( exc, distance, 3 ); + distance = exc->func_round( exc, distance, 0 ); } exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) ); @@ -5609,7 +5402,7 @@ FT_Long* args ) { FT_UShort point = 0; - FT_F26Dot6 org_dist, distance; + FT_F26Dot6 org_dist, distance, compensation; point = (FT_UShort)args[0]; @@ -5678,12 +5471,12 @@ /* round flag */ + compensation = exc->GS.compensation[exc->opcode & 3]; + if ( ( exc->opcode & 4 ) != 0 ) - { - distance = exc->func_round( exc, org_dist, exc->opcode & 3 ); - } + distance = exc->func_round( exc, org_dist, compensation ); else - distance = Round_None( exc, org_dist, exc->opcode & 3 ); + distance = Round_None( exc, org_dist, compensation ); /* minimum distance flag */ @@ -5735,7 +5528,8 @@ FT_F26Dot6 cvt_dist, distance, cur_dist, - org_dist; + org_dist, + compensation; FT_F26Dot6 delta; @@ -5801,6 +5595,8 @@ /* control value cut-in and round */ + compensation = exc->GS.compensation[exc->opcode & 3]; + if ( ( exc->opcode & 4 ) != 0 ) { /* XXX: UNDOCUMENTED! Only perform cut-in test when both points */ @@ -5831,16 +5627,16 @@ cvt_dist = org_dist; } - distance = exc->func_round( exc, cvt_dist, exc->opcode & 3 ); + distance = exc->func_round( exc, cvt_dist, compensation ); } else - distance = Round_None( exc, cvt_dist, exc->opcode & 3 ); + distance = Round_None( exc, cvt_dist, compensation ); /* minimum distance test */ if ( ( exc->opcode & 8 ) != 0 ) { - FT_F26Dot6 minimum_distance = exc->GS.minimum_distance; + FT_F26Dot6 minimum_distance = exc->GS.minimum_distance; if ( org_dist >= 0 ) @@ -5862,11 +5658,10 @@ Fail: exc->GS.rp1 = exc->GS.rp0; + exc->GS.rp2 = point; if ( ( exc->opcode & 16 ) != 0 ) exc->GS.rp0 = point; - - exc->GS.rp2 = point; } @@ -5877,25 +5672,33 @@ * Stack: uint32 uint32... --> */ static void - Ins_ALIGNRP( TT_ExecContext exc ) + Ins_ALIGNRP( TT_ExecContext exc, + FT_Long* args ) { + FT_Long loop = exc->GS.loop; FT_UShort point; FT_F26Dot6 distance; - if ( exc->top < exc->GS.loop || - BOUNDS( exc->GS.rp0, exc->zp0.n_points ) ) + if ( exc->new_top < loop ) { if ( exc->pedantic_hinting ) - exc->error = FT_THROW( Invalid_Reference ); + exc->error = FT_THROW( Too_Few_Arguments ); goto Fail; } - while ( exc->GS.loop > 0 ) + exc->new_top -= loop; + + if ( BOUNDS( exc->GS.rp0, exc->zp0.n_points ) ) { - exc->args--; + if ( exc->pedantic_hinting ) + exc->error = FT_THROW( Invalid_Reference ); + goto Fail; + } - point = (FT_UShort)exc->stack[exc->args]; + while ( loop-- ) + { + point = (FT_UShort)*(--args); if ( BOUNDS( point, exc->zp1.n_points ) ) { @@ -5912,13 +5715,10 @@ exc->func_move( exc, &exc->zp1, point, NEG_LONG( distance ) ); } - - exc->GS.loop--; } Fail: exc->GS.loop = 1; - exc->new_top = exc->args; } @@ -6060,15 +5860,26 @@ /* SOMETIMES, DUMBER CODE IS BETTER CODE */ static void - Ins_IP( TT_ExecContext exc ) + Ins_IP( TT_ExecContext exc, + FT_Long* args ) { + FT_Long loop = exc->GS.loop; FT_F26Dot6 old_range, cur_range; FT_Vector* orus_base; FT_Vector* cur_base; FT_Int twilight; - if ( exc->top < exc->GS.loop ) + if ( exc->new_top < loop ) + { + if ( exc->pedantic_hinting ) + exc->error = FT_THROW( Too_Few_Arguments ); + goto Fail; + } + + exc->new_top -= loop; + + if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); @@ -6084,13 +5895,6 @@ exc->GS.gep1 == 0 || exc->GS.gep2 == 0 ); - if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) ) - { - if ( exc->pedantic_hinting ) - exc->error = FT_THROW( Invalid_Reference ); - goto Fail; - } - if ( twilight ) orus_base = &exc->zp0.org[exc->GS.rp1]; else @@ -6102,8 +5906,7 @@ /* fonts out there (e.g. [aeu]grave in monotype.ttf) */ /* calling IP[] with bad values of rp[12]. */ /* Do something sane when this odd thing happens. */ - if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) || - BOUNDS( exc->GS.rp2, exc->zp1.n_points ) ) + if ( BOUNDS( exc->GS.rp2, exc->zp1.n_points ) ) { old_range = 0; cur_range = 0; @@ -6132,9 +5935,9 @@ cur_range = PROJECT( &exc->zp1.cur[exc->GS.rp2], cur_base ); } - for ( ; exc->GS.loop > 0; exc->GS.loop-- ) + while ( loop-- ) { - FT_UInt point = (FT_UInt)exc->stack[--exc->args]; + FT_UInt point = (FT_UInt)*(--args); FT_F26Dot6 org_dist, cur_dist, new_dist; @@ -6206,7 +6009,6 @@ Fail: exc->GS.loop = 1; - exc->new_top = exc->args; } @@ -6405,17 +6207,10 @@ /* See `ttinterp.h' for details on backward compatibility mode. */ /* Allow IUP until it has been called on both axes. Immediately */ /* return on subsequent ones. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility ) - { - if ( exc->iupx_called && exc->iupy_called ) - return; - - if ( exc->opcode & 1 ) - exc->iupx_called = TRUE; - else - exc->iupy_called = TRUE; - } + if ( exc->backward_compatibility == 0x7 ) + return; + else if ( exc->backward_compatibility ) + exc->backward_compatibility |= 1 << ( exc->opcode & 1 ); #endif /* ignore empty outlines */ @@ -6507,30 +6302,50 @@ Ins_DELTAP( TT_ExecContext exc, FT_Long* args ) { - FT_ULong nump, k; + FT_Long nump; FT_UShort A; - FT_ULong C, P; - FT_Long B; + FT_Long B, P, F; - P = (FT_ULong)exc->func_cur_ppem( exc ); - nump = (FT_ULong)args[0]; /* some points theoretically may occur more - than once, thus UShort isn't enough */ + nump = args[0]; /* signed value for convenience */ - for ( k = 1; k <= nump; k++ ) + if ( nump < 0 || nump > exc->new_top / 2 ) { - if ( exc->args < 2 ) - { - if ( exc->pedantic_hinting ) - exc->error = FT_THROW( Too_Few_Arguments ); - exc->args = 0; - goto Fail; - } + if ( exc->pedantic_hinting ) + exc->error = FT_THROW( Too_Few_Arguments ); + + nump = exc->new_top / 2; + } + + exc->new_top -= 2 * nump; + + P = exc->func_cur_ppem( exc ) - exc->GS.delta_base; + + switch ( exc->opcode ) + { + case 0x5D: + break; - exc->args -= 2; + case 0x71: + P -= 16; + break; + + case 0x72: + P -= 32; + break; + } + + /* check applicable range of adjusted ppem */ + if ( P & ~0xF ) /* P < 0 || P > 15 */ + return; - A = (FT_UShort)exc->stack[exc->args + 1]; - B = exc->stack[exc->args]; + P <<= 4; + F = 1L << ( 6 - exc->GS.delta_shift ); + + while ( nump-- ) + { + A = (FT_UShort)*(--args); + B = *(--args); /* XXX: Because some popular fonts contain some invalid DeltaP */ /* instructions, we simply ignore them when the stacked */ @@ -6538,41 +6353,28 @@ /* error. As a delta instruction doesn't change a glyph */ /* in great ways, this shouldn't be a problem. */ - if ( !BOUNDS( A, exc->zp0.n_points ) ) + if ( BOUNDS( A, exc->zp0.n_points ) ) { - C = ( (FT_ULong)B & 0xF0 ) >> 4; - - switch ( exc->opcode ) + if ( exc->pedantic_hinting ) { - case 0x5D: - break; - - case 0x71: - C += 16; - break; - - case 0x72: - C += 32; - break; + exc->error = FT_THROW( Invalid_Reference ); + return; } - - C += exc->GS.delta_base; - - if ( P == C ) + } + else + { + if ( ( B & 0xF0 ) == P ) { - B = ( (FT_ULong)B & 0xF ) - 8; + B = ( B & 0xF ) - 8; if ( B >= 0 ) B++; - B *= 1L << ( 6 - exc->GS.delta_shift ); - + B *= F; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backward compatibility */ - /* mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backward_compatibility ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( exc->backward_compatibility ) { - if ( !( exc->iupx_called && exc->iupy_called ) && + if ( exc->backward_compatibility != 0x7 && ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) ) ) exc->func_move( exc, &exc->zp0, A, B ); @@ -6582,13 +6384,7 @@ exc->func_move( exc, &exc->zp0, A, B ); } } - else - if ( exc->pedantic_hinting ) - exc->error = FT_THROW( Invalid_Reference ); } - - Fail: - exc->new_top = exc->args; } @@ -6602,28 +6398,50 @@ Ins_DELTAC( TT_ExecContext exc, FT_Long* args ) { - FT_ULong nump, k; - FT_ULong A, C, P; - FT_Long B; + FT_Long nump; + FT_ULong A; + FT_Long B, P, F; - P = (FT_ULong)exc->func_cur_ppem( exc ); - nump = (FT_ULong)args[0]; + nump = args[0]; /* signed value for convenience */ - for ( k = 1; k <= nump; k++ ) + if ( nump < 0 || nump > exc->new_top / 2 ) { - if ( exc->args < 2 ) - { - if ( exc->pedantic_hinting ) - exc->error = FT_THROW( Too_Few_Arguments ); - exc->args = 0; - goto Fail; - } + if ( exc->pedantic_hinting ) + exc->error = FT_THROW( Too_Few_Arguments ); + + nump = exc->new_top / 2; + } + + exc->new_top -= 2 * nump; + + P = exc->func_cur_ppem( exc ) - exc->GS.delta_base; + + switch ( exc->opcode ) + { + case 0x73: + break; + + case 0x74: + P -= 16; + break; + + case 0x75: + P -= 32; + break; + } - exc->args -= 2; + /* check applicable range of adjusted ppem */ + if ( P & ~0xF ) /* P < 0 || P > 15 */ + return; - A = (FT_ULong)exc->stack[exc->args + 1]; - B = exc->stack[exc->args]; + P <<= 4; + F = 1L << ( 6 - exc->GS.delta_shift ); + + while ( nump-- ) + { + A = (FT_ULong)*(--args); + B = *(--args); if ( BOUNDSL( A, exc->cvtSize ) ) { @@ -6635,38 +6453,17 @@ } else { - C = ( (FT_ULong)B & 0xF0 ) >> 4; - - switch ( exc->opcode ) - { - case 0x73: - break; - - case 0x74: - C += 16; - break; - - case 0x75: - C += 32; - break; - } - - C += exc->GS.delta_base; - - if ( P == C ) + if ( ( B & 0xF0 ) == P ) { - B = ( (FT_ULong)B & 0xF ) - 8; + B = ( B & 0xF ) - 8; if ( B >= 0 ) B++; - B *= 1L << ( 6 - exc->GS.delta_shift ); + B *= F; exc->func_move_cvt( exc, A, B ); } } } - - Fail: - exc->new_top = exc->args; } @@ -6736,7 +6533,7 @@ /* Otherwise, instructions may behave weirdly and rendering results */ /* may differ between v35 and v40 mode, e.g., in `Times New Roman */ /* Bold Italic'. */ - if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean ) + if ( SUBPIXEL_HINTING_MINIMAL && exc->mode != FT_RENDER_MODE_MONO ) { /********************************* * HINTING FOR SUBPIXEL @@ -6753,7 +6550,7 @@ * Selector Bit: 8 * Return Bit(s): 15 */ - if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd_lean ) + if ( ( args[0] & 256 ) != 0 && exc->mode == FT_RENDER_MODE_LCD_V ) K |= 1 << 15; /********************************* @@ -6774,7 +6571,7 @@ * The only smoothing method FreeType supports unless someone sets * FT_LOAD_TARGET_MONO. */ - if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean ) + if ( ( args[0] & 2048 ) != 0 && exc->mode != FT_RENDER_MODE_MONO ) K |= 1 << 18; /********************************* @@ -6786,7 +6583,10 @@ * Grayscale rendering is what FreeType does anyway unless someone * sets FT_LOAD_TARGET_MONO or FT_LOAD_TARGET_LCD(_V) */ - if ( ( args[0] & 4096 ) != 0 && exc->grayscale_cleartype ) + if ( ( args[0] & 4096 ) != 0 && + exc->mode != FT_RENDER_MODE_MONO && + exc->mode != FT_RENDER_MODE_LCD && + exc->mode != FT_RENDER_MODE_LCD_V ) K |= 1 << 19; } #endif @@ -6833,6 +6633,8 @@ for ( i = 0; i < num_axes; i++ ) args[i] = 0; } + + exc->new_top += num_axes; } @@ -6883,7 +6685,6 @@ Ins_Goto_CodeRange( exc, def->range, def->start ); - exc->step_ins = FALSE; return; } } @@ -6928,96 +6729,22 @@ TT_RunIns( void* exec ) { TT_ExecContext exc = (TT_ExecContext)exec; - - FT_ULong ins_counter = 0; /* executed instructions counter */ - FT_ULong num_twilight_points; - FT_UShort i; + FT_ULong ins_counter = 0; - /* We restrict the number of twilight points to a reasonable, */ - /* heuristic value to avoid slow execution of malformed bytecode. */ - num_twilight_points = FT_MAX( 30, - 2 * ( exc->pts.n_points + exc->cvtSize ) ); - if ( exc->twilight.n_points > num_twilight_points ) - { - if ( num_twilight_points > 0xFFFFU ) - num_twilight_points = 0xFFFFU; - - FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n" )); - FT_TRACE5(( " from %d to the more reasonable value %ld\n", - exc->twilight.n_points, - num_twilight_points )); - exc->twilight.n_points = (FT_UShort)num_twilight_points; - } - - /* Set up loop detectors. We restrict the number of LOOPCALL loops */ - /* and the number of JMPR, JROT, and JROF calls with a negative */ - /* argument to values that depend on various parameters like the */ - /* size of the CVT table or the number of points in the current */ - /* glyph (if applicable). */ - /* */ - /* The idea is that in real-world bytecode you either iterate over */ - /* all CVT entries (in the `prep' table), or over all points (or */ - /* contours, in the `glyf' table) of a glyph, and such iterations */ - /* don't happen very often. */ - exc->loopcall_counter = 0; - exc->neg_jump_counter = 0; - - /* The maximum values are heuristic. */ - if ( exc->pts.n_points ) - exc->loopcall_counter_max = FT_MAX( 50, - 10 * exc->pts.n_points ) + - FT_MAX( 50, - exc->cvtSize / 10 ); - else - exc->loopcall_counter_max = 300 + 22 * exc->cvtSize; - - /* as a protection against an unreasonable number of CVT entries */ - /* we assume at most 100 control values per glyph for the counter */ - if ( exc->loopcall_counter_max > - 100 * (FT_ULong)exc->face->root.num_glyphs ) - exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs; - - FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL" - " to %ld\n", exc->loopcall_counter_max )); - - exc->neg_jump_counter_max = exc->loopcall_counter_max; - FT_TRACE5(( "TT_RunIns: Limiting total number of backward jumps" - " to %ld\n", exc->neg_jump_counter_max )); - - /* set PPEM and CVT functions */ - exc->tt_metrics.ratio = 0; - if ( exc->metrics.x_ppem != exc->metrics.y_ppem ) - { - /* non-square pixels, use the stretched routines */ - exc->func_cur_ppem = Current_Ppem_Stretched; - exc->func_read_cvt = Read_CVT_Stretched; - exc->func_write_cvt = Write_CVT_Stretched; - exc->func_move_cvt = Move_CVT_Stretched; - } - else - { - /* square pixels, use normal routines */ - exc->func_cur_ppem = Current_Ppem; - exc->func_read_cvt = Read_CVT; - exc->func_write_cvt = Write_CVT; - exc->func_move_cvt = Move_CVT; - } - - exc->iniRange = exc->curRange; - - Compute_Funcs( exc ); - Compute_Round( exc, (FT_Byte)exc->GS.round_state ); - - /* These flags cancel execution of some opcodes after IUP is called */ -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - exc->iupx_called = FALSE; - exc->iupy_called = FALSE; -#endif - do { + /* increment instruction counter and check if we didn't */ + /* run this program for too long (e.g. infinite loops). */ + if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES ) + { + exc->error = FT_THROW( Execution_Too_Long ); + goto LErrorLabel_; + } + + exc->error = FT_Err_Ok; exc->opcode = exc->code[exc->IP]; + exc->length = 1; #ifdef FT_DEBUG_LEVEL_TRACE if ( ft_trace_levels[trace_ttinterp] >= 6 ) @@ -7041,17 +6768,6 @@ } #endif /* FT_DEBUG_LEVEL_TRACE */ - if ( ( exc->length = opcode_length[exc->opcode] ) < 0 ) - { - if ( exc->IP + 1 >= exc->codeSize ) - goto LErrorCodeOverflow_; - - exc->length = 2 - exc->length * exc->code[exc->IP + 1]; - } - - if ( exc->IP + exc->length > exc->codeSize ) - goto LErrorCodeOverflow_; - /* First, let's check for empty stack and overflow */ exc->args = exc->top - ( Pop_Push_Count[exc->opcode] >> 4 ); @@ -7059,6 +6775,9 @@ /* One can also interpret it as the index of the last argument. */ if ( exc->args < 0 ) { + FT_UShort i; + + if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Too_Few_Arguments ); @@ -7071,21 +6790,7 @@ exc->args = 0; } -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( exc->opcode == 0x91 ) - { - /* this is very special: GETVARIATION returns */ - /* a variable number of arguments */ - - /* it is the job of the application to `activate' GX handling, */ - /* that is, calling any of the GX API functions on the current */ - /* font to select a variation instance */ - if ( exc->face->blend ) - exc->new_top = exc->args + exc->face->blend->num_axis; - } - else -#endif - exc->new_top = exc->args + ( Pop_Push_Count[exc->opcode] & 15 ); + exc->new_top = exc->args + ( Pop_Push_Count[exc->opcode] & 15 ); /* `new_top' is the new top of the stack, after the instruction's */ /* execution. `top' will be set to `new_top' after the `switch' */ @@ -7096,9 +6801,6 @@ goto LErrorLabel_; } - exc->step_ins = TRUE; - exc->error = FT_Err_Ok; - { FT_Long* args = exc->stack + exc->args; FT_Byte opcode = exc->opcode; @@ -7281,7 +6983,7 @@ case 0x32: /* SHP */ case 0x33: /* SHP */ - Ins_SHP( exc ); + Ins_SHP( exc, args ); break; case 0x34: /* SHC */ @@ -7299,7 +7001,7 @@ break; case 0x39: /* IP */ - Ins_IP( exc ); + Ins_IP( exc, args ); break; case 0x3A: /* MSIRP */ @@ -7308,7 +7010,7 @@ break; case 0x3C: /* AlignRP */ - Ins_ALIGNRP( exc ); + Ins_ALIGNRP( exc, args ); break; case 0x3D: /* RTDG */ @@ -7544,7 +7246,7 @@ break; case 0x80: /* FLIPPT */ - Ins_FLIPPT( exc ); + Ins_FLIPPT( exc, args ); break; case 0x81: /* FLIPRGON */ @@ -7642,13 +7344,13 @@ { switch ( exc->error ) { - /* looking for redefined instructions */ case FT_ERR( Invalid_Opcode ): { TT_DefRecord* def = exc->IDefs; TT_DefRecord* limit = FT_OFFSET( def, exc->numIDefs ); + /* looking for redefined instructions */ for ( ; def < limit; def++ ) { if ( def->active && exc->opcode == (FT_Byte)def->opc ) @@ -7678,37 +7380,15 @@ } } } - - exc->error = FT_THROW( Invalid_Opcode ); - goto LErrorLabel_; - -#if 0 - break; /* Unreachable code warning suppression. */ - /* Leave to remind in case a later change the editor */ - /* to consider break; */ -#endif + FALL_THROUGH; default: goto LErrorLabel_; - -#if 0 - break; -#endif } } exc->top = exc->new_top; - - if ( exc->step_ins ) - exc->IP += exc->length; - - /* increment instruction counter and check if we didn't */ - /* run this program for too long (e.g. infinite loops). */ - if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES ) - { - exc->error = FT_THROW( Execution_Too_Long ); - goto LErrorLabel_; - } + exc->IP += exc->length; LSuiteLabel_: if ( exc->IP >= exc->codeSize ) @@ -7724,15 +7404,12 @@ } while ( !exc->instruction_trap ); LNo_Error_: - FT_TRACE4(( " %ld instruction%s executed\n", + FT_TRACE4(( " %lu instruction%s executed\n", ins_counter, ins_counter == 1 ? "" : "s" )); return FT_Err_Ok; - LErrorCodeOverflow_: - exc->error = FT_THROW( Code_Overflow ); - LErrorLabel_: if ( exc->error && !exc->instruction_trap ) FT_TRACE1(( " The interpreter returned error 0x%x\n", exc->error )); @@ -7740,6 +7417,126 @@ return exc->error; } + + /************************************************************************** + * + * @Function: + * TT_Run_Context + * + * @Description: + * Executes one or more instructions in the execution context. + * + * @Input: + * exec :: + * A handle to the target execution context. + * + * @Return: + * TrueType error code. 0 means success. + */ + FT_LOCAL_DEF( FT_Error ) + TT_Run_Context( TT_ExecContext exec, + TT_Size size ) + { + FT_ULong num_twilight_points; + + + exec->zp0 = exec->pts; + exec->zp1 = exec->pts; + exec->zp2 = exec->pts; + + /* We restrict the number of twilight points to a reasonable, */ + /* heuristic value to avoid slow execution of malformed bytecode. */ + /* The selected value is large enough to support fonts hinted */ + /* with `ttfautohint`, which uses twilight points to store */ + /* vertical coordinates of (auto-hinter) segments. */ + num_twilight_points = FT_MAX( 30, + 2 * ( exec->pts.n_points + exec->cvtSize ) ); + if ( exec->twilight.n_points > num_twilight_points ) + { + if ( num_twilight_points > 0xFFFFU ) + num_twilight_points = 0xFFFFU; + + FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n" )); + FT_TRACE5(( " from %d to the more reasonable value %lu\n", + exec->twilight.n_points, + num_twilight_points )); + exec->twilight.n_points = (FT_UShort)num_twilight_points; + } + + /* Set up loop detectors. We restrict the number of LOOPCALL loops */ + /* and the number of JMPR, JROT, and JROF calls with a negative */ + /* argument to values that depend on various parameters like the */ + /* size of the CVT table or the number of points in the current */ + /* glyph (if applicable). */ + /* */ + /* The idea is that in real-world bytecode you either iterate over */ + /* all CVT entries (in the `prep' table), or over all points (or */ + /* contours, in the `glyf' table) of a glyph, and such iterations */ + /* don't happen very often. */ + exec->loopcall_counter = 0; + exec->neg_jump_counter = 0; + + /* The maximum values are heuristic. */ + if ( exec->pts.n_points ) + exec->loopcall_counter_max = FT_MAX( 50, + 10 * exec->pts.n_points ) + + FT_MAX( 50, + exec->cvtSize / 10 ); + else + exec->loopcall_counter_max = 300 + 22 * exec->cvtSize; + + /* as a protection against an unreasonable number of CVT entries */ + /* we assume at most 100 control values per glyph for the counter */ + if ( exec->loopcall_counter_max > + 100 * (FT_ULong)exec->face->root.num_glyphs ) + exec->loopcall_counter_max = 100 * (FT_ULong)exec->face->root.num_glyphs; + + FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL" + " to %lu\n", exec->loopcall_counter_max )); + + exec->neg_jump_counter_max = exec->loopcall_counter_max; + FT_TRACE5(( "TT_RunIns: Limiting total number of backward jumps" + " to %lu\n", exec->neg_jump_counter_max )); + + /* set PPEM and CVT functions */ + if ( exec->metrics.x_ppem != exec->metrics.y_ppem ) + { + /* non-square pixels, use the stretched routines */ + exec->func_cur_ppem = Current_Ppem_Stretched; + exec->func_read_cvt = Read_CVT_Stretched; + exec->func_write_cvt = Write_CVT_Stretched; + exec->func_move_cvt = Move_CVT_Stretched; + } + else + { + /* square pixels, use normal routines */ + exec->func_cur_ppem = Current_Ppem; + exec->func_read_cvt = Read_CVT; + exec->func_write_cvt = Write_CVT; + exec->func_move_cvt = Move_CVT; + } + + /* reset graphics state */ + exec->GS = size->GS; + exec->func_round = (TT_Round_Func)Round_To_Grid; + Compute_Funcs( exec ); + +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL + /* Reset IUP tracking bits in the backward compatibility mode. */ + /* See `ttinterp.h' for details. */ + exec->backward_compatibility &= ~0x3; +#endif + + /* some glyphs leave something on the stack, */ + /* so we clean it before a new execution. */ + exec->top = 0; + exec->callTop = 0; + + exec->instruction_trap = FALSE; + + return exec->interpreter( exec ); + } + #else /* !TT_USE_BYTECODE_INTERPRETER */ /* ANSI C doesn't like empty source files */ diff --git a/modules/freetype2/src/truetype/ttinterp.h b/modules/freetype2/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -41,6 +41,60 @@ FT_BEGIN_HEADER /************************************************************************** * + * EXECUTION SUBTABLES + * + * These sub-tables relate to instruction execution. + * + */ + + +#define TT_MAX_CODE_RANGES 3 + + + /************************************************************************** + * + * There can only be 3 active code ranges at once: + * - the Font Program + * - the CVT Program + * - a glyph's instructions set + */ + typedef enum TT_CodeRange_Tag_ + { + tt_coderange_none = 0, + tt_coderange_font, + tt_coderange_cvt, + tt_coderange_glyph + + } TT_CodeRange_Tag; + + + typedef struct TT_CodeRange_ + { + FT_Byte* base; + FT_Long size; + + } TT_CodeRange; + + typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES]; + + + /************************************************************************** + * + * Defines a function/instruction definition record. + */ + typedef struct TT_DefRecord_ + { + FT_Int range; /* in which code range is it located? */ + FT_Long start; /* where does it start? */ + FT_Long end; /* where does it end? */ + FT_UInt opc; /* function #, or instruction code */ + FT_Bool active; /* is it active? */ + + } TT_DefRecord, *TT_DefArray; + + + /************************************************************************** + * * Function types used by the interpreter, depending on various modes * (e.g. the rounding mode, whether to render a vertical or horizontal * line etc). @@ -51,7 +105,7 @@ FT_BEGIN_HEADER typedef FT_F26Dot6 (*TT_Round_Func)( TT_ExecContext exc, FT_F26Dot6 distance, - FT_Int color ); + FT_F26Dot6 compensation ); /* Point displacement along the freedom vector routine */ typedef void @@ -111,12 +165,13 @@ FT_BEGIN_HEADER TT_Face face; /* ! */ TT_Size size; /* ! */ FT_Memory memory; + TT_Interpreter interpreter; /* instructions state */ FT_Error error; /* last execution error */ - FT_Long top; /* @ top of exec. stack */ + FT_Long top; /* @! top of exec. stack */ FT_Long stackSize; /* ! size of exec. stack */ FT_Long* stack; /* ! current exec. stack */ @@ -142,11 +197,9 @@ FT_BEGIN_HEADER FT_Long IP; /* current instruction pointer */ FT_Long codeSize; /* size of current range */ - FT_Byte opcode; /* current opcode */ - FT_Int length; /* length of current opcode */ + FT_Byte opcode; /* current opcode */ + FT_Int length; /* opcode length or increment */ - FT_Bool step_ins; /* true if the interpreter must */ - /* increment IP after ins. exec */ FT_ULong cvtSize; /* ! */ FT_Long* cvt; /* ! */ FT_ULong glyfCvtSize; @@ -166,9 +219,9 @@ FT_BEGIN_HEADER FT_UInt maxFunc; /* ! maximum function index */ FT_UInt maxIns; /* ! maximum instruction index */ - FT_Int callTop, /* @ top of call stack during execution */ - callSize; /* size of call stack */ - TT_CallStack callStack; /* call stack */ + FT_Int callTop, /* @! top of call stack during execution */ + callSize; /* size of call stack */ + TT_CallStack callStack; /* call stack */ FT_UShort maxPoints; /* capacity of this context's `pts' */ FT_Short maxContours; /* record, expressed in points and */ @@ -189,16 +242,14 @@ FT_BEGIN_HEADER FT_Bool instruction_trap; /* ! If `True', the interpreter */ /* exits after each instruction */ - TT_GraphicsState default_GS; /* graphics state resulting from */ - /* the prep program */ FT_Bool is_composite; /* true if the glyph is composite */ FT_Bool pedantic_hinting; /* true if pedantic interpretation */ /* latest interpreter additions */ - FT_Long F_dot_P; /* dot product of freedom and projection */ - /* vectors */ - TT_Round_Func func_round; /* current rounding function */ + TT_Round_Func func_round; /* current rounding function */ + + FT_Vector moveVector; /* "projected" freedom vector */ TT_Project_Func func_project, /* current projection function */ func_dualproj, /* current dual proj. function */ @@ -327,34 +378,13 @@ FT_BEGIN_HEADER * */ - /* Using v40 implies subpixel hinting, unless FT_RENDER_MODE_MONO has been - * requested. Used to detect interpreter */ - /* version switches. `_lean' to differentiate from the Infinality */ - /* `subpixel_hinting', which is managed differently. */ - FT_Bool subpixel_hinting_lean; - - /* Long side of a LCD subpixel is vertical (e.g., screen is rotated). */ - /* `_lean' to differentiate from the Infinality `vertical_lcd', which */ - /* is managed differently. */ - FT_Bool vertical_lcd_lean; - - /* Default to backward compatibility mode in v40 interpreter. If */ - /* this is false, it implies the interpreter is in v35 or in native */ - /* ClearType mode. */ - FT_Bool backward_compatibility; - - /* Useful for detecting and denying post-IUP trickery that is usually */ - /* used to fix pixel patterns (`superhinting'). */ - FT_Bool iupx_called; - FT_Bool iupy_called; - - /* ClearType hinting and grayscale rendering, as used by Universal */ - /* Windows Platform apps (Windows 8 and above). Like the standard */ - /* colorful ClearType mode, it utilizes a vastly increased virtual */ - /* resolution on the x axis. Different from bi-level hinting and */ - /* grayscale rendering, the old mode from Win9x days that roughly */ - /* adheres to the physical pixel grid on both axes. */ - FT_Bool grayscale_cleartype; + /* Activate backward compatibility (bit 2) and track IUP (bits 0-1). */ + /* If this is zero, it means that the interpreter is either in v35 */ + /* or in native ClearType mode. */ + FT_Int backward_compatibility; + + FT_Render_Mode mode; /* target render mode */ + #endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */ /* We maintain two counters (in addition to the instruction counter) */ @@ -371,22 +401,15 @@ FT_BEGIN_HEADER extern const TT_GraphicsState tt_default_graphics_state; -#ifdef TT_USE_BYTECODE_INTERPRETER - FT_LOCAL( void ) - TT_Goto_CodeRange( TT_ExecContext exec, - FT_Int range, - FT_Long IP ); - FT_LOCAL( void ) TT_Set_CodeRange( TT_ExecContext exec, FT_Int range, - void* base, + FT_Byte* base, FT_Long length ); FT_LOCAL( void ) TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ); -#endif /* TT_USE_BYTECODE_INTERPRETER */ /************************************************************************** @@ -413,7 +436,6 @@ FT_BEGIN_HEADER TT_New_Context( TT_Driver driver ); -#ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( void ) TT_Done_Context( TT_ExecContext exec ); @@ -424,11 +446,11 @@ FT_BEGIN_HEADER FT_LOCAL( void ) TT_Save_Context( TT_ExecContext exec, - TT_Size ins ); + TT_Size size ); FT_LOCAL( FT_Error ) - TT_Run_Context( TT_ExecContext exec ); -#endif /* TT_USE_BYTECODE_INTERPRETER */ + TT_Run_Context( TT_ExecContext exec, + TT_Size size ); /************************************************************************** diff --git a/modules/freetype2/src/truetype/ttobjs.c b/modules/freetype2/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ * * Objects manager (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -67,23 +67,13 @@ * A pointer to the target glyph zone. */ FT_LOCAL_DEF( void ) - tt_glyphzone_done( TT_GlyphZone zone ) + tt_glyphzone_done( FT_Memory memory, + TT_GlyphZone zone ) { - FT_Memory memory = zone->memory; + FT_FREE( zone->org ); - - if ( memory ) - { - FT_FREE( zone->contours ); - FT_FREE( zone->tags ); - FT_FREE( zone->cur ); - FT_FREE( zone->org ); - FT_FREE( zone->orus ); - - zone->max_points = zone->n_points = 0; - zone->max_contours = zone->n_contours = 0; - zone->memory = NULL; - } + zone->n_points = 0; + zone->n_contours = 0; } @@ -119,23 +109,22 @@ TT_GlyphZone zone ) { FT_Error error; + FT_Long size = 3 * maxPoints * sizeof ( FT_Vector ) + + maxContours * sizeof ( FT_UShort ) + + maxPoints * sizeof ( FT_Byte ); - FT_ZERO( zone ); - zone->memory = memory; - - if ( FT_NEW_ARRAY( zone->org, maxPoints ) || - FT_NEW_ARRAY( zone->cur, maxPoints ) || - FT_NEW_ARRAY( zone->orus, maxPoints ) || - FT_NEW_ARRAY( zone->tags, maxPoints ) || - FT_NEW_ARRAY( zone->contours, maxContours ) ) + if ( !FT_ALLOC( zone->org, size ) ) { - tt_glyphzone_done( zone ); - } - else - { - zone->max_points = maxPoints; - zone->max_contours = maxContours; + zone->n_points = maxPoints; + zone->n_contours = maxContours; + + zone->cur = zone->org + maxPoints; + zone->orus = zone->cur + maxPoints; + zone->contours = (FT_UShort*)( zone->orus + maxPoints ); + zone->tags = (FT_Byte*)( zone->contours + maxContours ); + + zone->first_point = 0; } return error; @@ -488,8 +477,7 @@ int j, k; - FT_MEM_SET( num_matched_ids, 0, - sizeof ( int ) * TRICK_SFNT_IDS_NUM_FACES ); + FT_ARRAY_ZERO( num_matched_ids, TRICK_SFNT_IDS_NUM_FACES ); has_cvt = FALSE; has_fpgm = FALSE; has_prep = FALSE; @@ -787,7 +775,7 @@ FT_UInt instance_index = (FT_UInt)face_index >> 16; - if ( FT_HAS_MULTIPLE_MASTERS( ttface ) ) + if ( instance_index && FT_HAS_MULTIPLE_MASTERS( ttface ) ) { error = FT_Set_Named_Instance( ttface, instance_index ); if ( error ) @@ -885,75 +873,40 @@ * size :: * A handle to the size object. * - * pedantic :: - * Set if bytecode execution should be pedantic. - * * @Return: * FreeType error code. 0 means success. */ FT_LOCAL_DEF( FT_Error ) - tt_size_run_fpgm( TT_Size size, - FT_Bool pedantic ) + tt_size_run_fpgm( TT_Size size ) { TT_Face face = (TT_Face)size->root.face; - TT_ExecContext exec; + TT_ExecContext exec = size->context; FT_Error error; - exec = size->context; - error = TT_Load_Context( exec, face, size ); if ( error ) return error; - exec->callTop = 0; - exec->top = 0; - - exec->period = 64; - exec->phase = 0; - exec->threshold = 0; - - exec->instruction_trap = FALSE; - exec->F_dot_P = 0x4000L; - - exec->pedantic_hinting = pedantic; - - { - FT_Size_Metrics* size_metrics = &exec->metrics; - TT_Size_Metrics* tt_metrics = &exec->tt_metrics; - - - size_metrics->x_ppem = 0; - size_metrics->y_ppem = 0; - size_metrics->x_scale = 0; - size_metrics->y_scale = 0; - - tt_metrics->ppem = 0; - tt_metrics->scale = 0; - tt_metrics->ratio = 0x10000L; - } - - /* allow font program execution */ - TT_Set_CodeRange( exec, - tt_coderange_font, - face->font_program, - (FT_Long)face->font_program_size ); - /* disable CVT and glyph programs coderange */ TT_Clear_CodeRange( exec, tt_coderange_cvt ); TT_Clear_CodeRange( exec, tt_coderange_glyph ); if ( face->font_program_size > 0 ) { - TT_Goto_CodeRange( exec, tt_coderange_font, 0 ); + /* allow font program execution */ + TT_Set_CodeRange( exec, + tt_coderange_font, + face->font_program, + (FT_Long)face->font_program_size ); + + exec->pts.n_points = 0; + exec->pts.n_contours = 0; FT_TRACE4(( "Executing `fpgm' table.\n" )); - error = face->interpreter( exec ); -#ifdef FT_DEBUG_LEVEL_TRACE - if ( error ) - FT_TRACE4(( " interpretation failed with error code 0x%x\n", - error )); -#endif + error = TT_Run_Context( exec, size ); + FT_TRACE4(( error ? " failed (error code 0x%x)\n" : "", + error )); } else error = FT_Err_Ok; @@ -979,212 +932,146 @@ * size :: * A handle to the size object. * - * pedantic :: - * Set if bytecode execution should be pedantic. - * * @Return: * FreeType error code. 0 means success. */ FT_LOCAL_DEF( FT_Error ) - tt_size_run_prep( TT_Size size, - FT_Bool pedantic ) + tt_size_run_prep( TT_Size size ) { TT_Face face = (TT_Face)size->root.face; - TT_ExecContext exec; + TT_ExecContext exec = size->context; FT_Error error; FT_UInt i; + /* set default GS, twilight points, and storage */ + /* before CV program can modify them. */ + size->GS = tt_default_graphics_state; + + /* all twilight points are originally zero */ + FT_ARRAY_ZERO( size->twilight.org, size->twilight.n_points ); + FT_ARRAY_ZERO( size->twilight.cur, size->twilight.n_points ); + + error = TT_Load_Context( exec, face, size ); + if ( error ) + return error; + + /* clear storage area */ + FT_ARRAY_ZERO( exec->storage, exec->storeSize ); + /* 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++ ) + for ( i = 0; i < exec->cvtSize; i++ ) { /* 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 )); + exec->cvt[i] = FT_MulFix( face->cvt[i] / 64, size->ttmetrics.scale ); + FT_TRACE6(( " %3u: %f (%f)\n", + i, (double)face->cvt[i] / 64, (double)exec->cvt[i] / 64 )); } FT_TRACE6(( "\n" )); - exec = size->context; - - error = TT_Load_Context( exec, face, size ); - if ( error ) - return error; - - exec->callTop = 0; - exec->top = 0; - - exec->instruction_trap = FALSE; - - exec->pedantic_hinting = pedantic; - - TT_Set_CodeRange( exec, - tt_coderange_cvt, - face->cvt_program, - (FT_Long)face->cvt_program_size ); - TT_Clear_CodeRange( exec, tt_coderange_glyph ); if ( face->cvt_program_size > 0 ) { - TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 ); + /* allow CV program execution */ + TT_Set_CodeRange( exec, + tt_coderange_cvt, + face->cvt_program, + (FT_Long)face->cvt_program_size ); + + exec->pts.n_points = 0; + exec->pts.n_contours = 0; FT_TRACE4(( "Executing `prep' table.\n" )); - error = face->interpreter( exec ); -#ifdef FT_DEBUG_LEVEL_TRACE - if ( error ) - FT_TRACE4(( " interpretation failed with error code 0x%x\n", - error )); -#endif + error = TT_Run_Context( exec, size ); + FT_TRACE4(( error ? " failed (error code 0x%x)\n" : "", + error )); } else error = FT_Err_Ok; size->cvt_ready = error; - /* UNDOCUMENTED! The MS rasterizer doesn't allow the following */ - /* graphics state variables to be modified by the CVT program. */ - - exec->GS.dualVector.x = 0x4000; - exec->GS.dualVector.y = 0; - exec->GS.projVector.x = 0x4000; - exec->GS.projVector.y = 0x0; - exec->GS.freeVector.x = 0x4000; - exec->GS.freeVector.y = 0x0; - - exec->GS.rp0 = 0; - exec->GS.rp1 = 0; - exec->GS.rp2 = 0; - - exec->GS.gep0 = 1; - exec->GS.gep1 = 1; - exec->GS.gep2 = 1; - - exec->GS.loop = 1; - - /* save as default graphics state */ - size->GS = exec->GS; - - TT_Save_Context( exec, size ); + if ( !error ) + TT_Save_Context( exec, size ); return error; } static void - tt_size_done_bytecode( FT_Size ftsize ) + tt_size_done_bytecode( TT_Size size ) { - TT_Size size = (TT_Size)ftsize; - TT_Face face = (TT_Face)ftsize->face; - FT_Memory memory = face->root.memory; + FT_Memory memory = size->root.face->memory; + TT_ExecContext exec = size->context; + - if ( size->context ) + if ( exec ) { - TT_Done_Context( size->context ); + FT_FREE( exec->stack ); + FT_FREE( exec->FDefs ); + + TT_Done_Context( exec ); size->context = NULL; } - FT_FREE( size->cvt ); - size->cvt_size = 0; - - /* free storage area */ - FT_FREE( size->storage ); - size->storage_size = 0; - /* twilight zone */ - tt_glyphzone_done( &size->twilight ); - - FT_FREE( size->function_defs ); - FT_FREE( size->instruction_defs ); - - size->num_function_defs = 0; - size->max_function_defs = 0; - size->num_instruction_defs = 0; - size->max_instruction_defs = 0; - - size->max_func = 0; - size->max_ins = 0; - - size->bytecode_ready = -1; - size->cvt_ready = -1; + tt_glyphzone_done( memory, &size->twilight ); } /* Initialize bytecode-related fields in the size object. */ /* We do this only if bytecode interpretation is really needed. */ - static FT_Error - tt_size_init_bytecode( FT_Size ftsize, + FT_LOCAL_DEF( FT_Error ) + tt_size_init_bytecode( TT_Size size, FT_Bool pedantic ) { FT_Error error; - TT_Size size = (TT_Size)ftsize; - TT_Face face = (TT_Face)ftsize->face; - FT_Memory memory = face->root.memory; + TT_Face face = (TT_Face)size->root.face; + FT_Memory memory = size->root.face->memory; FT_UShort n_twilight; TT_MaxProfile* maxp = &face->max_profile; + TT_ExecContext exec; - /* clean up bytecode related data */ - FT_FREE( size->function_defs ); - FT_FREE( size->instruction_defs ); - FT_FREE( size->cvt ); - FT_FREE( size->storage ); - - if ( size->context ) - TT_Done_Context( size->context ); - tt_glyphzone_done( &size->twilight ); + exec = TT_New_Context( (TT_Driver)face->root.driver ); + if ( !exec ) + return FT_THROW( Could_Not_Find_Context ); - size->bytecode_ready = -1; - size->cvt_ready = -1; + exec->pedantic_hinting = pedantic; - size->context = TT_New_Context( (TT_Driver)face->root.driver ); + exec->maxFDefs = maxp->maxFunctionDefs; + exec->maxIDefs = maxp->maxInstructionDefs; - size->max_function_defs = maxp->maxFunctionDefs; - size->max_instruction_defs = maxp->maxInstructionDefs; + if ( FT_NEW_ARRAY( exec->FDefs, exec->maxFDefs + exec->maxIDefs ) ) + goto Exit; - size->num_function_defs = 0; - size->num_instruction_defs = 0; + exec->IDefs = exec->FDefs + exec->maxFDefs; - size->max_func = 0; - size->max_ins = 0; + exec->numFDefs = 0; + exec->numIDefs = 0; - size->cvt_size = face->cvt_size; - size->storage_size = maxp->maxStorage; + exec->maxFunc = 0; + exec->maxIns = 0; - /* Set default metrics */ - { - TT_Size_Metrics* tt_metrics = &size->ttmetrics; - - - tt_metrics->rotated = FALSE; - tt_metrics->stretched = FALSE; - - /* Set default engine compensation. Value 3 is not described */ - /* in the OpenType specification (as of Mai 2019), but Greg */ - /* says that MS handles it the same as `gray'. */ - /* */ - /* The Apple specification says that the compensation for */ - /* `gray' is always zero. FreeType doesn't do any */ - /* compensation at all. */ - tt_metrics->compensations[0] = 0; /* gray */ - tt_metrics->compensations[1] = 0; /* black */ - tt_metrics->compensations[2] = 0; /* white */ - tt_metrics->compensations[3] = 0; /* zero */ - } + /* XXX: We reserve a little more elements on the stack to deal */ + /* with broken fonts like arialbs, courbs, timesbs, etc. */ + exec->stackSize = maxp->maxStackElements + 32; + exec->storeSize = maxp->maxStorage; + exec->cvtSize = face->cvt_size; - /* allocate function defs, instruction defs, cvt, and storage area */ - if ( FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) || - FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) || - FT_NEW_ARRAY( size->cvt, size->cvt_size ) || - FT_NEW_ARRAY( size->storage, size->storage_size ) ) + if ( FT_NEW_ARRAY( exec->stack, + exec->stackSize + + (FT_Long)( exec->storeSize + exec->cvtSize ) ) ) goto Exit; - /* reserve twilight zone */ + /* reserve twilight zone and set GS before fpgm is executed, */ + /* just in case, even though fpgm should not touch them */ n_twilight = maxp->maxTwilightPoints; /* there are 4 phantom points (do we need this?) */ @@ -1194,20 +1081,12 @@ if ( error ) goto Exit; - size->twilight.n_points = n_twilight; - - size->GS = tt_default_graphics_state; - - /* set `face->interpreter' according to the debug hook present */ - { - FT_Library library = face->root.driver->root.library; - + size->GS = tt_default_graphics_state; + size->cvt_ready = -1; + size->context = exec; - face->interpreter = (TT_Interpreter) - library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE]; - if ( !face->interpreter ) - face->interpreter = (TT_Interpreter)TT_RunIns; - } + size->ttmetrics.rotated = FALSE; + size->ttmetrics.stretched = FALSE; /* Fine, now run the font program! */ @@ -1217,59 +1096,13 @@ /* to be executed just once; calling it again is completely useless */ /* and might even lead to extremely slow behaviour if it is malformed */ /* (containing an infinite loop, for example). */ - error = tt_size_run_fpgm( size, pedantic ); + error = tt_size_run_fpgm( size ); return error; Exit: if ( error ) - tt_size_done_bytecode( ftsize ); - - return error; - } - - - FT_LOCAL_DEF( FT_Error ) - tt_size_ready_bytecode( TT_Size size, - FT_Bool pedantic ) - { - FT_Error error = FT_Err_Ok; - - - if ( size->bytecode_ready < 0 ) - error = tt_size_init_bytecode( (FT_Size)size, pedantic ); - else - error = size->bytecode_ready; - - if ( error ) - goto Exit; - - /* rescale CVT when needed */ - if ( size->cvt_ready < 0 ) - { - FT_UShort i; - + tt_size_done_bytecode( size ); - /* all twilight points are originally zero */ - for ( i = 0; i < size->twilight.n_points; i++ ) - { - size->twilight.org[i].x = 0; - size->twilight.org[i].y = 0; - size->twilight.cur[i].x = 0; - size->twilight.cur[i].y = 0; - } - - /* clear storage area */ - for ( i = 0; i < size->storage_size; i++ ) - size->storage[i] = 0; - - size->GS = tt_default_graphics_state; - - error = tt_size_run_prep( size, pedantic ); - } - else - error = size->cvt_ready; - - Exit: return error; } @@ -1300,11 +1133,9 @@ #ifdef TT_USE_BYTECODE_INTERPRETER size->bytecode_ready = -1; - size->cvt_ready = -1; #endif - size->ttmetrics.valid = FALSE; - size->strike_index = 0xFFFFFFFFUL; + size->strike_index = 0xFFFFFFFFUL; return error; } @@ -1325,14 +1156,11 @@ FT_LOCAL_DEF( void ) tt_size_done( FT_Size ttsize ) /* TT_Size */ { - TT_Size size = (TT_Size)ttsize; - - #ifdef TT_USE_BYTECODE_INTERPRETER - tt_size_done_bytecode( ttsize ); + tt_size_done_bytecode( (TT_Size)ttsize ); +#else + FT_UNUSED( ttsize ); #endif - - size->ttmetrics.valid = FALSE; } @@ -1353,21 +1181,13 @@ * function must take `FT_Size` as a result. The passed `FT_Size` is * expected to point to a `TT_Size`. */ - FT_LOCAL_DEF( FT_Error ) + FT_LOCAL_DEF( void ) tt_size_reset_height( FT_Size ft_size ) { TT_Size size = (TT_Size)ft_size; - TT_Face face = (TT_Face)size->root.face; + TT_Face face = (TT_Face)ft_size->face; FT_Size_Metrics* size_metrics = &size->hinted_metrics; - size->ttmetrics.valid = FALSE; - - /* copy the result from base layer */ - *size_metrics = size->root.metrics; - - if ( size_metrics->x_ppem < 1 || size_metrics->y_ppem < 1 ) - return FT_THROW( Invalid_PPem ); - /* This bit flag, if set, indicates that the ppems must be */ /* rounded to integers. Nearly all TrueType fonts have this bit */ /* set, as hinting won't work really well otherwise. */ @@ -1385,10 +1205,6 @@ FT_MulFix( face->root.height, size_metrics->y_scale ) ); } - - size->ttmetrics.valid = TRUE; - - return FT_Err_Ok; } @@ -1408,14 +1224,20 @@ FT_LOCAL_DEF( FT_Error ) tt_size_reset( TT_Size size ) { - FT_Error error; TT_Face face = (TT_Face)size->root.face; FT_Size_Metrics* size_metrics = &size->hinted_metrics; - error = tt_size_reset_height( (FT_Size)size ); - if ( error ) - return error; + /* invalidate the size object first */ + size->ttmetrics.ppem = 0; + + if ( size->root.metrics.x_ppem == 0 || size->root.metrics.y_ppem == 0 ) + return FT_THROW( Invalid_PPem ); + + /* copy the result from base layer */ + *size_metrics = size->root.metrics; + + tt_size_reset_height( (FT_Size)size ); if ( face->header.Flags & 8 ) { diff --git a/modules/freetype2/src/truetype/ttobjs.h b/modules/freetype2/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ * * Objects manager (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -53,6 +53,8 @@ FT_BEGIN_HEADER typedef FT_GlyphSlot TT_GlyphSlot; +#ifdef TT_USE_BYTECODE_INTERPRETER + /************************************************************************** * * @Struct: @@ -67,21 +69,27 @@ FT_BEGIN_HEADER FT_UShort rp1; FT_UShort rp2; + FT_UShort gep0; + FT_UShort gep1; + FT_UShort gep2; + FT_UnitVector dualVector; FT_UnitVector projVector; FT_UnitVector freeVector; FT_Long loop; - FT_F26Dot6 minimum_distance; FT_Int round_state; + FT_F26Dot6 compensation[4]; /* device-specific compensations */ - FT_Bool auto_flip; + /* default values below can be modified by 'fpgm' and 'prep' */ + FT_F26Dot6 minimum_distance; FT_F26Dot6 control_value_cutin; FT_F26Dot6 single_width_cutin; FT_F26Dot6 single_width_value; FT_UShort delta_base; FT_UShort delta_shift; + FT_Bool auto_flip; FT_Byte instruct_control; /* According to Greg Hitchcock from Microsoft, the `scan_control' */ /* variable as documented in the TrueType specification is a 32-bit */ @@ -90,17 +98,12 @@ FT_BEGIN_HEADER FT_Bool scan_control; FT_Int scan_type; - FT_UShort gep0; - FT_UShort gep1; - FT_UShort gep2; - } TT_GraphicsState; -#ifdef TT_USE_BYTECODE_INTERPRETER - FT_LOCAL( void ) - tt_glyphzone_done( TT_GlyphZone zone ); + tt_glyphzone_done( FT_Memory memory, + TT_GlyphZone zone ); FT_LOCAL( FT_Error ) tt_glyphzone_new( FT_Memory memory, @@ -114,73 +117,6 @@ FT_BEGIN_HEADER /************************************************************************** * - * EXECUTION SUBTABLES - * - * These sub-tables relate to instruction execution. - * - */ - - -#define TT_MAX_CODE_RANGES 3 - - - /************************************************************************** - * - * There can only be 3 active code ranges at once: - * - the Font Program - * - the CVT Program - * - a glyph's instructions set - */ - typedef enum TT_CodeRange_Tag_ - { - tt_coderange_none = 0, - tt_coderange_font, - tt_coderange_cvt, - tt_coderange_glyph - - } TT_CodeRange_Tag; - - - typedef struct TT_CodeRange_ - { - FT_Byte* base; - FT_Long size; - - } TT_CodeRange; - - typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES]; - - - /************************************************************************** - * - * Defines a function/instruction definition record. - */ - typedef struct TT_DefRecord_ - { - FT_Int range; /* in which code range is it located? */ - FT_Long start; /* where does it start? */ - FT_Long end; /* where does it end? */ - FT_UInt opc; /* function #, or instruction code */ - FT_Bool active; /* is it active? */ - - } TT_DefRecord, *TT_DefArray; - - - /************************************************************************** - * - * Subglyph transformation record. - */ - typedef struct TT_Transform_ - { - FT_Fixed xx, xy; /* transformation matrix coefficients */ - FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ - - } TT_Transform; - - - /************************************************************************** - * * A note regarding non-squared pixels: * * (This text will probably go into some docs at some time; for now, it @@ -251,13 +187,9 @@ FT_BEGIN_HEADER FT_Long x_ratio; FT_Long y_ratio; - FT_UShort ppem; /* maximum ppem size */ FT_Long ratio; /* current ratio */ FT_Fixed scale; - - FT_F26Dot6 compensations[4]; /* device-specific compensations */ - - FT_Bool valid; + FT_UShort ppem; /* maximum ppem size */ FT_Bool rotated; /* `is the glyph rotated?'-flag */ FT_Bool stretched; /* `is the glyph stretched?'-flag */ @@ -288,27 +220,8 @@ FT_BEGIN_HEADER FT_Long point_size; /* for the `MPS' bytecode instruction */ - FT_UInt num_function_defs; /* number of function definitions */ - FT_UInt max_function_defs; - TT_DefArray function_defs; /* table of function definitions */ - - FT_UInt num_instruction_defs; /* number of ins. definitions */ - FT_UInt max_instruction_defs; - TT_DefArray instruction_defs; /* table of ins. definitions */ - - FT_UInt max_func; - FT_UInt max_ins; - - TT_CodeRangeTable codeRangeTable; - TT_GraphicsState GS; - FT_ULong cvt_size; /* the scaled control value table */ - FT_Long* cvt; - - FT_UShort storage_size; /* The storage area is now part of */ - FT_Long* storage; /* the instance */ - TT_GlyphZoneRec twilight; /* The instance's twilight zone */ TT_ExecContext context; @@ -375,20 +288,18 @@ FT_BEGIN_HEADER #ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( FT_Error ) - tt_size_run_fpgm( TT_Size size, - FT_Bool pedantic ); + tt_size_run_fpgm( TT_Size size ); FT_LOCAL( FT_Error ) - tt_size_run_prep( TT_Size size, - FT_Bool pedantic ); + tt_size_run_prep( TT_Size size ); FT_LOCAL( FT_Error ) - tt_size_ready_bytecode( TT_Size size, - FT_Bool pedantic ); + tt_size_init_bytecode( TT_Size size, + FT_Bool pedantic ); #endif /* TT_USE_BYTECODE_INTERPRETER */ - FT_LOCAL( FT_Error ) + FT_LOCAL( void ) tt_size_reset_height( FT_Size size ); FT_LOCAL( FT_Error ) diff --git a/modules/freetype2/src/truetype/ttpload.c b/modules/freetype2/src/truetype/ttpload.c @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -110,7 +110,7 @@ if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 ) { - FT_TRACE2(( "glyph count mismatch! loca: %ld, maxp: %ld\n", + FT_TRACE2(( "glyph count mismatch! loca: %lu, maxp: %ld\n", face->num_locations - 1, face->root.num_glyphs )); /* we only handle the case where `maxp' gives a larger value */ @@ -151,7 +151,7 @@ face->num_locations = (FT_ULong)face->root.num_glyphs + 1; table_len = new_loca_len; - FT_TRACE2(( "adjusting num_locations to %ld\n", + FT_TRACE2(( "adjusting num_locations to %lu\n", face->num_locations )); } else @@ -225,7 +225,7 @@ if ( pos1 > ttface->glyf_len ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset (0x%08lx) found for glyph index %d,\n", + " too large offset (0x%08lx) found for glyph index %u,\n", pos1, gindex )); FT_TRACE1(( " " " exceeding the end of `glyf' table (0x%08lx)\n", @@ -240,17 +240,17 @@ if ( gindex == ttface->num_locations - 2 ) { FT_TRACE1(( "tt_face_get_location:" - " too large size (%ld bytes) found for glyph index %d,\n", + " too large size (%lu bytes) found for glyph index %u,\n", pos2 - pos1, gindex )); FT_TRACE1(( " " - " truncating at the end of `glyf' table to %ld bytes\n", + " truncating at the end of `glyf' table to %lu bytes\n", ttface->glyf_len - pos1 )); pos2 = ttface->glyf_len; } else { FT_TRACE1(( "tt_face_get_location:" - " too large offset (0x%08lx) found for glyph index %d,\n", + " too large offset (0x%08lx) found for glyph index %u,\n", pos2, gindex + 1 )); FT_TRACE1(( " " " exceeding the end of `glyf' table (0x%08lx)\n", @@ -419,7 +419,7 @@ if ( FT_FRAME_EXTRACT( table_len, face->font_program ) ) goto Exit; - FT_TRACE2(( "loaded, %12ld bytes\n", face->font_program_size )); + FT_TRACE2(( "loaded, %12lu bytes\n", face->font_program_size )); } Exit: @@ -482,7 +482,7 @@ if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) ) goto Exit; - FT_TRACE2(( "loaded, %12ld bytes\n", face->cvt_program_size )); + FT_TRACE2(( "loaded, %12lu bytes\n", face->cvt_program_size )); } Exit: diff --git a/modules/freetype2/src/truetype/ttpload.h b/modules/freetype2/src/truetype/ttpload.h @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/module.mk b/modules/freetype2/src/type1/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/type1/rules.mk b/modules/freetype2/src/type1/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/type1/t1afm.c b/modules/freetype2/src/type1/t1afm.c @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1afm.h b/modules/freetype2/src/type1/t1afm.h @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1driver.c b/modules/freetype2/src/type1/t1driver.c @@ -4,7 +4,7 @@ * * Type 1 driver interface (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1driver.h b/modules/freetype2/src/type1/t1driver.h @@ -4,7 +4,7 @@ * * High-level Type 1 driver interface (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1errors.h b/modules/freetype2/src/type1/t1errors.h @@ -4,7 +4,7 @@ * * Type 1 error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1gload.c b/modules/freetype2/src/type1/t1gload.c @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -70,8 +70,13 @@ /* For incremental fonts get the character data using the */ /* callback function. */ if ( inc ) + { + /* So `free_glyph_data` knows whether to free it. */ + char_string->pointer = NULL; + error = inc->funcs->get_glyph_data( inc->object, glyph_index, char_string ); + } else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -155,6 +160,9 @@ decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v ); } + if ( error && inc ) + inc->funcs->free_glyph_data( inc->object, char_string ); + #endif /* FT_CONFIG_OPTION_INCREMENTAL */ return error; @@ -295,7 +303,7 @@ { advances[nn] = 0; - FT_TRACE5(( " idx %d: advance height 0 font units\n", + FT_TRACE5(( " idx %u: advance height 0 font units\n", first + nn )); } @@ -333,7 +341,7 @@ else advances[nn] = 0; - FT_TRACE5(( " idx %d: advance width %ld font unit%s\n", + FT_TRACE5(( " idx %u: advance width %ld font unit%s\n", first + nn, advances[nn], advances[nn] == 1 ? "" : "s" )); @@ -380,7 +388,7 @@ goto Exit; } - FT_TRACE1(( "T1_Load_Glyph: glyph index %d\n", glyph_index )); + FT_TRACE1(( "T1_Load_Glyph: glyph index %u\n", glyph_index )); FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) ); @@ -398,16 +406,12 @@ glyph->y_scale = 0x10000L; } - t1glyph->outline.n_points = 0; - t1glyph->outline.n_contours = 0; - hinting = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) && !( load_flags & FT_LOAD_NO_HINTING ) ); scaled = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) ); glyph->hint = hinting; glyph->scaled = scaled; - t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; error = decoder_funcs->init( &decoder, t1glyph->face, @@ -452,16 +456,12 @@ must_finish_decoder = FALSE; - /* now, set the metrics -- this is rather simple, as */ - /* the left side bearing is the xMin, and the top side */ - /* bearing the yMax */ if ( !error ) { - t1glyph->outline.flags &= FT_OUTLINE_OWNER; - t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL; - - /* for composite glyphs, return only left side bearing and */ - /* advance width */ + /* now, set the metrics -- this is rather simple, as */ + /* the left side bearing is the xMin, and the top side */ + /* bearing the yMax; for composite glyphs, return only */ + /* left side bearing and advance width */ if ( load_flags & FT_LOAD_NO_RECURSE ) { FT_Slot_Internal internal = t1glyph->internal; @@ -482,6 +482,13 @@ FT_Glyph_Metrics* metrics = &t1glyph->metrics; + t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; + + t1glyph->outline.flags &= FT_OUTLINE_OWNER; + t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL; + if ( t1size && t1size->metrics.y_ppem < 24 ) + t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; + /* copy the _unscaled_ advance width */ metrics->horiAdvance = FIXED_TO_INT( decoder.builder.advance.x ); @@ -504,11 +511,6 @@ FIXED_TO_INT( decoder.builder.advance.y ); } - t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; - - if ( t1size && t1size->metrics.y_ppem < 24 ) - t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; - #if 1 /* apply the font matrix, if any */ if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L || diff --git a/modules/freetype2/src/type1/t1gload.h b/modules/freetype2/src/type1/t1gload.h @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1load.c b/modules/freetype2/src/type1/t1load.c @@ -4,7 +4,7 @@ * * Type 1 font loader (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -471,7 +471,7 @@ nc = num_coords; if ( num_coords > blend->num_axis ) { - FT_TRACE2(( "T1_Get_MM_Blend: only using first %d of %d coordinates\n", + FT_TRACE2(( "T1_Get_MM_Blend: only using first %u of %u coordinates\n", blend->num_axis, num_coords )); nc = blend->num_axis; } @@ -640,7 +640,7 @@ { FT_UNUSED( instance_index ); - return T1_Set_MM_Blend( face, 0, NULL ); + return T1_Set_MM_WeightVector( face, 0, NULL ); } @@ -691,7 +691,7 @@ if ( num_coords > blend->num_axis ) { FT_TRACE2(( "T1_Get_Var_Design:" - " only using first %d of %d coordinates\n", + " only using first %u of %u coordinates\n", blend->num_axis, num_coords )); nc = blend->num_axis; } diff --git a/modules/freetype2/src/type1/t1load.h b/modules/freetype2/src/type1/t1load.h @@ -4,7 +4,7 @@ * * Type 1 font loader (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1objs.c b/modules/freetype2/src/type1/t1objs.c @@ -4,7 +4,7 @@ * * Type 1 objects manager (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1objs.h b/modules/freetype2/src/type1/t1objs.h @@ -4,7 +4,7 @@ * * Type 1 objects manager (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1parse.c b/modules/freetype2/src/type1/t1parse.c @@ -4,7 +4,7 @@ * * Type 1 parser (body). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1parse.h b/modules/freetype2/src/type1/t1parse.h @@ -4,7 +4,7 @@ * * Type 1 parser (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/t1tokens.h b/modules/freetype2/src/type1/t1tokens.h @@ -4,7 +4,7 @@ * * Type 1 tokenizer (specification). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type1/type1.c b/modules/freetype2/src/type1/type1.c @@ -4,7 +4,7 @@ * * FreeType Type 1 driver component (body only). * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type42/module.mk b/modules/freetype2/src/type42/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2024 by +# Copyright (C) 2002-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/type42/rules.mk b/modules/freetype2/src/type42/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2024 by +# Copyright (C) 2002-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/type42/t42drivr.c b/modules/freetype2/src/type42/t42drivr.c @@ -4,7 +4,7 @@ * * High-level Type 42 driver interface (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type42/t42drivr.h b/modules/freetype2/src/type42/t42drivr.h @@ -4,7 +4,7 @@ * * High-level Type 42 driver interface (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type42/t42error.h b/modules/freetype2/src/type42/t42error.h @@ -4,7 +4,7 @@ * * Type 42 error codes (specification only). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type42/t42objs.c b/modules/freetype2/src/type42/t42objs.c @@ -4,7 +4,7 @@ * * Type 42 objects manager (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -510,9 +510,10 @@ error = FT_New_Size( t42face->ttf_face, &ttsize ); if ( !error ) + { t42size->ttsize = ttsize; - - FT_Activate_Size( ttsize ); + FT_Activate_Size( ttsize ); + } return error; } @@ -657,7 +658,7 @@ FT_Driver_Class ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz; - FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %d\n", glyph_index )); + FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %u\n", glyph_index )); /* map T42 glyph index to embedded TTF's glyph index */ glyph_index = (FT_UInt)ft_strtol( diff --git a/modules/freetype2/src/type42/t42objs.h b/modules/freetype2/src/type42/t42objs.h @@ -4,7 +4,7 @@ * * Type 42 objects manager (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type42/t42parse.c b/modules/freetype2/src/type42/t42parse.c @@ -4,7 +4,7 @@ * * Type 42 font parser (body). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -310,7 +310,7 @@ FT_Byte* cur; FT_Byte* limit = parser->root.limit; - PSAux_Service psaux = (PSAux_Service)t42face->psaux; + PSAux_Service psaux = (PSAux_Service)t42face->psaux; T1_Skip_Spaces( parser ); @@ -697,7 +697,7 @@ goto Fail; } - FT_TRACE2(( " PS string size %5lu bytes, offset 0x%08lx (%lu)\n", + FT_TRACE2(( " PS string size %5lu bytes, offset 0x%08lx (%ld)\n", string_size, ttf_count, ttf_count )); /* The whole TTF is now loaded into `string_buf'. We are */ diff --git a/modules/freetype2/src/type42/t42parse.h b/modules/freetype2/src/type42/t42parse.h @@ -4,7 +4,7 @@ * * Type 42 font parser (specification). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type42/t42types.h b/modules/freetype2/src/type42/t42types.h @@ -4,7 +4,7 @@ * * Type 42 font data types (specification only). * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/type42/type42.c b/modules/freetype2/src/type42/type42.c @@ -4,7 +4,7 @@ * * FreeType Type 42 driver component. * - * Copyright (C) 2002-2024 by + * Copyright (C) 2002-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/winfonts/fnterrs.h b/modules/freetype2/src/winfonts/fnterrs.h @@ -4,7 +4,7 @@ * * Win FNT/FON error codes (specification only). * - * Copyright (C) 2001-2024 by + * Copyright (C) 2001-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/modules/freetype2/src/winfonts/module.mk b/modules/freetype2/src/winfonts/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/winfonts/rules.mk b/modules/freetype2/src/winfonts/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2024 by +# Copyright (C) 1996-2025 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/winfonts/winfnt.c b/modules/freetype2/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ * * FreeType font driver for Windows FNT/FON files * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * Copyright 2003 Huw D M Davies for Codeweavers * Copyright 2007 Dmitry Timoshkov for Codeweavers @@ -1031,7 +1031,7 @@ goto Exit; } - FT_TRACE1(( "FNT_Load_Glyph: glyph index %d\n", glyph_index )); + FT_TRACE1(( "FNT_Load_Glyph: glyph index %u\n", glyph_index )); if ( glyph_index > 0 ) glyph_index--; /* revert to real index */ diff --git a/modules/freetype2/src/winfonts/winfnt.h b/modules/freetype2/src/winfonts/winfnt.h @@ -4,7 +4,7 @@ * * FreeType font driver for Windows FNT/FON files * - * Copyright (C) 1996-2024 by + * Copyright (C) 1996-2025 by * David Turner, Robert Wilhelm, and Werner Lemberg. * Copyright 2007 Dmitry Timoshkov for Codeweavers * diff --git a/modules/freetype2/subprojects/harfbuzz.wrap b/modules/freetype2/subprojects/harfbuzz.wrap @@ -1,12 +1,10 @@ [wrap-file] -directory = harfbuzz-5.2.0 -source_url = https://github.com/harfbuzz/harfbuzz/releases/download/5.2.0/harfbuzz-5.2.0.tar.xz -source_filename = harfbuzz-5.2.0.tar.xz -source_hash = 735a94917b47936575acb4d4fa7e7986522f8a89527e4635721474dee2bc942c -wrapdb_version = 5.2.0-1 +directory = harfbuzz-11.4.1 +source_url = https://github.com/harfbuzz/harfbuzz/releases/download/11.4.1/harfbuzz-11.4.1.tar.xz +source_filename = harfbuzz-11.4.1.tar.xz +source_hash = 7aafab93115eb56cdc9a931ab7d19ff60d7f2937b599d140f17236f374e32698 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/harfbuzz_11.4.1-1/harfbuzz-11.4.1.tar.xz +wrapdb_version = 11.4.1-1 [provide] -harfbuzz = libharfbuzz_dep -harfbuzz-icu = libharfbuzz_icu_dep -harfbuzz-subset = libharfbuzz_subset_dep -harfbuzz-gobject = libharfbuzz_gobject_dep +dependency_names = harfbuzz, harfbuzz-cairo, harfbuzz-gobject, harfbuzz-icu, harfbuzz-subset diff --git a/modules/freetype2/subprojects/libpng.wrap b/modules/freetype2/subprojects/libpng.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = libpng-1.6.43 -source_url = https://github.com/glennrp/libpng/archive/v1.6.43.tar.gz -source_filename = libpng-1.6.43.tar.gz -source_hash = fecc95b46cf05e8e3fc8a414750e0ba5aad00d89e9fdf175e94ff041caf1a03a -patch_filename = libpng_1.6.43-2_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.43-2/get_patch -patch_hash = 49951297edf03e81d925ab03726555f09994ad1ed78fb539a269216430eef3da -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.43-2/libpng-1.6.43.tar.gz -wrapdb_version = 1.6.43-2 +directory = libpng-1.6.50 +source_url = https://github.com/pnggroup/libpng/archive/v1.6.50.tar.gz +source_filename = libpng-1.6.50.tar.gz +source_hash = 71158e53cfdf2877bc99bcab33641d78df3f48e6e0daad030afe9cb8c031aa46 +patch_filename = libpng_1.6.50-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.50-2/get_patch +patch_hash = a9c9362bb8cbb422c864807a174977dec3868cdff8ca380e27bab6ee1caa22ea +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.50-2/libpng-1.6.50.tar.gz +wrapdb_version = 1.6.50-2 [provide] libpng = libpng_dep diff --git a/modules/freetype2/subprojects/zlib.wrap b/modules/freetype2/subprojects/zlib.wrap @@ -1,13 +1,13 @@ [wrap-file] directory = zlib-1.3.1 source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-2/zlib-1.3.1.tar.gz source_filename = zlib-1.3.1.tar.gz source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 -patch_filename = zlib_1.3.1-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch -patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095 -wrapdb_version = 1.3.1-1 +patch_filename = zlib_1.3.1-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-2/get_patch +patch_hash = 9cacea02e1119964bc51e92dd2359b14df723a36cfe0df1c78d55d9c9f2763ae +wrapdb_version = 1.3.1-2 [provide] zlib = zlib_dep diff --git a/modules/freetype2/vms_make.com b/modules/freetype2/vms_make.com @@ -1,6 +1,6 @@ $! make FreeType 2 under OpenVMS $! -$! Copyright (C) 2003-2024 by +$! Copyright (C) 2003-2025 by $! David Turner, Robert Wilhelm, and Werner Lemberg. $! $! This file is part of the FreeType project, and may only be used, modified, @@ -100,6 +100,12 @@ $ if ( have_png ) then write libsf "sys$library:libpng_cxx.olb/lib" $ if ( have_bz2 ) then write libsf "sys$library:libbz2_cxx.olb/lib" $ if ( have_z ) then write libsf "sys$library:libz_cxx.olb/lib" $ close libsf +$ open/write libsf libs_cxx32.opt +$ if ( have_harfbuzz ) then write libsf "sys$library:libharfbuzz.olb/lib" +$ if ( have_png ) then write libsf "sys$library:libpng_cxx32.olb/lib" +$ if ( have_bz2 ) then write libsf "sys$library:libbz2_cxx32.olb/lib" +$ if ( have_z ) then write libsf "sys$library:libz_cxx32.olb/lib" +$ close libsf $! $! Create objects $! @@ -173,6 +179,19 @@ $ close file $ link/nodeb/share=[.lib]freetype2shr_cxx.exe/map=libfreetype_cxx.map/full - libfreetype_cxx/opt,freetype_vms/opt,libs_cxx/opt $ delete freetype_cxx.obj;* +$ write sys$output "Creating freetype2shr_cxx32.exe" +$ library/extract=* [.lib]freetype_cxx32.olb +$ open/write file libfreetype_cxx32.opt +$ write file "!" +$ write file "! libfreetype_cxx32.opt generated by vms_make.com" +$ write file "!" +$ write file "IDENTIFICATION=""freetype2 2.0""" +$ write file "GSMATCH=LEQUAL,2,0 +$ write file "freetype_cxx32.obj" +$ close file +$ link/nodeb/share=[.lib]freetype2shr_cxx32.exe/map=libfreetype_cxx32.map/full - + libfreetype_cxx32/opt,freetype_vms/opt,libs_cxx32/opt +$ delete freetype_cxx.obj;* $ endif $! $ exit @@ -221,77 +240,77 @@ $ deck all : - define config [--.include.freetype.config] - define internal [--.include.freetype.internal] - define autofit [-.autofit] - define base [-.base] - define cache [-.cache] - define cff [-.cff] - define cid [-.cid] - define freetype [--.include.freetype] - define pcf [-.pcf] - define psaux [-.psaux] - define psnames [-.psnames] - define raster [-.raster] - define sfnt [-.sfnt] - define smooth [-.smooth] - define truetype [-.truetype] - define type1 [-.type1] - define winfonts [-.winfonts] - if f$search("lib.dir") .eqs. "" then create/directory [.lib] - set default [.builds.vms] - $(MMS)$(MMSQUALIFIERS) - set default [--.src.autofit] - $(MMS)$(MMSQUALIFIERS) - set default [-.base] - $(MMS)$(MMSQUALIFIERS) - set default [-.bdf] - $(MMS)$(MMSQUALIFIERS) - set default [-.cache] - $(MMS)$(MMSQUALIFIERS) - set default [-.cff] - $(MMS)$(MMSQUALIFIERS) - set default [-.cid] - $(MMS)$(MMSQUALIFIERS) - set default [-.gxvalid] - $(MMS)$(MMSQUALIFIERS) - set default [-.gzip] - $(MMS)$(MMSQUALIFIERS) - set default [-.bzip2] - $(MMS)$(MMSQUALIFIERS) - set default [-.lzw] - $(MMS)$(MMSQUALIFIERS) - set default [-.otvalid] - $(MMS)$(MMSQUALIFIERS) - set default [-.pcf] - $(MMS)$(MMSQUALIFIERS) - set default [-.pfr] - $(MMS)$(MMSQUALIFIERS) - set default [-.psaux] - $(MMS)$(MMSQUALIFIERS) - set default [-.pshinter] - $(MMS)$(MMSQUALIFIERS) - set default [-.psnames] - $(MMS)$(MMSQUALIFIERS) - set default [-.raster] - $(MMS)$(MMSQUALIFIERS) - set default [-.sfnt] - $(MMS)$(MMSQUALIFIERS) - set default [-.smooth] - $(MMS)$(MMSQUALIFIERS) - set default [-.svg] - $(MMS)$(MMSQUALIFIERS) - set default [-.truetype] - $(MMS)$(MMSQUALIFIERS) - set default [-.type1] - $(MMS)$(MMSQUALIFIERS) - set default [-.type42] - $(MMS)$(MMSQUALIFIERS) - set default [-.winfonts] - $(MMS)$(MMSQUALIFIERS) - set default [-.sdf] - $(MMS)$(MMSQUALIFIERS) - set default [--] + define config [--.include.freetype.config] + define internal [--.include.freetype.internal] + define autofit [-.autofit] + define base [-.base] + define cache [-.cache] + define cff [-.cff] + define cid [-.cid] + define freetype [--.include.freetype] + define pcf [-.pcf] + define psaux [-.psaux] + define psnames [-.psnames] + define raster [-.raster] + define sfnt [-.sfnt] + define smooth [-.smooth] + define truetype [-.truetype] + define type1 [-.type1] + define winfonts [-.winfonts] + if f$search("lib.dir") .eqs. "" then create/directory [.lib] + set default [.builds.vms] + $(MMS)$(MMSQUALIFIERS) + set default [--.src.autofit] + $(MMS)$(MMSQUALIFIERS) + set default [-.base] + $(MMS)$(MMSQUALIFIERS) + set default [-.bdf] + $(MMS)$(MMSQUALIFIERS) + set default [-.cache] + $(MMS)$(MMSQUALIFIERS) + set default [-.cff] + $(MMS)$(MMSQUALIFIERS) + set default [-.cid] + $(MMS)$(MMSQUALIFIERS) + set default [-.gxvalid] + $(MMS)$(MMSQUALIFIERS) + set default [-.gzip] + $(MMS)$(MMSQUALIFIERS) + set default [-.bzip2] + $(MMS)$(MMSQUALIFIERS) + set default [-.lzw] + $(MMS)$(MMSQUALIFIERS) + set default [-.otvalid] + $(MMS)$(MMSQUALIFIERS) + set default [-.pcf] + $(MMS)$(MMSQUALIFIERS) + set default [-.pfr] + $(MMS)$(MMSQUALIFIERS) + set default [-.psaux] + $(MMS)$(MMSQUALIFIERS) + set default [-.pshinter] + $(MMS)$(MMSQUALIFIERS) + set default [-.psnames] + $(MMS)$(MMSQUALIFIERS) + set default [-.raster] + $(MMS)$(MMSQUALIFIERS) + set default [-.sfnt] + $(MMS)$(MMSQUALIFIERS) + set default [-.smooth] + $(MMS)$(MMSQUALIFIERS) + set default [-.svg] + $(MMS)$(MMSQUALIFIERS) + set default [-.truetype] + $(MMS)$(MMSQUALIFIERS) + set default [-.type1] + $(MMS)$(MMSQUALIFIERS) + set default [-.type42] + $(MMS)$(MMSQUALIFIERS) + set default [-.winfonts] + $(MMS)$(MMSQUALIFIERS) + set default [-.sdf] + $(MMS)$(MMSQUALIFIERS) + set default [--] # EOF $ eod @@ -323,6 +342,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -347,12 +367,15 @@ OBJS64=ftsystem_64.obj OBJSCXX=ftsystem_cxx.obj +OBJSCXX=ftsystem_cxx32.obj + all : $(OBJS) - library/create [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library/create [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library/create [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library/create [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library/create [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif ftsystem.obj : ftsystem.c ftconfig.h @@ -386,6 +409,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] -Isys$library .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -410,12 +434,15 @@ OBJS64=autofit_64.obj OBJSCXX=autofit_cxx.obj +OBJSCXX32=autofit_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -448,25 +475,27 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map - cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ + cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3,MACROREDEF))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ $(MMS$TARGET_NAME)_64.c - clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c + clang $(CXXFLAGS) -Wno-macro-redefined\ + -o $(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c delete $(MMS$TARGET_NAME)_64.c;* .else .c.obj : cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map - cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ + cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3,MACROREDEF))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ $(MMS$TARGET_NAME)_64.c delete $(MMS$TARGET_NAME)_64.c;* .endif -OBJS=ftbase.obj,\ +OBJS=ftbase_vms.obj,\ ftbbox.obj,\ ftbdf.obj,\ ftbitmap.obj,\ @@ -483,7 +512,7 @@ OBJS=ftbase.obj,\ fttype1.obj,\ ftwinfnt.obj,ftpatent.obj,ftgxval.obj,ftotval.obj -OBJS64=ftbase_64.obj,\ +OBJS64=ftbase_vms_64.obj,\ ftbbox_64.obj,\ ftbdf_64.obj,\ ftbitmap_64.obj,\ @@ -500,7 +529,7 @@ OBJS64=ftbase_64.obj,\ fttype1_64.obj,\ ftwinfnt_64.obj,ftpatent_64.obj,ftgxval_64.obj,ftotval_64.obj -OBJSCXX=ftbase_cxx.obj,\ +OBJSCXX=ftbase_vms_cxx.obj,\ ftbbox_cxx.obj,\ ftbdf_cxx.obj,\ ftbitmap_cxx.obj,\ @@ -517,18 +546,63 @@ OBJSCXX=ftbase_cxx.obj,\ fttype1_cxx.obj,\ ftwinfnt_cxx.obj,ftpatent_cxx.obj,ftgxval_cxx.obj,ftotval_cxx.obj +OBJSCXX32=ftbase_vms_cxx32.obj,\ + ftbbox_cxx32.obj,\ + ftbdf_cxx32.obj,\ + ftbitmap_cxx32.obj,\ + ftcid_cxx32.obj,\ + ftdebug_cxx32.obj,\ + ftfstype_cxx32.obj,\ + ftgasp_cxx32.obj,\ + ftglyph_cxx32.obj,\ + ftinit_cxx32.obj,\ + ftmm_cxx32.obj,\ + ftpfr_cxx32.obj,\ + ftstroke_cxx32.obj,\ + ftsynth_cxx32.obj,\ + fttype1_cxx32.obj,\ + ftwinfnt_cxx32.obj,ftpatent_cxx32.obj,ftgxval_cxx32.obj,ftotval_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif -ftbase.obj : ftbase.c ftadvanc.c ftcalc.c ftcolor.c ftdbgmem.c fterrors.c\ +.ifdef X86 +ftbase_vms.obj : ftbase.c ftadvanc.c ftcalc.c_vms ftcolor.c ftdbgmem.c fterrors.c\ ftfntfmt.c ftgloadr.c fthash.c ftlcdfil.c ftmac.c ftobjs.c ftoutln.c\ ftpsprop.c ftrfork.c ftsnames.c ftstream.c fttrigon.c ftutil.c + pipe gsed -e "s/ftcalc.c/ftcalc.c_vms/" < ftbase.c > ftbase_vms.c + clang $(CXXFLAGS) -pointer-size=32 -o ftbase_vms_cxx32.obj ftbase_vms.c + clang $(CXXFLAGS) -o ftbase_vms_cxx.obj ftbase_vms.c + cc$(CFLAGS)/warn=noinfo/point=32/list/show=all ftbase_vms.c + pipe link/map/full/exec=nl: ftbase_vms.obj | copy sys$input nl: + mc sys$library:vms_auto64 ftbase_vms.map + cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3,MACROREDEF))/point=64/obj=ftbase_vms_64.obj\ + ftbase_vms_64.c + clang $(CXXFLAGS) -Wno-macro-redefined\ + -o ftbase_vms_64_cxx.obj ftbase_vms_64.c + delete ftbase_vms_64.c;* +.else +ftbase_vms.obj : ftbase.c ftadvanc.c ftcalc.c_vms ftcolor.c ftdbgmem.c fterrors.c\ + ftfntfmt.c ftgloadr.c fthash.c ftlcdfil.c ftmac.c ftobjs.c ftoutln.c\ + ftpsprop.c ftrfork.c ftsnames.c ftstream.c fttrigon.c ftutil.c + pipe gsed -e "s/ftcalc.c/ftcalc.c_vms/" < ftbase.c > ftbase_vms.c + cc$(CFLAGS)/warn=noinfo/point=32/list/show=all ftbase_vms.c + pipe link/map/full/exec=nl: ftbase_vms.obj | copy sys$input nl: + mc sys$library:vms_auto64 ftbase_vms.map + cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3,MACROREDEF))/point=64/obj=ftbase_vms_64.obj\ + ftbase_vms_64.c + delete ftbase_vms_64.c;* + delete ftbase_vms.c;* +.endif +ftcalc.c_vms : ftcalc.c + pipe gsed -f [--.builds.vms]patch_ftcalc.sed < ftcalc.c > ftcalc.c_vms # EOF $ eod @@ -560,6 +634,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base]) .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -584,12 +659,15 @@ OBJS64=bdf_64.obj OBJSCXX=bdf_cxx.obj +OBJSCXX32=bdf_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -622,6 +700,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -646,12 +725,15 @@ OBJS64=ftcache_64.obj OBJSCXX=ftcache_cxx.obj +OBJSCXX32=ftcache_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif ftcache.obj : ftcache.c ftcbasic.c ftccache.c ftccmap.c ftcglyph.c ftcimage.c \ @@ -687,6 +769,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -711,12 +794,15 @@ OBJS64=cff_64.obj OBJSCXX=cff_cxx.obj +OBJSCXX32=cff_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -749,6 +835,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -773,12 +860,15 @@ OBJS64=type1cid_64.obj OBJSCXX=type1cid_cxx.obj +OBJSCXX32=type1cid_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -811,6 +901,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -835,12 +926,15 @@ OBJS64=gxvalid_64.obj OBJSCXX=gxvalid_cxx.obj +OBJSCXX32=gxvalid_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -872,6 +966,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -896,12 +991,15 @@ OBJS64=ftgzip_64.obj OBJSCXX=ftgzip_cxx.obj +OBJSCXX32=ftgzip_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -935,6 +1033,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] -Isys$library .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -959,12 +1058,15 @@ OBJS64=ftbzip2_64.obj OBJSCXX=ftbzip2_cxx.obj +OBJSCXX32=ftbzip2_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -996,6 +1098,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1020,12 +1123,15 @@ OBJS64=ftlzw_64.obj OBJSCXX=ftlzw_cxx.obj +OBJSCXX32=ftlzw_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1058,6 +1164,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1082,12 +1189,15 @@ OBJS64=otvalid_64.obj OBJSCXX=otvalid_cxx.obj +OBJSCXX32=otvalid_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1132,6 +1242,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1156,12 +1267,15 @@ OBJS64=pcf_64.obj OBJSCXX=pcf_cxx.obj +OBJSCXX32=pcf_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1194,6 +1308,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1218,12 +1333,15 @@ OBJS64=pfr_64.obj OBJSCXX=pfr_cxx.obj +OBJSCXX32=pfr_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1256,6 +1374,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1280,12 +1399,15 @@ OBJS64=psaux_64.obj OBJSCXX=psaux_cxx.obj +OBJSCXX32=psaux_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1318,6 +1440,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1342,12 +1465,15 @@ OBJS64=pshinter_64.obj OBJSCXX=pshinter_cxx.obj +OBJSCXX32=pshinter_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1380,6 +1506,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1404,12 +1531,15 @@ OBJS64=psnames_64.obj OBJSCXX=psnames_cxx.obj +OBJSCXX32=psnames_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1442,6 +1572,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1466,12 +1597,15 @@ OBJS64=raster_64.obj OBJSCXX=raster_cxx.obj +OBJSCXX32=raster_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1499,11 +1633,13 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.sfnt]) .ifdef X86 -CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] -Isys$library +CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] -Isys$library\ + -Wno-incompatible-pointer-types .endif .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1528,12 +1664,15 @@ OBJS64=sfnt_64.obj OBJSCXX=sfnt_cxx.obj +OBJSCXX32=sfnt_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1566,6 +1705,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I [] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1590,12 +1730,15 @@ OBJS64=smooth_64.obj OBJSCXX=smooth_cxx.obj +OBJSCXX32=smooth_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1628,6 +1771,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1652,12 +1796,15 @@ OBJS64=svg_64.obj OBJSCXX=svg_cxx.obj +OBJSCXX32=svg_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1690,6 +1837,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1714,12 +1862,15 @@ OBJS64=truetype_64.obj OBJSCXX=truetype_cxx.obj +OBJSCXX32=truetype_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1752,6 +1903,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1776,12 +1928,15 @@ OBJS64=type1_64.obj OBJSCXX=type1_cxx.obj +OBJSCXX32=type1_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif type1.obj : type1.c t1parse.c t1load.c t1objs.c t1driver.c t1gload.c t1afm.c @@ -1816,6 +1971,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1840,12 +1996,15 @@ OBJS64=sdf_64.obj OBJSCXX=sdf_cxx.obj +OBJSCXX32=sdf_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif sdf.obj : sdf.c ftbsdf.c ftsdf.c ftsdfcommon.c ftsdfrend.c @@ -1880,6 +2039,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1904,12 +2064,15 @@ OBJS64=type42_64.obj OBJSCXX=type42_cxx.obj +OBJSCXX32=type42_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -1942,6 +2105,7 @@ CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] .ifdef X86 .c.obj : + clang $(CXXFLAGS) -pointer-size=32 -o $(MMS$TARGET_NAME)_cxx32.obj $(MMS$TARGET_NAME).c clang $(CXXFLAGS) -o $(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: @@ -1966,12 +2130,15 @@ OBJS64=winfnt_64.obj OBJSCXX=winfnt_cxx.obj +OBJSCXX32=winfnt_cxx32.obj + all : $(OBJS) - library [--.lib]freetype.olb $(OBJS) - library [--.lib]freetype.olb $(OBJS64) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) .ifdef X86 - library [--.lib]freetype_cxx.olb $(OBJSCXX) - library [--.lib]freetype_cxx.olb $(OBJS64) + library [--.lib]freetype_cxx32.olb $(OBJSCXX32) + library [--.lib]freetype_cxx.olb $(OBJSCXX) + library [--.lib]freetype_cxx.olb $(OBJS64) .endif # EOF @@ -2014,14 +2181,14 @@ $ len = f$length(cparm) - start $ cc_com = f$extract(start,len,cparm) if (cc_com .nes. "DECC") .and. - (cc_com .nes. "VAXC") .and. - - (cc_com .nes. "GNUC") + (cc_com .nes. "GNUC") $ then $ write sys$output "Unsupported compiler choice ''cc_com' ignored" $ write sys$output "Use DECC, VAXC, or GNUC instead" $ else -$ if cc_com .eqs. "DECC" then its_decc = true -$ if cc_com .eqs. "VAXC" then its_vaxc = true -$ if cc_com .eqs. "GNUC" then its_gnuc = true +$ if cc_com .eqs. "DECC" then its_decc = true +$ if cc_com .eqs. "VAXC" then its_vaxc = true +$ if cc_com .eqs. "GNUC" then its_gnuc = true $ endif $ endif $ if f$locate("MAKE=",cparm) .lt. f$length(cparm)