diff options
622 files changed, 6897 insertions, 3761 deletions
diff --git a/lib/freetype/CMakeLists.txt b/lib/freetype/CMakeLists.txt index cd04b9745..554b580e9 100644 --- a/lib/freetype/CMakeLists.txt +++ b/lib/freetype/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright (C) 2013-2022 by +# Copyright (C) 2013-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written originally by John Cary <cary@txcorp.com> @@ -61,6 +61,8 @@ # # Some notes. # +# - Say `cmake -LAH` to see all configuration options. +# # - `cmake' creates configuration files in # # <build-directory>/include/freetype/config @@ -121,7 +123,6 @@ endif () include(CheckIncludeFile) include(CMakeDependentOption) -include(FindPkgConfig) # CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which # configures the base build environment and references the toolchain file @@ -162,8 +163,8 @@ endif () project(freetype C) set(VERSION_MAJOR "2") -set(VERSION_MINOR "12") -set(VERSION_PATCH "1") +set(VERSION_MINOR "13") +set(VERSION_PATCH "0") # Generate LIBRARY_VERSION and LIBRARY_SOVERSION. set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'") @@ -216,6 +217,8 @@ cmake_dependent_option(FT_REQUIRE_BROTLI "Require support of compressed WOFF2 fonts." OFF "NOT FT_DISABLE_BROTLI" OFF) +option(FT_ENABLE_ERROR_STRINGS + "Enable support for meaningful error descriptions." OFF) # Disallow in-source builds if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") @@ -245,6 +248,8 @@ endif () # Find dependencies +include(FindPkgConfig) + if (NOT FT_DISABLE_HARFBUZZ) set(HARFBUZZ_MIN_VERSION "2.0.0") if (FT_REQUIRE_HARFBUZZ) @@ -353,6 +358,12 @@ if (BROTLIDEC_FOUND) FTOPTION_H "${FTOPTION_H}") endif () +if (FT_ENABLE_ERROR_STRINGS) + string(REGEX REPLACE + "/\\* +(#define +FT_CONFIG_OPTION_ERROR_STRINGS) +\\*/" "\\1" + FTOPTION_H "${FTOPTION_H}") +endif () + set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h") if (EXISTS "${FTOPTION_H_NAME}") file(READ "${FTOPTION_H_NAME}" ORIGINAL_FTOPTION_H) @@ -497,6 +508,13 @@ if (BUILD_FRAMEWORK) ) endif () +# 'freetype-interface' is an interface library, to be accessed with +# `EXPORT_NAME Freetype::Freetype`. This is the target name provided by +# CMake's `FindFreetype.cmake`, so we provide it for compatibility. +add_library(freetype-interface INTERFACE) +set_target_properties(freetype-interface PROPERTIES + EXPORT_NAME Freetype::Freetype + INTERFACE_LINK_LIBRARIES freetype) set(PKGCONFIG_REQUIRES "") set(PKGCONFIG_REQUIRES_PRIVATE "") @@ -614,7 +632,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) COMPATIBILITY SameMajorVersion) install( - TARGETS freetype + TARGETS freetype freetype-interface EXPORT freetype-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/lib/freetype/ChangeLog b/lib/freetype/ChangeLog index fa14b51bc..16faf18b6 100644 --- a/lib/freetype/ChangeLog +++ b/lib/freetype/ChangeLog @@ -1,3 +1,1750 @@ +2023-02-09 Werner Lemberg <wl@gnu.org> + + * Version 2.13 released. + ========================== + + Tag sources with `VER-2-13-0'. + + * docs/VERSION.TXT: Add entry for version 2.13. + * docs/CHANGES: 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.12.1/2.13/, s/2121/2130/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 13. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 25:0:19. + * CMakeLists.txt (VERSION_MINOR): Set to 13. + (VERSION_PATCH): Set to 0. + +2023-02-09 Alexei Podtelezhnikov <apodtele@gmail.com> + + Comment on `FT_GlyphSlot_Slant'. + +2023-02-08 Werner Lemberg <wl@gnu.org> + + [autofit] Fix 'multi' compilation. + + * src/autofit/ft-hb.c: Decorate with `FT_LOCAL_DEF`. + Add ANSI boilerplate code for otherwise empty file. + * src/autofit/ft-hb.h: Include `compiler-macros.h` and `freetype.h`. + Use `FT_BEGIN_HEADER` and `FT_END_HEADER`. + Decorate with `FT_LOCAL`. + + * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `ft-hb.c`. + +2023-02-08 Werner Lemberg <wl@gnu.org> + + Fix `FT_LOCAL` and `FT_LOCAL_DEF` tags. + +2023-02-08 Werner Lemberg <wl@gnu.org> + + Fix 'fall-through' warning messages. + + Modern compilers get more insistent on that... + + * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Define. + * src/*: Use it instead of `/* fall through */` comments. + +2023-02-08 Werner Lemberg <wl@gnu.org> + + For debugging, avoid implicit conversion from integer to double. + + Otherwise we get zillions of clang 15 warnings. + + * src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c, + src/base/ftobjs.c, src/base/ftoutln.c, src/cff/cffparse.c, + src/raster/ftraster.c, src/sfnt/pngshim.c, src/truetype/ttgload.c, + src/truetype/ttgxvar.c, src/truetype/ttobjs.c, src/type1/t1gload.c: Use + `double` cast in debugging and tracing macros. + +2023-02-08 Werner Lemberg <wl@gnu.org> + + Avoid reserved identifiers that are globally defined. + + This is mandated by the C99 standard, and clang 15 produces zillions of + warnings otherwise. + + * devel/ftoption.h, include/freetype/config/ftoption.h, + include/freetype/internal/ftmemory.h, src/autofit/afhints.h, + src/autofit/afmodule.c, src/autofit/aftypes.h, src/base/ftadvanc.c, + src/base/ftdbgmem.c, src/base/ftstream.c, src/bdf/bdflib.c, + src/truetype/ttinterp.c: Replace identifiers of the form `_foo` with `foo_`. + +2023-02-08 Werner Lemberg <wl@gnu.org> + + Fix minor clang and clang++ warnings. + +2023-02-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype, type1] Additional variation tags. + + Sync with + https://learn.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg#registered-axis-tags + + * src/truetype/ttgxvar.h (TTAG_ital): New tag. + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use it. + * src/type1/t1load.c (T1_Get_MM_Var): Handle 'slnt' and 'ital'. + +2023-02-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftsynth.c (FT_GlyphSlot_Slant): Add vertical slant. + * include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Update it. + +2023-02-08 anuj <95867901+anuj99@users.noreply.github.com> + + [sdf] Use 32-bit integers internally. + + * src/sdf/ftsdfcommon.h (FT_16D16, FT_26D6): Use 32-bit integers + instead of `FT_Fixed` for internal data types. `FT_Fixed` i.e. + `signed long` is 64-bit on some architectures. + +2023-02-07 Werner Lemberg <wl@gnu.org> + + docs/CHANGES: Updated. + +2023-02-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + Comment on optional ascender and descender. + +2023-02-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/type1/t1afm.c (T1_Read_Metrics): Reaffirm ascender and descender. + +2023-02-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/type1/t1afm.c (T1_Read_Metrics): Validate ascender and descender. + + The ascender and descender are optional in the AFM specifications. + They could be omitted or even set to zero, e.g., in the current release + of URW++ base 35 fonts. + +2023-02-02 Werner Lemberg <wl@gnu.org> + + * src/cff/cffgload.c (cff_slot_load): Avoid memory leak. + + Fixes issue #1204. + +2023-02-01 Werner Lemberg <wl@gnu.org> + + * src/truetype/ttgxvar.c (tt_var_get_item_delta): Check `face->blend`. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55581 + +2023-02-01 Werner Lemberg <wl@gnu.org> + + * docs/CHANGES: Add news for 'freetype-demos'. + +2023-01-30 Werner Lemberg <wl@gnu.org> + + * subprojects/harfbuzz.wrap, subprojects/libpng.wrap: Updated. + +2023-01-28 Werner Lemberg <wl@gnu.org> + + Minor changes. + + Comment fixes, typos, removing of unnecessary parentheses. + +2023-01-28 Werner Lemberg <wl@gnu.org> + + Whitespace. + +2023-01-27 Behdad Esfahbod <behdad@behdad.org> + + [ttgxvar] Fix crash in COLRv1. + + This is a stopgap until issue #1202 is properly fixed. + + * src/truetype/ttxgvar.c (tt_var_get_item_delta): Check `normalizedcoords`. + +2023-01-19 Werner Lemberg <wl@gnu.org> + + The 'COLR' v1 API will no longer be experimental in the next release. + +2023-01-18 Alexei Podtelezhnikov <apodtele@gmail.com> + + * docs/oldlogs/ChangeLog.210: Typos. + +2023-01-18 Ben Wagner <bungeman@chromium.org> + + [base] Fix typo. + + * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Request module 't1cid', + not 'cid'. + +2023-01-18 Ben Wagner <bungeman@chromium.org> + + [base] Return error if requested driver is not found. + + In `open_face_from_buffer` it is possible that a driver is requested but + FreeType was built without the requested module. Return an error in this + case to indicate that the request could not be satisfied, rather than trying + all existing driver modules. + + * src/base/ftobjs.c (open_face_from_buffer): Return `FT_Err_Missing_Module` + if a driver is specified but not found. + +2023-01-18 Dominik Röttsches <drott@chromium.org> + + [sfnt] Avoid nullptr dereference in reading malformed 'COLR' v1 table. + + Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1408044. + + * src/sfnt/ttcolr.c (tt_face_load_colr): When the 'COLR' v1 table header is + too small, don't deallocate delta set index map structures. + +2023-01-17 Werner Lemberg <wl@gnu.org> + + * src/tools/update-copyright: Allow execution from other repositories. + + We use this for `freetype-demos`. + +2023-01-17 Werner Lemberg <wl@gnu.org> + + Update all copyright notices. + +2023-01-17 Werner Lemberg <wl@gnu.org> + + * src/tools/no-copyright: Updated. + +2023-01-17 Ben Wagner <bungeman@chromium.org> + + [base] 'close' callback may not use `stream->memory`. + + The documentation for `FT_StreamRec::memory` states that it 'shouldn't be + touched by stream implementations'. This is true even for internal + implementations of the 'close' callback, since it is not guaranteed that + `memory` will even be set when the 'close' callback occurs. + + * src/base/ftobjs.c (new_memory_stream): stash current `memory` in + `stream->descriptor`. + (memory_stream_close): Use it. + +2023-01-17 Ben Wagner <bungeman@chromium.org> + + [base] Always close user-provided stream. + + The `FT_Open_Face` documentation states + + > If `FT_OPEN_STREAM` is set in `args->flags`, the stream in `args->stream` + > is automatically closed before this function returns any error (including + > `FT_Err_Invalid_Argument`). + + However, if the user provides a stream in `args.stream` with + `FT_OPEN_STREAM` set and a `close` function, but then for some reason passes + NULL for `aface` and a non-negative `face_index`, the error + `Invalid_Argument` is returned but the `close` callback will not be called + on the user-provided stream. This may cause resource leaks if the caller is + depending on the `close` callback to free resources. + + The difficulty is that a user may fill out a `FT_StreamRec` and pass its + address as `args.stream`, but the stream isn't really 'live' until + `FT_Stream_New` is called on it (and `memory` is set). In particular, it + cannot really be cleaned up properly in `ft_open_face_internal` until the + stream pointer has been copied into the `stream` local variable. + + * src/base/ftobj.c (ft_open_face_internal): Ensure that user-provided + `args.stream.close` is called even with early errors. + +2023-01-17 Ben Wagner <bungeman@chromium.org> + + [base] Fix leak of internal stream marked external. + + `open_face_from_buffer` allocates a new `FT_Stream` to pass to + `ft_open_face_internal`. Because this is an `FT_OPEN_STREAM`, + `ft_open_face_internal` will mark this as an 'external stream', which the + caller must free. However, `open_face_from_buffer` cannot directly free it + because the stream must last as long as the face. There is currently an + attempt at this by clearing the 'external stream' bit after + `open_face_from_buffer` returns successfully. However, this is too late as + the original stream may have already been closed and the stream on the face + may not be the same stream as originally passed. + + It is tempting to use `FT_OPEN_MEMORY` and let `ft_open_face_internal` + create the stream internally. However, with this method there is no means + to pass through a 'close' function to the created stream to free the + underlying data, which must be owned by the stream. + + A possibility is to check on success if the stream of the face is the same + as the original stream. If it is then unset the external flag. If not, + then free the original stream. Unfortunately, while no current + implementation does so, it is possible that the face still has the original + stream somewhere other than as the `FT_FaceRec::stream`. The stream needs + to remain available for the life of the face or until it is closed, + whichever comes earlier. + + The approach taken here is to let the stream own itself. When the stream is + closed it will free itself. + + * src/base/ftobjs.c (memory_stream_close): Free `stream`. + (open_face_from_buffer): Simplify error handling, since + `ft_open_face_internal` always closes `args.stream` on any error. + + Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54930 + +2023-01-16 Werner Lemberg <wl@gnu.org> + + sr/*.c: Various minor fixes. + + * src/autofit/ft-hb.c (_hb_ft_reference_table): Call `FT_UNUSED` after + variable declarations. + + * src/gxvalid/gxvjust.c (gxv_just_widthDeltaClusters_validate): Eliminate + unused variable. + + * src/gzip/ftgzip.c: Don't call GCC '-Wstrict-prototypes' pragma for C++ + compiler. + + * src/sfnt/ttcolr.c (ENSURE_READ_BYTES): Remove final semicolon to avoid + compiler warning. + + * src/sfnt/ttsvg.c (tt_face_load_svg_doc): Fix signedness warning. + +2023-01-16 Dominik Röttsches <drott@chromium.org> + + [sfnt] Remove temporary runtime flag for variable 'COLR' v1. + + Fixes #1187. + + * src/sfnt/ttcolr.c (top level, read_paint, tt_face_load_colr, + tt_face_free_colr, get_deltas_for_var_index_base, + tt_face_get_color_glyph_clipbox, tt_face_get_colorline_stops): Remove macro + definition `VARIABLE_COLRV1_ENABLED` and its usage. + + * src/truetype/ttdriver.c (tt_property_set): Remove parsing of + 'TEMPORARY-enable-variable-colrv1' property name. + + * src/truetype/ttobjs.h (TT_DriverRec): Remove `enable_variable_colrv1` + flag. + +2023-01-07 Werner Lemberg <wl@gnu.org> + + * src/autofit/ft-hb.c (_hb_ft_reference_table): Minor integration fixes. + +2023-01-07 Ben Wagner <bungeman@chromium.org> + + [truetype] Reset cvt and storage in context load. + + Currently the cvt and storage are saved and restored in `TT_RunIns`. + However, this is too granular as the cvt and storage area should be set to + the original cvt and storage area only when setting up the hinting context. + This allows for the cvt and storage area to be modified while parsing + multiple glyphs, as is the case with composite glyphs. + + * src/truetype/ttinterp.h (TT_ExecContextRec): Remove `origCvt` and + `origStorage`. + + * src/truetype/ttinterp.c (TT_RunIns): Don't save and restore the cvt and + storage area. + (Modify_CVT_Check, Ins_WS): Switch from "if in glyph and using original data + do copy on write" to "if in glyph and not using glyph specific data do copy + on write". + +2023-01-06 Matthias Clasen <mclasen@redhat.com> + + [autofit] Don't depend on 'hb-ft'. + + The circular dependency is still there, but at least we no longer depend on + the HarfBuzz API that is only present if HarfBuzz has been built with + FreeType support, making the bootstrapping a bit easier. + + * src/autofit/ft-hb.c, src/autofit/ft-hb.h: New files, providing + `_hb_ft_font_create`, which is more or less a verbatim copy of the + corresponding HarfBuzz code from file `hb-ft.cc`. + + * src/autofit/afglobal.c (af_face_globals_new): Use it. + * src/autofit/afshaper.h: Don't include `hb-ft.h` but `ft-hb.h`. + * src/autofit/autofit.c: Include `ft-hb.c`. + + * LICENSE.TXT: Updated. + +2023-01-06 Ben Wagner <bungeman@chromium.org> + + [truetype] Keep variation store consistent. + + `tt_var_load_item_variation_store` fills out a `GX_ItemVarStore`. While it + may return an error, the item store must be left in a consistent state so + that any use or destruction of the item store can properly use or free the + data in it. Before this change the counts from the font data were read + directly into the item store before the actual allocation of the arrays to + which they referred. There exist many opportunities between the time the + counts are read and the arrays are allocated to return early due to invalid + data. When this happened the item store claimed to have entires it actually + did not, leading to crashes later when it was used. + + Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54449 + + * src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Read the counts + into local variables and store them in the item store only after the related + arrays are actually created on the item store. + +2023-01-05 Ben Wagner <bungeman@chromium.org> + + [base] Report used stream's external status. + + In `open_face` the initial stream is set on the face, along with the + information about if FreeType is the owner of the stream object itself. The + loaders may in the course of their work replace this stream with a new + stream (as is the case for 'woff' and 'woff2'), which may have a different + ownership than the initial stream object (likely the original stream object + is owned by the user and is external, while the new stream object is created + internally to FreeType and is internal). When the stream is replaced, the + face's flags are updated with the new ownership status. + + However, `open_face` cannot itself free this stream as its caller + `ft_open_face_internal` is responsible for this. In addition, in the case + of an error `open_face` cannot return an actual face with the new stream and + its ownership status to the caller. As a result, it must pass this + information back to the caller as a sort of "failed face" so that the caller + can clean up. + + `open_face` was already passing back the new stream but was not passing back + the stream ownership information. As a result the stream may not have been + free'd when needed. + + Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54700 + + * src/base/ftobjs.c (open_face): Pass back the ownership information as + well. + (ft_open_face_internal): Updated. + +2023-01-05 Noah Cabral <cnoah1705@gmail.com> + + fix spelling err in LICENSE.txt + +2023-01-05 Dominik Röttsches <drott@chromium.org> + + [sfnt] Fix color stop bounds check calculation at table end. + + Fixes https://bugs.chromium.org/p/skia/issues/detail?id=14021 + + * src/sfnt/ttcolr.c (VAR_IDX_BASE_SIZE): New macro. + (tt_face_get_colorline_stops): Fix off-by-one bounds check calculation, take + `VarColorStop` into account, and hopefully make it easier to read. + +2023-01-05 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftobjs.c (FT_Request_Metrics): Avoid division by zero. + + The division-by-zero might happen in broken fonts (see #1194). + Instead of returning a huge number from FT_DivFix and failing + to scale later, we now bail immediately. + +2022-12-20 Alexei Podtelezhnikov <apodtele@gmail.com> + + [psaux] Delay the upem validity assertion.
+
+ Fixes #1194.
+
+ * src/psaux/psft.c (cf2_getUnitsPerEm): Remove the upem assert.
+ (cf2_checkTransform): Assert the upem validity after checking the scale. + +2022-12-14 David Vanderson <david.vanderson@gmail.com> + Werner Lemberg <wl@gnu.org> + + [gzip] Make static compilation not leak global symbols. + + * src/gzip/ftgzip.c (HAVE_HIDDEN): Do not define; it is no longer needed + because everything is static. + (HAVE_MEMCPY): Define. + (zcalloc, zcfree): Remove no longer needed definitions (because `Z_SOLO` is + active). + + * src/gzip/patches/freetype-zlib.diff: Regenerated. + + Fixes #1146. + +2022-12-14 Werner Lemberg <wl@gnu.org> + + * src/gzip/ftzconf.h: Updated to zlib 1.2.13. + + I forgot to copy that file. + +2022-12-14 Werner Lemberg <wl@gnu.org> + + * builds/unix/configure.raw: Don't check for `memcpy` and `memmove`. + + We expect a C99 compiler, and both functions are part of this standard. + +2022-12-13 Werner Lemberg <wl@gnu.org> + + [sdf, sfnt] Handle minor compiler warnings. + + * src/sdf/ftsdf.c (get_min_distance_conic): Initialize `nearest_point`. + + * src/sfnt/ttsvg.c (find_doc): Initialize `mid_doc`. + + Fixes #1195. + +2022-12-07 Werner Lemberg <wl@gnu.org> + + * subprojects/zlib.wrap: Micro-update from upstream. + +2022-12-06 Jiřà Malák <malak.jiri@gmail.com> + + * include/freetype/internal/ftcalc.h (FT_MSB): Support Open Watcom 2.0. + + Closes !232. + +2022-11-23 Luca Bacci <luca.bacci982@gmail.com> + + * src/base/ftdbgmem.c (ft_mem_source_compare): Add FT_COMPARE_DEF. + + Closes !230. + +2022-11-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/autofit/afloader.c (af_loader_load_glyph): Remove `size` check. + + This is done by `FT_Load_Glyph`. + +2022-11-18 Alexei Podtelezhnikov <apodtele@gmail.com> + + Comments added. + +2022-11-16 Johan Matsson <mjunix@ at github> + + * src/autofit/afloader.c (af_loader_load_glyph): Fix dereference. + + This must happen after the NULL check. + + Taken from + + https://github.com/freetype/freetype/pull/2 + +2022-11-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/pcf/pcfutil.c ({Two,Four}ByteSwap): Use builtins or shifts. + + We trust glibc which uses shifts or builtins to swap bytes. This + must be more efficient. + +2022-11-14 Werner Lemberg <wl@gnu.org> + + * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50462 + +2022-11-14 Loïc Yhuel <loic.yhuel@softathome.com> + + [meson] Use generated ftmodule.h + + ftmodule.h is generated at the root of the build directory, but FT_CONFIG_MODULES_H + (freetype/config/ftmodule.h) is used instead. + This makes the build fail when disabling modules in modules.cfg. + + * meson.build (harfbuzz_dep): Add '-DFT_CONFIG_MODULES_H=<ftmodule.h>'. + +2022-11-14 Loïc Yhuel <loic.yhuel@softathome.com> + + [meson] Fix generated ftmodule.h + + The sdf module wasn't recognized, so the generated ftmodule.h had "None_renderer_class". + + * builds/meson/parse_modules_cfg.py: Handle sdf in RASTER_MODULES. + +2022-11-12 Dominik Röttsches <drott@chromium.org> + + Add `TT_CONFIG_OPTION_NO_BORING_EXPANSION` configuration macro. + + This gives users a possibility to deactivate new features not (yet) in the + OpenType standard. + + * include/freetype/config/ftoption.h, devel/ftoption.h + (TT_CONFIG_OPTION_NO_BORING_EXPANSION): New macro. + + * src/truetype/ttgxvar.c (ft_var_load_avar): Use it to disable 'avar' + version 2.0 support. + +2022-11-12 Behdad Esfahbod <behdad@behdad.org> + + [truetype] Improve bounds checks for `ItemVariationStore`. + + * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Move bounds check ... + (tt_var_get_item_delta): ... to this function, because it is safer. For + example, the 'avar' table 2.0 codepath was not performing a bounds check at + all. + +2022-11-12 Behdad Esfahbod <behdad@behdad.org> + + [truetype] In `ItemVariationStore`, value 0xFFFF for `dataCount` is valid. + + It corresponds to outer indices of 0 to 0xFFFE. + + * src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Remove invalid + code. + +2022-11-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [pcf] Improve CMap efficiency and readability. + + * src/pcf/pcfdrivr.c (pcf_cmap_char_{index,next}): Check and walk + the encoding array indexes. + +2022-11-10 Sam James <sam@gentoo.org> + + Fix `-Wstrict-prototypes`. + + * builds/unix/configure.raw: Fix `-Wstrict-prototypes`. + Clang 16 warns on these and they will be dropped in C23. + + * builds/unix/freetype2.m4: Ditto. + +2022-11-09 Ben Wagner <bungeman@chromium.org> + + [truetype] Check avar_segment before access + + * src/truetype/ttgxvar.c (tt_done_blend): check `avar_segment` before + accessing to free its `correspondence`. + + Reported as: + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53062 + +2022-11-09 Ben Wagner <bungeman@chromium.org> + + [truetype] Restore behavior of ft_var_load_hvvar + + * src/truetype/ttgcvar.c (ft_var_load_hvvar): restore previous behavior + + In a previous change [0] the behavior of `ft_var_load_hvvar` was changed + to not load the item variation store if it was at offset 0, but not + return an error when this happened. This broke any users, like + `tt_hvadvance_adjust`, that rely on successful completion of + `ft_var_load_hvvar` to imply that returned table's `itemStore` had been + initialized. This lead such users to dereference NULL. + + This change appears to have been unintentional and unrelated to the + actual avar2 changes. As a result, fix these NULL dereferences by + restoring the code to always attempt to initialize the `itemStore`. + + [0] ae4eb996 "[truetype] Add support for `avar` table 2.0 format." + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53061 + +2022-11-08 Werner Lemberg <wl@gnu.org> + + docs/CHANGES: Updated. + +2022-11-08 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + [build] use AC_CHECK_PROG() macro for libpng-config detection + + * builds/unix/configure.raw: use AC_CHECK_PROG() instead of `which` to find `libpng-config`. + +2022-11-08 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + + [build] fix for make multi + + Fix "make multi" by MR !223 + + * include/freetype/internal/services/svmm.h: include ftmm.h to define FT_Get_MM_Func. + * src/truetype/ttgxvar.h: include ftmmtypes.h to use GX_AVarTable properly. + * src/base/ftmac.c: include ftdebug.h to use FT_THROW() properly. + +2022-11-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Accelerate the search. + + This is mostly for consistency because PFR fonts with bitmap strikes + do not seem to exist. + +2022-11-06 Alexei Podtelezhnikov <apodtele@gmail.com> + + [bdf, pfr, psnames] Accelarate charmap searches. + + The binary searches within charmaps can be accelerated because they + often contain dense continuous blocks of character codes. Within such + blocks, you can predict matches based on misses. This method has been + deployed in `bdf` since 0f122fef34; we only refactor it there. We now + use it in `pfr` and `psnames`, which speeds up the unicode charmap + access by about 50% in PFR and Type 1 fonts. + + * src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Refactor. + * src/pfr/pfrcmap.c (pfr_cmap_char_{index,next}): Predict `mid` based + on the mismatch distance. + * src/psnames/psmodule.c (ps_unicodes_char_{index,next}): Ditto. + +2022-11-04 Behdad Esfahbod <behdad@behdad.org> + + [truetype] Add support for `avar` table 2.0 format. + + See + + https://github.com/harfbuzz/boring-expansion-spec/blob/main/avar2.md + + for the specification. + + Currently, this is implemented only in most recent OS versions on Apple + platforms and in the HarfBuzz library, but it is expected to be added to the + OpenType standard soon. + + * src/truetype/ttgxvar.h (GX_AVarTableRec): New structure. + (GX_BlendRec): Use it to replace `avar_segment` with `avar_table`. + + * src/truetype/ttgxvar.c (ft_var_load_avar): Load new table version. + (ft_var_to_normalized, tt_done_blend): Extend for new format. + (ft_var_load_hvvar, ft_var_to_design): Updated. + +2022-10-24 Werner Lemberg <wl@gnu.org> + + Replace '1/64th' (and similar entries) with '1/64' in docs and comments. + +2022-10-24 Ivan Panchenko <ivanpan3@gmail.com> + + * include/freetype/*: Fix documentation typos. + +2022-10-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/truetype/ttgload.c: Cosmetic changes. + +2022-10-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + [cff, truetype] Simplify SVG metrics scaling. + + Use pre-calculated scaling factors. Also, the advance widths used + to be rounded, which was incorrect. + + * src/cff/cffgload.c (cff_slot_load): Use `x_scale` and `y_scale`. + * src/truetype/ttgload.c (TT_Load_Glyph): Ditto. + +2022-10-20 Werner Lemberg <wl@gnu.org> + + * subprojects/zlib.wrap: Update to zlib version 1.2.13. + +2022-10-18 Dominik Röttsches <drott@chromium.org> + + [sfnt] Additional bounds checks for `COLR` v1 table handling. + + * src/sfnt/ttcolr.c (read_paint): Add `colr` argument, necessary for... + ... another use of `ENSURE_READ_BYTES`. + Update callers. + (tt_face_get_paint_layers): Ensure that the 4-byte paint table + offset can be read. + + This is a follow-up to !124 and issue + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404 + +2022-10-18 Werner Lemberg <wl@gnu.org> + + [gzip] Update sources to zlib 1.2.13. + +2022-10-18 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Simplify calculations. + +2022-10-18 Werner Lemberg <wl@gnu.org> + + Minor formatting. + +2022-10-18 Dominik Röttsches <drott@chromium.org> + + [sfnt] Guard individual `COLR` v1 paint field reads. + + * src/sfnt/ttcolr.c (ENSURE_READ_BYTES): New macro. + (read_paint): Use it – after the start pointer `p` has been checked for + whether it allows reading the format byte, each successive paint table field + read need to be bounds-checked before reading further values. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404 + +2022-10-17 Xiang Xiao <xiaoxiang@xiaomi.com> + + * builds/toplevel.mk: Prefix all paths with `$(TOP_DIR)/`. + + This is useful for builds that are not started from the root directory. + +2022-10-17 Liu Kunpeng(柳鲲é¹) <liukunpeng@ts-it.cn> + + * src/base/ftsynth.c (FT_GlyphSlot_Slant): New API with custom slant. + * include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Declare it. + +2022-10-15 Alexei Podtelezhnikov <apodtele@gmail.com> + + Note the lack of floating-point data types. + +2022-10-10 Werner Lemberg <wl@gnu.org> + + [cff] Remove `FT_CONFIG_OPTION_NO_GLYPH_NAMES`. + + This ancient option stayed completely undocumented. Given that the 'cff' + driver requires the 'psnames' module, it makes no sense today to have this + macro. + + * src/cff/cffdrivr.c (cff_services), src/cff/cffobjs.c (cff_face_init): + Remove corresponding conditional code. + +2022-10-10 Werner Lemberg <wl@gnu.org> + + Synchronize `ftoption.h` flavours. + +2022-10-10 Werner Lemberg <wl@gnu.org> + + Minor comment changes. + +2022-10-05 Alexei Podtelezhnikov <apodtele@gmail.com> + + Improve FT_Get_Name_Index docs and place it next to FT_Get_Glyph_Name. + +2022-10-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + [autofit] Reset the face charmap directly. + + There is no need to validate the original charmap in `FT_Set_Charmap`. + It can be reset directly. + + * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): + Use direct assignment. + * src/autofit/af{latin,cjk,indic}.c (af_latin_metrics_init): Ditto. + +2022-10-04 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/type1/t1afm.c (T1_Read_PFM): Set charmaps directly. + + As with the previous commit, we can avoid the validation checks + of `FT_Set_Charmap` and set it directly when choosing from the + available list. + +2022-10-03 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Avoid `FT_Set_Charmap`.
+
+ Set charmap aggressively without all validations of `FT_Set_Charmap`
+ because we take it from the available array and only temporarily.
+ Even CMap Format 14 will gracefully return 0. + +2022-10-03 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/cache/ftcbasic.c (ftc_basic_family_get_count): Remove redundancy. + +2022-09-30 Werner Lemberg <wl@gnu.org> + + * src/psaux/pshints.c (cf2_hintmap_insertHint): Fix midpoint computation. + + Replace '(start + end) / 2' with 'start + (end - start) / 2' to avoid + overflow. + + Fixes #1180. + +2022-09-30 Werner Lemberg <wl@gnu.org> + + * src/psaux/pshints.c (cf2_hintmap_build): Improve debugging output. + +2022-09-29 mlugg <mlugg@mlugg.co.uk> + + [truetype] Fix undefined pointer arithmetic. + + * src/truetype/ttgxvar.c (tt_var_get_item_delta, ft_var_load_mvar): Use + `FT_OFFSET`. + +2022-09-29 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Use lighter FT_DivFix. + +2022-09-29 Ali Chraghi <alichraghi@pm.me> + + [base] FT_Attach_Stream: Make `parameters` argument constant. + +2022-09-29 Azamat Hackimov <azamat.hackimov@gmail.com> + + * src/tools/*.py: Migrate to Python 3. + + Fixes #1185, closes !205. Formatting changes according to PEP8. + +2022-09-27 Dominik Röttsches <drott@chromium.org> + + [sfnt] Guard access in 'COLR' table when requesting child table pointer. + + * src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Tighten + pointer bounds checks. + (get_child_table_pointer): Check whether incoming pointer `p` lies within + the 'COLR' table. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51816 + +2022-09-27 Ben Wagner <bungeman@chromium.org> + + [sfnt] Add SVG document bounds checking. + + Add a check that the document content is actually contained within the + `SVG ` table. Without this check a malformed font may claim arbitrary + memory as its document content. + + * src/sfnt/ttsvg.c (tt_face_load_svg): Take `numEntries` into account when + testing 'documentRecord' extents. + (find_doc): Rename `stream` to `document_records` for clarity. + (tt_face_load_svg_doc): Split `doc` from `doc_list` pointer for clarity. + Test that the document content is contained within the table. + Ensure minimum length of document before testing for gzip format. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51812 + +2022-09-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Clean up the bitmap flow control. + + * src/base/ftbitmap.c (FT_Bitmap_Copy): Flip the copy if its pitch + is trully opposite, zero is not a positive value. + (FT_Bitmap_Convert): Set negative pitch as needed, accept negative + alignment values. + +2022-09-22 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Discard and recreate bitmaps for copying and converting.
+
+ Reusing target bitmaps for copying and converting is permitted. It is,
+ however, pointless to preserve their content before overwriting. Free-
+ malloc might be faster than realloc.
+
+ * src/base/ftbitmap.c (FT_Bitmap_Copy, FT_Bitmap_Convert): Free
+ an old buffer and create a new one. + +2022-09-16 Dominik Röttsches <drott@chromium.org> + + Reject 'COLR' table if version is 1 but header too small. + + * src/sfnt/ttcolr.c (tt_face_load_colr): If the version is determined to + be 1, then the table size has to be at least the size of the v1 header. + Also, for peeking the number of base glyphs and entries in the layer list, + ensure that the table is sufficiently long. + + Fixes #1179. Original patch by Sergey Temnikov. + +2022-09-15 Werner Lemberg <wl@gnu.org> + + * src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix format 1 handling. + + Fixes #1181. + +2022-09-06 Dominik Röttsches <drott@chromium.org> + + [truetype] Reject 'fvar' loading when `num_instances` is too small. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Reject retrieving master when + 'fvar' values locally do not match with sanitized values from initialization + at `sfnt_init_face` time. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=1360295 + +2022-09-05 Dominik Röttsches <drott@chromium.org> + + [sfnt] Handle variable `COLR` v1 fonts without delta set index map + + Fixes #1178. + + * src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Set outer index to + 0 and inner index to the delta index when retrieving deltas if the + `COLR` table has no delta set index map. + +2022-09-05 Dominik Röttsches <drott@chromium.org> + + [sfnt] Pointer sanity checks before reading layer info in 'COLR' v0 + + * src/sfnt/ttcolr.c (tt_face_get_colr_layer): Check that the pointer to + read from is within the 'COLR' table. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50633 + +2022-09-05 Werner Lemberg <wl@gnu.org> + + [autofit] Minor fix. + + * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Avoid + compiler warning. + +2022-09-05 Dominik Röttsches <drott@chromium.org> + + [sfnt] Don't require 'gvar' table to support variation fonts. + + Fixes #1172. + + * src/sfnt/sfobjs.c (sfnt_load_face): Tag font as Multiple Masters font if + `fvar` is present; do not require other tables to be present. + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Allow for a missing 'gvar' table + when setting variation coordinates. However, if a 'gvar' table is actually + present, do perform a sanity check and fail on malformedness. + (TT_Get_MM_Var): Don't assume 'fvar' needs 'gvar' or 'CFF2 tables in all + cases, which is an overly tight check. + +2022-08-27 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftver.rc: Explicitly use UTF-16. + + Fixes #1177 to avoid mistranslation and other problems. + +2022-08-26 Dominik Röttsches <drott@chromium.org> + + [sfnt] Avoid undefined shifts in `COLR` v1 color line retrieval + + * src/sfnt/ttcolr.c (tt_face_get_colorline_stops): Disambiguate shift + behavior by using multiplication using macros from ftcalc.h. + + Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50573 + +2022-08-21 Sean Farrell <sean.farrell@rioki.org> + + CMakeLists.txt (FT_ENABLE_ERROR_STRINGS): New configuration option. + + This option uncomments FreeType configuration macro + `FT_CONFIG_OPTION_ERROR_STRINGS` to make function `FT_Error_String` return + meaningful error strings. + + This option is off by default. + +2022-08-21 Chris Liddell <chris.liddell@artifex.com> + + [base, type1] Better handling of out-of-memory situations. + + This follows similar code in `cff_slot_done`. + + * src/base/ftobjs.c (ft_glyphslot_done), src/type1/t1objs.c + (T1_GlyphSlot_Done): Check `internal` pointer. + + The Type1 problems was reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50057. + +2022-08-06 Tim-Philipp Müller <tim@centricular.com> + + ci: bump windows image and use newer runner and vs2019 + + The old 1809 runner will be decommissioned at some point. + +2022-08-04 @udoudou <> + + * src/cache/ftcmanag.c (FTC_Manager_New): Initialize `cur_weight`. + + See !192. + +2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/ttload.c: Trace formatting updates. + +2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/psaux/psobjs.c (ps_table_release): Remove redundant casting. + +2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Reduce casting. + +2022-08-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + [cache] Remove some casts, clean up tracing. + + * src/cache/ftcbasic.c (FTC_ImageCache_Lookup, FTC_SBitCache_Lookup): + Clean up tracing types. + * src/cache/ftccache.c (ftc_node_destroy): Ditto. + * src/cache/ftcmanag.c (FTC_Manager_Check): Ditto. + (FTC_Manager_Check, FTC_Node_Unref): Remove a cast. + * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto. + +2022-08-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [autofit] Updated to reduce casting (cont'd). + + * src/autofit/afmodule.h (AF_ModuleRec): Change `default_script` type. + * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): + Remove casting. + * src/autofit/afmodule.c (af_property_{set,get}): Updated accordingly. + +2022-08-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [autofit] Updated to reduce casting. + + * src/autofit/afglobal.h (AF_FaceGlobalsRec): Change `glyph_count` type. + * src/autofit/afglobal.c (af_face_globals_compute_style_coverage, + af_face_globals_get_metrics, af_face_globals_is_digit, + af_face_globals_new): Changed local types and updated accordingly. + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Ditto. + +2022-08-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [psaux] Remove unused structure field. + + * include/freetype/internal/psaux.h (PS_TableRec): Remove `num_elems`. + * src/psaux/psobjs.c (ps_table_new): Remoove its initialization. + +2022-07-30 Dominik Röttsches <drott@chromium.org> + + [sfnt] Implement VarClipBox. + + * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Depending on the + format, read `var_index_base`, then retrieve and apply scaled deltas. + +2022-07-30 Dominik Röttsches <drott@chromium.org> + + [sfnt] Fix typo in clip box computation. + + * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Use appropriate + scale factor for `yMin` and `yMax`. + +2022-07-30 Alexei Podtelezhnikov <apodtele@gmail.com> + + [autofit] Use unsigned accounting for hints. + + * src/autofit/afhints.h (AF_AxisHintsRec): Use unsigned types. + + * src/autofit/afhints.c (af_axis_hints_new_{segment,edge}, + af_glyph_hints_get_num_segments, af_glyph_hints_get_segment_offset): + Updated accordingly. + * src/autofit/aflatin.c (af_cjk_hints_compute_edges): Ditto. + * src/autofit/afcjk.c (af_cjk_hints_compute_edges): Ditto. + +2022-07-30 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/autofit/afhints.h: Remove dead code. + +2022-07-29 Werner Lemberg <wl@gnu.org> + + * src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error. + +2022-07-29 Werner Lemberg <wl@gnu.org> + + Fix compilation if `TT_CONFIG_OPTION_GX_VAR_SUPPORT` is not set. + + * src/sfnt/ttcolr.c: Protect relevant code with + `TT_CONFIG_OPTION_GX_VAR_SUPPORT`. + +2022-07-29 Werner Lemberg <wl@gnu.org> + + Fix clang14 compiler warnings. + + * include/freetype/internal/ftstream.h (FT_GET_SHORT_LE, FT_GET_USHORT_LE): + Fix type. + + * src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Always return boolean + value. + (tt_face_get_colorline_stops): Fix type of `var_index_base`. + +2022-07-26 Alexei Podtelezhnikov <apodtele@gmail.com> + + [pfr] Fortify the kerning code. + + Any array index must be strictly less then the array size. Therefore, + we must reject indexes that are equal to the array size. Alternatively, + we should move the bounds check before the index decrement but that + would be confusing. + + In addition, it is ok to decrement zero (.notdef) and get UINT_MAX, + which is then automatically rejected in the bounds check. + + * src/pfr/pfrobjs.c (pfr_face_get_kerning): Fix the bounds checking. + +2022-07-26 Werner Lemberg <wl@gnu.org> + + [pfr] Add some safety guards. + + * src/pfr/pfrload.c (pfr_phy_font_load): Check resolutions and number of + characters. + + Fixes #1174. + +2022-07-26 Werner Lemberg <wl@gnu.org> + + * src/pfr/*.c: Trivial improvements and formatting. + +2022-07-24 Werner Lemberg <wl@gnu.org> + + * configure: s/egrep/grep -E/ + + `egrep` is deprecated. + +2022-07-23 Ben Wagner <bungeman@chromium.org> + + [base] Build outlines in amortized constant time. + + When resizing the loader's points and contours, resize them to at least 1.5 + times their current size. The code currently only reserves as much space as + is currently required, leading to O(n^2) runtime when adding points one at a + time. + + This change does not attempt to ever shrink the loader's point and contour + storage since this was not attempted previously either. The 1.5 multiple + was chosen as a trade-off between potentially unused space and the runtime. + + * src/base/ftgloader.c (FT_GlyphLoader_CheckPoints): Implement it. + + Fixes #1173. + +2022-07-09 Dominik Röttsches <drott@chromium.org> + + [sfnt] Support variable 'COLR' v1 `PaintVarSkew*`. + + * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW`, + `FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER`, and + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER`. + (read_paint): Handle new enumeration values. + +2022-07-09 Dominik Röttsches <drott@chromium.org> + + [sfnt] Support variable 'COLR' v1 `PaintVarRotate*`. + + * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE` and + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER`. + (read_paint): Handle new enumeration values. + +2022-07-09 Dominik Röttsches <drott@chromium.org> + + [sfnt] Support 'COLR' v1 variable `PaintVarScale*`. + + * src/sfnt/ttcolr.c: (FT_PaintFormatInternal): New enumeration values + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE`, + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER`, + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM`, and + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER`. + (read_paint): Handle new enumeration values. + +2022-07-09 Dominik Röttsches <drott@chromium.org> + + [sfnt] Support for 'COLR' v1 variable translate. + + * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE`. + (read_paint): Handle new enumeration value. + +2022-07-09 Dominik Röttsches <drott@chromium.org> + + [sfnt] Support for 'COLR' v1 variable transforms. + + * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM`. + (read_paint): Handle new enumeration value. + +2022-07-09 Dominik Röttsches <drott@chromium.org> + + [sfnt] Deltas for 'COLR' v1 gradient coordinates. + + * src/sfnt/ttcolr.c (read_paint) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Read and + apply deltas to radial, linear, and sweep gradient coordinates such as 'p0', + 'p1', 'p2', 'center', 'radii', and 'angles'. + +2022-07-08 Dominik Röttsches <drott@chromium.org> + + [sfnt] Support variable 'COLR' v1 color lines. + + * include/freetype/ftcolor.h (FT_ColorStopIterator): Add field + `read_variable` to indicate whether a variation index base should be read. + + * src/sfnt/ttcolr.c: (FT_PaintFormat_Internal): New enumerations + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT` + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT`, and + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT`. + (read_color_line): New parameter `read_variable`; update callers. + (read_paint): Handle new enumerations. + +2022-07-07 Dominik Röttsches <drott@chromium.org> + + [sfnt] Apply variation deltas to `PaintVarSolid`. + + * src/sfnt/ttcolr.c (FT_PaintFormat_Internal_): New enumeration + `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`. + + (get_deltas_for_var_index_base) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New + function to retrieve an array of delta values, which will be used for most + of 'COLR' v1 variation formats (in follow-up commits). + + (read_paint): Add `face` parameter; update caller. + Handle `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`. + +2022-07-07 Dominik Röttsches <drott@chromium.org> + + [sfnt] Check safety of cast to `TT_Driver` before accessing member. + + * src/sfnt/ttcolr.c (VARIABLE_COLRV1_ENABLED): Access + `enable_variable_colrv1` only if driver class matches. + +2022-07-06 Stephen Holdaway <stecman@gmail.com> + + doc: Clarify description of `FT_Stream_IoFunc`. + + The existing documentation comments on `FT_Stream_IoFunc` hinted at the dual + seek/read behavior required for custom stream implementations to work, but + it didn't explicitly explain it. Without looking at the internals of + FreeType, it was easy for someone to assume their implementation should + handle both seek and read operations all the time. If this is done, you get + a variety of errors, but mostly just `Unknown_File_Format` (error code + 0x02). + +2022-07-04 Dominik Röttsches <drott@chromium.org> + + [sfnt] Load variation store for 'COLR' v1. + + * src/sfnt/ttcolr.c: Include `ttobjs.h` temporarily. + (VARIABLE_COLRV1_ENABLED): New temporary macro to detect whether variable + COLRv1 is enabled. + (Colr): New fields `var_store` and `delta_set_idx_map`. + (tt_face_load_colr, tt_face_free_colr) [VARIABLE_COLRV1_ENABLED]: Load and + free variation store data using the functions from the Multiple Masters + service. + +2022-07-03 Chris Liddell <chris.liddell@artifex.com> + + [base] Improve error handling in `FT_GlyphLoader_CheckPoints`. + + If `FT_GlyphLoader_CreateExtra` returns an error (and a couple of other + places), `FT_GlyphLoader_CheckPoints` would propagate the error immediately, + rather than cleaning up the partially set up `FT_GlyphLoader`. As a + consequence, a subsequent attempt to create a glyph could result in a crash. + + * src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Ensure all the error + conditions exits are consistent, eventually calling `FT_GlyphLoader_Reset`. + +2022-07-03 Thomas Sondergaard <thomas@sondergaard.cc> + + CMakeLists.txt: Provide both 'freetype' and 'Freetype::Freetype' targets. + + FreeType can be located by consuming projects that use + `find_package(Freetype)` either via the old `MODULE` path (which uses + `FindFreetype.cmake` supplied by CMake), or via the new `CONFIG` path (which + uses `freetype-config.cmake` as supplied by this project). Up to this point + the CMake module has supplied the target `Freetype::Freetype` and the config + file provided by this project the target `freetype`. Now we supply both + `freetype` and `Freetype::Freetype` so that consuming projects can always + use the target `Freetype::Freetype` regardless of what path was taken by + `find_package(Freetype)`. + + Fixes #1165. + +2022-07-02 Werner Lemberg <wl@gnu.org> + + include/freetype/ftmm.h: Improve documentation. + +2022-07-01 Dominik Röttsches <drott@chromium.org> + + [base] Round values in `FT_MulAdd_Fix`. + + This avoids regressing Blink layout tests and makes `FT_MulAdd_Fix` delta + retrieval implementation consistent with the previous implementation, which + used `FT_fixedToInt` and included rounding. + + * src/base/ftcalc.c (FT_MulAdd_Fix): Implement it. + Also fix remaining `temp` initialization compilation issue. + + Fixes #1169. + +2022-07-01 Werner Lemberg <wl@gnu.org> + + Minor formatting. + +2022-06-30 Dominik Röttsches <drott@chromium.org> + + Fix initialisation of temp variable in new FT_MulAddFix + + src/truetype/ttgxvar.c (FT_MulAddFix): Initialise `temp`. + +2022-06-29 Dominik Röttsches <drott@chromium.org> + + [truetype] Perform variation store delta computation with 64-bit precision. + + * include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Make type + explicitly 32-bit. + * include/freetype/internal/services/svmm.h + (FT_Var_Get_Item_Delta_Func): Change return type to `FT_ItemVarDelta` + * truetype/ttgxvar.h (tt_var_get_item_delta): Change return type to + `FT_ItemVarDelta`. + * truetype/ttgxvar.c (tt_var_get_item_delta): Store scalars and deltas + to intermediate array, perform computation using new method + `FT_MulAddFix`. + +2022-06-29 Dominik Röttsches <drott@chromium.org> + + New function `FT_MulAddFix` to compute the sum of fixed-point products. + + This function, based on the code of `FT_MulFix`, uses 64-bit precision + internally for intermediate computations. + + * include/freetype/internal/ftcalc.h, base/ftcalc.c (FT_MulAddFix): + Implement it. + +2022-06-22 Werner Lemberg <wl@gnu.org> + + CMakeLists.txt: Move inclusion of `FindPkgConfig` down. + + It must come after `CMAKE_TOOLCHAIN_FILE`. + + Fixes #1167. + +2022-06-22 Dominik Röttsches <drott@chromium.org> + + [sfnt] Upgrade stop_offset to FT_Fixed from FT_F2Dot14 + +2022-06-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * docs/CHANGES: Announce impending Infinality removal. + +2022-06-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * ttgload.c (TT_Process_Composite_Glyph): Fix a signedness warning. + +2022-06-21 Werner Lemberg <wl@gnu.org> + + s/fixed point/fixed-point/ + +2022-06-21 Werner Lemberg <wl@gnu.org> + + .gitlab-ci.yml: Correctly upgrade `meson`. + +2022-06-21 Dominik Röttsches <drott@chromium.org> + + Proposal: Feature control for variable COLRv1 + + * include/freetype/ftdriver.h (variable-color-v1 property): Add documentation + for variable-colr-v1 property. + * src/truetype/ttdriver.c (tt_property_set): Ingest variable-control property + when called, set to enable_variable_colrv1 driver flag. + * src/truetype/ttobjs.h (TT_DriverRec): Add enable_variable_colrv1 flag. + +2022-06-21 Xavier Claessens <xavier.claessens@collabora.com> + + [meson] Disable FreeType in HarfBuzz fallback. + + This avoids cyclic subproject configuration when the 'harfbuzz' feature is + enabled, or `--wrap-mode=forcefallback` is used, but HarfBuzz is built as a + subproject. HarfBuzz does the same and disables HarfBuzz support when + configuring FreeType as a subproject. + + * meson.build (harfbuzz_dep): Implement it. + + * subprojects/harfbuzz.wrap: New file. + + * .gitlab-ci.yml [windows meson]: Use latest version of the meson 0.59 + series, which has a necessary bug fix to make CI work. + +2022-06-19 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Clean up phantom point accounting. + + This formalizes that the phantom points appended in the outline + do not increase its point count, nor are they tagged or included + in any additional contours. Only their coordinates are stored. + They are counted in the glyph zone, however. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Infer `n_points` + from the outline size plus four phantom points. + * src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Remove this + argument. + * src/truetype/ttgload.c (tt_prepare_zone): Add phantom four. + (TT_Process_Simple_Glyph, load_truetype_glyph): Update all callers. + +2022-06-19 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype/GX] Clean up phantom point adjustment. + + This moves phantom point and advance variation adjustment next to + calculations. The logic stays the same, HVAR and VVAR take priority. + + * src/truetype/ttgload.c (load_truetype_glyph): Move it from here... + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here + and check for HVAR and VVAR presence outside the main loop. + +2022-06-18 Ben Wagner <bungeman@chromium.org> + + [stream] Fix reading s32 when long is s64 + + `FT_READ_LONG`, `FT_GET_LONG`, and related macros did not return + negative values when `long` is more than 32 bits. `FT_Stream_ReadULong` + would read four bytes into the LSB of an `FT_ULong` and return that. + Since this can never set the MSb of the `FT_ULong` when `FT_ULong` is + more than 32 bits the cast to `FT_Long` never resulted in a negative + value. + + Fix this by modifying `FT_Stream_Read*` to return a type of the same + size as the bytes it is reading and changing the `FT_READ_*` and + `FT_GET_*` macros to cast to the same type returned by `FT_Stream_Read*` + but with the correctly signed type (instead of casting to what is + assumed to be the type of `var` which will happen automatically anyway). + + There exist a few cases like with the `OFF3` variants where there isn't + generally a type with the correct size. `FT_PEEK_OFF3` works around this + loading the bytes into the three most significant bits and then doing a + signed shift down. `FT_NEXT_OFF3` also already worked correctly by + casting this signed value to another signed type. `FT_Stream_GetUOffset` + works correctly but one must be careful not to attempt to cast the + returned value to a signed type. Fortunately there is only + `FT_GET_UOFF3` and no `FT_GET_OFF3`. + + All of these cases are handled correctly when reading values through + `FT_Stream_ReadFields` since it generically computes the signed value + through an `FT_Int32`. This change is essentially doing the same for + these macros. + + * include/freetype/internal/ftstream.h (FT_NEXT_*, FT_GET_*, FT_READ*): + Update macros and return types to use fixed size types for fixed size + values. + + * src/base/ftstream.c (FT_StreamGet*, FT_StreamRead*): Dito. + + Issue: #1161 + +2022-06-17 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype/GX] Fix an old typo. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Vertical + advance is measured along y-coordinate. + +2022-06-16 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype/GX] Clean up advance adjustment (Brrr).
+
+ * src/truetype/ttgload.c (load_truetype_glyph): Remove remaining code. + +2022-06-16 Ben Wagner <bungeman@chromium.org> + + [type1] Directly search for eexec in private dict + + This code originally just searched for `eexec`. This was later modified + to check that the `eexec` found is valid (not in a string or comment). + This was done by searching for `eexec` as before and then, for each + `eexec` found, searching from the beginning using the correct parsing to + see if the `eexec` was still found. If the private dictionary is large + and contains many copies of `eexec` which are not valid, the initial + part of the private dictionary is scanned once for each, potentially + leading to n^2 parsing time. + + Instead of finding an initial `eexec` and then re-parsing to discover if + it is valid, drop the initial search for `eexec` and just parse to find + a valid `eexec`. This is strictly faster since the validation must + happen anyway and avoids restarting from the beginning each time an + `eexec` is found in the data. + + * src/type1/t1parse.c (T1_Get_Private_Dict): avoid n^2 parsing + + Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1328883 + +2022-06-16 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype/GX] Clean up advance adjustment. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): + Move the advance adjustment from here... + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here and + simplify arguments. + * src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Update prototype + with fewer arguments. + +2022-06-14 Ben Wagner <bungeman@chromium.org> + + [gzip] Handle inflate returning Z_NEED_DICT + + When `inflate` returns `Z_NEED_DICT` this is currently not reported as + an error and callers may assume that the decompression succeeded when it + did not. In particular, a compressed table in a woff file may not + actually be decompressed and written as expected, leaving the backing + memory for the expanded table uninitialized. + + * src/gzlip/ftgzip.c (FT_Gzip_Uncompress): treat `Z_NEED_DICT` as + indicating invalid data since there is no means to provide a dictionary. + + Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335712 + +2022-06-13 Ben Wagner <bungeman@chromium.org> + + [woff] Don't allocate table entries until needed + + * src/sfnt/sfwoff.c (woff_open_font): delay allocating space for the + table entries until they are actually written out with the data. + +2022-06-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/sfnt/sfwoff2.c (woff2_open_font): Partial revert. + + Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47981. + +2022-06-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Cosmetic macro change. + +2022-06-11 Alexei Podtelezhnikov <apodtele@gmail.com> + + [woff, woff2] Avoid buffer zeroing. + + * src/sfnt/sfwoff.c (woff_open_font): Use Q-macros. + * src/sfnt/sfwoff2.c: Ditto. + (reconstruct_font): Allocate table_entry on stack. + +2022-06-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [smooth] Fix GCC LTO crashes on Windows. + + Fixes #1164 by using a volatile variable around `setjmp`. It is hard to + say how this fixes crashes related to certain link-time optimizations. + This does not decrease the rendering performance. + + * src/smooth/ftgrays.c (gray_convert_glyph_inner): Use volatile `error`. + +2022-06-09 bruvzg <@bruvzg> + + * src/smooth/ftgrays.c [FT_STATIC_RASTER]: Fix compilation. + +2022-06-06 Ben Wagner <bungeman@chromium.org> + + [svg] Set linear advances when loading SVG glyphs + + * include/freetype/freetype.h (FT_GlyphSlotRec_): update doc + * src/cff/cffgload.c (cff_slot_load): do it + * src/truetype/ttgload.c (TT_Load_Glyph): do it + + Fixes: #1156 + +2022-06-01 Ben Wagner <bungeman@chromium.org> + + [svg] Clear correct flags for doc ownership + + This issue was discovered with an SVG based font with some documents + compressed and other uncompressed. After loading the first compressed + document the ownership flag on the glyph slot was set to true but never + set to false. As a result after loading a compressed document a glyph + from an uncompressed document would load fine, but when this glyph slot + was cleared it would try to free its document resulting in a wild free. + + * src/base/ftobjs.c (ft_glyphslot_clear): clear correct flags + + Fixes: #1162 + +2022-06-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [docs] Correct favicon. + +2022-06-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [docs] Use hinted favicon. + +2022-05-27 Alexei Podtelezhnikov <apodtele@gmail.com> + + [docs] Update favicon. + +2022-05-25 Behdad Esfahbod (بهداد اسÙهبد) <behdad@behdad.org> + + * src/sfnt/ttmtx.c (tt_face_get_metrics): Apply variations unconditionally. + + This causes a speed-up of approx. 20% for getting advance widths. + +2022-05-23 Dominik Röttsches <drott@chromium.org> + + [truetype] Support reading 32bit/16bit VarStore deltas + + * include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Define type + to be used for delta arrays, upgrade to FT_long. + * src/truetype/ttgxvar.c: Adhere to long_words bit and read either + Short/Byte pairs or Long/Short pairs, as defined by spec. For better + readability, define macro for repetitive read code. + +2022-05-20 Dominik Röttsches <drott@chromium.org> + + [truetype] Handle 0xFFFF special value inside delta retrieval function + + * truetype/ttgxvar.c (tt_hvadvance_adjust, tt_apply_mvar, + tt_var_get_item_delta): Remove special 0xFFFF handling in favor of less + redundant handling inside the tt_var_get_item_delta function, as it is + equivalent to returning a 0 delta. Avoids code-duplication checking for + special value 0xFFFF. + +2022-05-19 Dominik Röttsches <drott@chromium.org> + + [truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`. + + This will be needed for 'COLR' v1 variation support. + + * src/truetype/ttgxvar.h (GX_ItemVarData, GX_AxisCoords, GX_VarRegion, + GX_VarItemStore, GX_DeltaSetIdxMap): Move structures to... + * include/freetype/internal/ftmmtypes.h: ... this new file. + + * include/freetype/internal/service/svmm.h (MultiMasters): Include + `ftmmtypes.h`. + (FT_Var_Load_Delta_Set_Idx_Map_Func, FT_Var_Load_Item_Var_Store_Func, + FT_Var_Get_Item_Delta_Func, FT_Var_Done_Item_Var_Store_Func, + FT_Var_Done_Delta_Set_Idx_Map_Func): New function typedefs. + (MultiMasters): Add them. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + + * src/cff/cffdrivr.c (cff_load_item_variation_store, + cff_load_delta_set_index_mapping, cff_get_item_delta, + cff_done_item_variation_store, cff_done_delta_set_index_map): New wrapper + methods calling into mm service. + (cff_service_multi_masters): Updated. + + * src/truetype/ttgxvar.c (ft_var_load_item_variation_store, + ft_var_load_delta_set_index_mapping, ft_var_get_item_delta, + ft_var_done_item_variation_store, ft_var_done_delta_set_index_map): Renamed + to ... + (tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping, + tt_var_get_item_delta, tt_var_done_item_variation_store, + tt_var_done_delta_set_index_map): ... this for consistency. + Mark them as non-static. + * src/truetype/ttgxvar.h: Add corresponding prototypes. + + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. + + * src/type1/t1driver.c (t1_service_multi_masters): Updated. + +2022-05-19 Dominik Röttsches <drott@chromium.org> + + [truetype] Move deallocation of `DeltaSetIdxMap` into own function. + + This is a preparation for handling `DeltaSetIdxMap` and `VarStore` as a + FreeType service. + + * src/truetype/ttgxvar.c (ft_var_done_delta_set_index_map): New function. + (tt_done_blend): Use it. + +2022-05-18 Werner Lemberg <wl@gnu.org> + + * builds/toplevel.mk (do-dist): Don't remove meson wrap files. + + Fixes #1157. + +2022-05-18 Werner Lemberg <wl@gnu.org> + + * subprojects/zlib.wrap: Update to zlib version 1.2.12. + +2022-05-18 Werner Lemberg <wl@gnu.org> + + REAMDE: Mention that gitlab's 'download' button doesn't work. + + This is because the `git archive` command doesn't preserve submodules. + + Note that currently there is no support for disabling the 'download' button + in gitlab (https://gitlab.com/gitlab-org/gitlab/-/issues/17032). + + Fixes issue #1158. + +2022-05-11 Werner Lemberg <wl@gnu.org> + + [truetype] Handle inner/outer index values 0xFFFF/0xFFFF. + + This was introduced in OpenType 1.8.4. + + * src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping, + tt_hvadvance_adjust, ft_var_load_mvar, tt_apply_mvar): Handle special + inner/outer index values. + (ft_var_load_item_variation_store): Add test. + + Fixes #1154. + 2022-05-01 Werner Lemberg <wl@gnu.org> * Version 2.12.1 released. diff --git a/lib/freetype/LICENSE.TXT b/lib/freetype/LICENSE.TXT index b1def65dd..8b9ce9e2e 100644 --- a/lib/freetype/LICENSE.TXT +++ b/lib/freetype/LICENSE.TXT @@ -29,12 +29,16 @@ The contributed BDF and PCF drivers come with a license similar to that of the X Window System. It is compatible to the above two licenses (see files `src/bdf/README` and `src/pcf/README`). The same holds for the source code files `src/base/fthash.c` and -`include/freetype/internal/fthash.h`; they wer part of the BDF driver +`include/freetype/internal/fthash.h`; they were part of the BDF driver 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 MD5 checksum support (only used for debugging in development builds) is in the public domain. diff --git a/lib/freetype/Makefile b/lib/freetype/Makefile index ccc34e4d0..62680688d 100644 --- a/lib/freetype/Makefile +++ b/lib/freetype/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.57 2022/07/23 19:27:21 matthieu Exp $ +# $OpenBSD: Makefile,v 1.58 2023/05/21 09:25:29 matthieu Exp $ .include <bsd.own.mk> FREETYPESRC= ${.CURDIR}/src # Get it from builds/unix/configure.ac -FT_VERSION_INFO= 24.3.18 +FT_VERSION_INFO= 25.0.19 INSTALL_PROGRAM = ${INSTALL} ${INSTALL_COPY} -m 755 -o $(BINOWN) -g $(BINGRP) @@ -29,7 +29,7 @@ SRCS= ftbase.c ftbbox.c ftbdf.c ftbitmap.c ftdebug.c ftcache.c \ CPPFLAGS+= -I${.CURDIR}/include -I${.CURDIR}/builds/unix -I${.CURDIR}/src/lzw -DFT2_BUILD_LIBRARY -DFT_CONFIG_CONFIG_H='<ftconfig.h>' .if ${COMPILER_VERSION} != "gcc3" -CFLAGS+= -fvisibility=hidden +CFLAGS+= -fvisibility=hidden -std=gnu99 -Wall -Wdeclaration-after-statement -Werror=implicit-function-declaration -Werror=undef -Wextra -Winit-self -Winline -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wno-attributes -Wno-long-long -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wpacked -Wpointer-arith -Wshadow -Wsign-compare -Wstrict-aliasing=2 -Wstrict-prototypes -Wwrite-strings PICFLAG= -fPIC VERSION_SCRIPT= ${.CURDIR}/Symbols.map .endif diff --git a/lib/freetype/README b/lib/freetype/README index 7a8a2dced..327b94d8e 100644 --- a/lib/freetype/README +++ b/lib/freetype/README @@ -1,4 +1,4 @@ -FreeType 2.12.1 +FreeType 2.13.0 =============== Homepage: https://www.freetype.org @@ -16,7 +16,9 @@ Read the files `docs/INSTALL*` for installation instructions; see the file `docs/LICENSE.TXT` for the available licenses. For using FreeType's git repository instead of a distribution bundle, -please read file `README.git`. +please read file `README.git`. Note that you have to actually clone +the repository; using a snapshot will not work (in other words, don't +use gitlab's 'Download' button). The FreeType 2 API reference is located in directory `docs/reference`; use the file `index.html` as the top entry point. [Please note that @@ -30,9 +32,9 @@ sites. Go to and download one of the following files. - freetype-doc-2.12.1.tar.xz - freetype-doc-2.12.1.tar.gz - ftdoc2121.zip + freetype-doc-2.13.0.tar.xz + freetype-doc-2.13.0.tar.gz + ftdoc2130.zip To view the documentation online, go to @@ -92,7 +94,7 @@ Enjoy! ---------------------------------------------------------------------- -Copyright (C) 2006-2022 by +Copyright (C) 2006-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/README.git b/lib/freetype/README.git index 258de14b7..117d74f0d 100644 --- a/lib/freetype/README.git +++ b/lib/freetype/README.git @@ -89,7 +89,7 @@ address: ---------------------------------------------------------------------- -Copyright (C) 2005-2022 by +Copyright (C) 2005-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/Symbols.map b/lib/freetype/Symbols.map index c12d8fe4c..506f745b4 100644 --- a/lib/freetype/Symbols.map +++ b/lib/freetype/Symbols.map @@ -107,6 +107,7 @@ FT_GlyphSlot_Embolden; FT_GlyphSlot_Oblique; FT_GlyphSlot_Own_Bitmap; + FT_GlyphSlot_Slant; FT_Glyph_Copy; FT_Glyph_Get_CBox; FT_Glyph_Stroke; diff --git a/lib/freetype/autogen.sh b/lib/freetype/autogen.sh index b5fc1beb5..ff5e46f0d 100644 --- a/lib/freetype/autogen.sh +++ b/lib/freetype/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2005-2022 by +# Copyright (C) 2005-2023 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/lib/freetype/builds/amiga/README b/lib/freetype/builds/amiga/README index e77435527..5b2abef3d 100644 --- a/lib/freetype/builds/amiga/README +++ b/lib/freetype/builds/amiga/README @@ -1,7 +1,7 @@ README for the builds/amiga subdirectory. -Copyright (C) 2005-2022 by +Copyright (C) 2005-2023 by Werner Lemberg and Detlef Würkner. This file is part of the FreeType project, and may only be used, modified, diff --git a/lib/freetype/builds/amiga/include/config/ftconfig.h b/lib/freetype/builds/amiga/include/config/ftconfig.h index 211f170e9..de074bf83 100644 --- a/lib/freetype/builds/amiga/include/config/ftconfig.h +++ b/lib/freetype/builds/amiga/include/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific configuration file (specification only). */ /* */ -/* Copyright (C) 2005-2022 by */ +/* Copyright (C) 2005-2023 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/lib/freetype/builds/amiga/include/config/ftmodule.h b/lib/freetype/builds/amiga/include/config/ftmodule.h index 73e86d5b6..bf3336743 100644 --- a/lib/freetype/builds/amiga/include/config/ftmodule.h +++ b/lib/freetype/builds/amiga/include/config/ftmodule.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType module selection. */ /* */ -/* Copyright (C) 2005-2022 by */ +/* Copyright (C) 2005-2023 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/lib/freetype/builds/amiga/makefile b/lib/freetype/builds/amiga/makefile index 5df281c0b..4a33fdd92 100644 --- a/lib/freetype/builds/amiga/makefile +++ b/lib/freetype/builds/amiga/makefile @@ -5,7 +5,7 @@ # -# Copyright (C) 2005-2022 by +# Copyright (C) 2005-2023 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/lib/freetype/builds/amiga/makefile.os4 b/lib/freetype/builds/amiga/makefile.os4 index 02742ea46..dfc3e9f19 100644 --- a/lib/freetype/builds/amiga/makefile.os4 +++ b/lib/freetype/builds/amiga/makefile.os4 @@ -4,7 +4,7 @@ # -# Copyright (C) 2005-2022 by +# Copyright (C) 2005-2023 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/lib/freetype/builds/amiga/smakefile b/lib/freetype/builds/amiga/smakefile index 311375d0e..ca3da6634 100644 --- a/lib/freetype/builds/amiga/smakefile +++ b/lib/freetype/builds/amiga/smakefile @@ -3,7 +3,7 @@ # -# Copyright (C) 2005-2022 by +# Copyright (C) 2005-2023 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/lib/freetype/builds/amiga/src/base/ftdebug.c b/lib/freetype/builds/amiga/src/base/ftdebug.c index 84e2c8bac..a20929749 100644 --- a/lib/freetype/builds/amiga/src/base/ftdebug.c +++ b/lib/freetype/builds/amiga/src/base/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for amiga (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 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/lib/freetype/builds/amiga/src/base/ftsystem.c b/lib/freetype/builds/amiga/src/base/ftsystem.c index ed34a779f..d85845c81 100644 --- a/lib/freetype/builds/amiga/src/base/ftsystem.c +++ b/lib/freetype/builds/amiga/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType low-level system interface (body). */ /* */ -/* Copyright (C) 1996-2022 by */ +/* Copyright (C) 1996-2023 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/lib/freetype/builds/ansi/ansi-def.mk b/lib/freetype/builds/ansi/ansi-def.mk index d91894c06..82178932f 100644 --- a/lib/freetype/builds/ansi/ansi-def.mk +++ b/lib/freetype/builds/ansi/ansi-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/ansi/ansi.mk b/lib/freetype/builds/ansi/ansi.mk index 96c1576d0..ad40939b5 100644 --- a/lib/freetype/builds/ansi/ansi.mk +++ b/lib/freetype/builds/ansi/ansi.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/beos/beos-def.mk b/lib/freetype/builds/beos/beos-def.mk index 0b3ef6099..1cca80cce 100644 --- a/lib/freetype/builds/beos/beos-def.mk +++ b/lib/freetype/builds/beos/beos-def.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/beos/beos.mk b/lib/freetype/builds/beos/beos.mk index a5e6a82c0..69ca1f1b0 100644 --- a/lib/freetype/builds/beos/beos.mk +++ b/lib/freetype/builds/beos/beos.mk @@ -2,7 +2,7 @@ # FreeType 2 configuration rules for a BeOS system # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/beos/detect.mk b/lib/freetype/builds/beos/detect.mk index 7b27ff9f9..dd1b5a61a 100644 --- a/lib/freetype/builds/beos/detect.mk +++ b/lib/freetype/builds/beos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/cmake/FindBrotliDec.cmake b/lib/freetype/builds/cmake/FindBrotliDec.cmake index 0a3d89926..81036cb10 100644 --- a/lib/freetype/builds/cmake/FindBrotliDec.cmake +++ b/lib/freetype/builds/cmake/FindBrotliDec.cmake @@ -1,6 +1,6 @@ # FindBrotliDec.cmake # -# Copyright (C) 2019-2022 by +# Copyright (C) 2019-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by Werner Lemberg <wl@gnu.org> diff --git a/lib/freetype/builds/cmake/iOS.cmake b/lib/freetype/builds/cmake/iOS.cmake index 011e7ef02..7aba7c523 100644 --- a/lib/freetype/builds/cmake/iOS.cmake +++ b/lib/freetype/builds/cmake/iOS.cmake @@ -1,6 +1,6 @@ # iOS.cmake # -# Copyright (C) 2014-2022 by +# Copyright (C) 2014-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by David Wimsey <david@wimsey.us> diff --git a/lib/freetype/builds/cmake/testbuild.sh b/lib/freetype/builds/cmake/testbuild.sh index 312b47697..007170b04 100755 --- a/lib/freetype/builds/cmake/testbuild.sh +++ b/lib/freetype/builds/cmake/testbuild.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -# Copyright (C) 2015-2022 by +# Copyright (C) 2015-2023 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/lib/freetype/builds/compiler/ansi-cc.mk b/lib/freetype/builds/compiler/ansi-cc.mk index 98cb05776..f8386f615 100644 --- a/lib/freetype/builds/compiler/ansi-cc.mk +++ b/lib/freetype/builds/compiler/ansi-cc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/bcc-dev.mk b/lib/freetype/builds/compiler/bcc-dev.mk index 83ed28cf1..d01ed7cd8 100644 --- a/lib/freetype/builds/compiler/bcc-dev.mk +++ b/lib/freetype/builds/compiler/bcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/bcc.mk b/lib/freetype/builds/compiler/bcc.mk index 76b5dc212..a484bbaa7 100644 --- a/lib/freetype/builds/compiler/bcc.mk +++ b/lib/freetype/builds/compiler/bcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/emx.mk b/lib/freetype/builds/compiler/emx.mk index f79183623..34d06b205 100644 --- a/lib/freetype/builds/compiler/emx.mk +++ b/lib/freetype/builds/compiler/emx.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2022 by +# Copyright (C) 2003-2023 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/lib/freetype/builds/compiler/gcc-dev.mk b/lib/freetype/builds/compiler/gcc-dev.mk index 0d1b0da71..a6ded52cf 100644 --- a/lib/freetype/builds/compiler/gcc-dev.mk +++ b/lib/freetype/builds/compiler/gcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/gcc.mk b/lib/freetype/builds/compiler/gcc.mk index fbb12cc5b..20ca9698c 100644 --- a/lib/freetype/builds/compiler/gcc.mk +++ b/lib/freetype/builds/compiler/gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/intelc.mk b/lib/freetype/builds/compiler/intelc.mk index b1fdbe729..1f7249355 100644 --- a/lib/freetype/builds/compiler/intelc.mk +++ b/lib/freetype/builds/compiler/intelc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/unix-lcc.mk b/lib/freetype/builds/compiler/unix-lcc.mk index 09da86f4f..af11d1778 100644 --- a/lib/freetype/builds/compiler/unix-lcc.mk +++ b/lib/freetype/builds/compiler/unix-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/visualage.mk b/lib/freetype/builds/compiler/visualage.mk index 8c14d6f04..75e9023d3 100644 --- a/lib/freetype/builds/compiler/visualage.mk +++ b/lib/freetype/builds/compiler/visualage.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/visualc.mk b/lib/freetype/builds/compiler/visualc.mk index 2635a9fec..30b03fc46 100644 --- a/lib/freetype/builds/compiler/visualc.mk +++ b/lib/freetype/builds/compiler/visualc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/watcom.mk b/lib/freetype/builds/compiler/watcom.mk index 6484d4180..61f8cd76f 100644 --- a/lib/freetype/builds/compiler/watcom.mk +++ b/lib/freetype/builds/compiler/watcom.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/compiler/win-lcc.mk b/lib/freetype/builds/compiler/win-lcc.mk index 1faad4940..92f653e43 100644 --- a/lib/freetype/builds/compiler/win-lcc.mk +++ b/lib/freetype/builds/compiler/win-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/detect.mk b/lib/freetype/builds/detect.mk index 4068ca2a6..d5cddb09a 100644 --- a/lib/freetype/builds/detect.mk +++ b/lib/freetype/builds/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/dos/detect.mk b/lib/freetype/builds/dos/detect.mk index 46f9a630c..8ed148bde 100644 --- a/lib/freetype/builds/dos/detect.mk +++ b/lib/freetype/builds/dos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/dos/dos-def.mk b/lib/freetype/builds/dos/dos-def.mk index 307047da5..37cb2c138 100644 --- a/lib/freetype/builds/dos/dos-def.mk +++ b/lib/freetype/builds/dos/dos-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/dos/dos-emx.mk b/lib/freetype/builds/dos/dos-emx.mk index 4ab7b6c7e..23181d774 100644 --- a/lib/freetype/builds/dos/dos-emx.mk +++ b/lib/freetype/builds/dos/dos-emx.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2022 by +# Copyright (C) 2003-2023 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/lib/freetype/builds/dos/dos-gcc.mk b/lib/freetype/builds/dos/dos-gcc.mk index 24d14a9b2..cd695dbac 100644 --- a/lib/freetype/builds/dos/dos-gcc.mk +++ b/lib/freetype/builds/dos/dos-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/dos/dos-wat.mk b/lib/freetype/builds/dos/dos-wat.mk index 07d54e896..a6b65cbf6 100644 --- a/lib/freetype/builds/dos/dos-wat.mk +++ b/lib/freetype/builds/dos/dos-wat.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2022 by +# Copyright (C) 2003-2023 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/lib/freetype/builds/exports.mk b/lib/freetype/builds/exports.mk index a3342ecb9..b10924a78 100644 --- a/lib/freetype/builds/exports.mk +++ b/lib/freetype/builds/exports.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2005-2022 by +# Copyright (C) 2005-2023 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/lib/freetype/builds/freetype.mk b/lib/freetype/builds/freetype.mk index 7b30c79d6..d96ded072 100644 --- a/lib/freetype/builds/freetype.mk +++ b/lib/freetype/builds/freetype.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/link_dos.mk b/lib/freetype/builds/link_dos.mk index dd97fbe7c..b3dc451f5 100644 --- a/lib/freetype/builds/link_dos.mk +++ b/lib/freetype/builds/link_dos.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/link_std.mk b/lib/freetype/builds/link_std.mk index d94e06d01..aca8ec49f 100644 --- a/lib/freetype/builds/link_std.mk +++ b/lib/freetype/builds/link_std.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/mac/ftmac.c b/lib/freetype/builds/mac/ftmac.c index f30ffc7d1..8fe556593 100644 --- a/lib/freetype/builds/mac/ftmac.c +++ b/lib/freetype/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-2022 by */ +/* Copyright (C) 1996-2023 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/lib/freetype/builds/meson/extract_freetype_version.py b/lib/freetype/builds/meson/extract_freetype_version.py index 66b5bc855..c4c60e7f1 100644 --- a/lib/freetype/builds/meson/extract_freetype_version.py +++ b/lib/freetype/builds/meson/extract_freetype_version.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/builds/meson/extract_libtool_version.py b/lib/freetype/builds/meson/extract_libtool_version.py index 580f645c1..6fac74c8e 100644 --- a/lib/freetype/builds/meson/extract_libtool_version.py +++ b/lib/freetype/builds/meson/extract_libtool_version.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/builds/meson/generate_reference_docs.py b/lib/freetype/builds/meson/generate_reference_docs.py index eb4480633..4208bb677 100644 --- a/lib/freetype/builds/meson/generate_reference_docs.py +++ b/lib/freetype/builds/meson/generate_reference_docs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/builds/meson/parse_modules_cfg.py b/lib/freetype/builds/meson/parse_modules_cfg.py index f68110cf0..6030bb209 100644 --- a/lib/freetype/builds/meson/parse_modules_cfg.py +++ b/lib/freetype/builds/meson/parse_modules_cfg.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -84,14 +84,16 @@ def generate_ftmodule(lists): ) for module in lists["RASTER_MODULES"]: - name = { - "raster": "ft_raster1", - "smooth": "ft_smooth", - "svg": "ft_svg", + names = { + "raster": ("ft_raster1",), + "smooth": ("ft_smooth",), + "svg": ("ft_svg",), + "sdf": ("ft_sdf", "ft_bitmap_sdf"), }.get(module) - result += ( - "FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name - ) + for name in names: + result += ( + "FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name + ) for module in lists["AUX_MODULES"]: if module in ("psaux", "psnames", "otvalid", "gxvalid"): diff --git a/lib/freetype/builds/meson/process_ftoption_h.py b/lib/freetype/builds/meson/process_ftoption_h.py index d3f8bb9ae..98daa8c1e 100644 --- a/lib/freetype/builds/meson/process_ftoption_h.py +++ b/lib/freetype/builds/meson/process_ftoption_h.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/builds/modules.mk b/lib/freetype/builds/modules.mk index abbb0ef9e..a75baaf24 100644 --- a/lib/freetype/builds/modules.mk +++ b/lib/freetype/builds/modules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/os2/detect.mk b/lib/freetype/builds/os2/detect.mk index 0bb557680..afdba7405 100644 --- a/lib/freetype/builds/os2/detect.mk +++ b/lib/freetype/builds/os2/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/os2/os2-def.mk b/lib/freetype/builds/os2/os2-def.mk index 4f508bb36..917ef2d0e 100644 --- a/lib/freetype/builds/os2/os2-def.mk +++ b/lib/freetype/builds/os2/os2-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/os2/os2-dev.mk b/lib/freetype/builds/os2/os2-dev.mk index 7c35c1c46..3584fb6be 100644 --- a/lib/freetype/builds/os2/os2-dev.mk +++ b/lib/freetype/builds/os2/os2-dev.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/os2/os2-gcc.mk b/lib/freetype/builds/os2/os2-gcc.mk index 62003f82c..e17c5be6f 100644 --- a/lib/freetype/builds/os2/os2-gcc.mk +++ b/lib/freetype/builds/os2/os2-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/symbian/bld.inf b/lib/freetype/builds/symbian/bld.inf index 6d20af917..61689225a 100644 --- a/lib/freetype/builds/symbian/bld.inf +++ b/lib/freetype/builds/symbian/bld.inf @@ -2,7 +2,7 @@ // FreeType 2 project for the symbian platform // -// Copyright (C) 2008-2022 by +// Copyright (C) 2008-2023 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/lib/freetype/builds/symbian/freetype.mmp b/lib/freetype/builds/symbian/freetype.mmp index ef3a96f15..297678ede 100644 --- a/lib/freetype/builds/symbian/freetype.mmp +++ b/lib/freetype/builds/symbian/freetype.mmp @@ -2,7 +2,7 @@ // FreeType 2 makefile for the symbian platform // -// Copyright (C) 2008-2022 by +// Copyright (C) 2008-2023 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/lib/freetype/builds/toplevel.mk b/lib/freetype/builds/toplevel.mk index fb0838e98..5a3ff2abd 100644 --- a/lib/freetype/builds/toplevel.mk +++ b/lib/freetype/builds/toplevel.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -139,12 +139,12 @@ ifdef check_platform ifneq ($(is_unix),) distclean: - $(RM) builds/unix/config.cache - $(RM) builds/unix/config.log - $(RM) builds/unix/config.status - $(RM) builds/unix/unix-def.mk - $(RM) builds/unix/unix-cc.mk - $(RM) builds/unix/freetype2.pc + $(RM) $(TOP_DIR)/builds/unix/config.cache + $(RM) $(TOP_DIR)/builds/unix/config.log + $(RM) $(TOP_DIR)/builds/unix/config.status + $(RM) $(TOP_DIR)/builds/unix/unix-def.mk + $(RM) $(TOP_DIR)/builds/unix/unix-cc.mk + $(RM) $(TOP_DIR)/builds/unix/freetype2.pc $(RM) nul endif # test is_unix @@ -170,17 +170,17 @@ endif # test check_platform check_out_submodule: $(info Checking out submodule in `subprojects/dlg') - git submodule init - git submodule update + git --git-dir=$(TOP_DIR) submodule init + git --git-dir=$(TOP_DIR) submodule update copy_submodule: $(info Copying files from `subprojects/dlg' to `src/dlg' and `include/dlg') - ifeq ($(wildcard include/dlg),) - mkdir $(subst /,$(SEP),include/dlg) + ifeq ($(wildcard $(TOP_DIR)/include/dlg),) + mkdir $(subst /,$(SEP),$(TOP_DIR)/include/dlg) endif - $(COPY) $(subst /,$(SEP),subprojects/dlg/include/dlg/output.h include/dlg) - $(COPY) $(subst /,$(SEP),subprojects/dlg/include/dlg/dlg.h include/dlg) - $(COPY) $(subst /,$(SEP),subprojects/dlg/src/dlg/dlg.c src/dlg) + $(COPY) $(subst /,$(SEP),$(TOP_DIR)/subprojects/dlg/include/dlg/output.h $(TOP_DIR)/include/dlg) + $(COPY) $(subst /,$(SEP),$(TOP_DIR)/subprojects/dlg/include/dlg/dlg.h $(TOP_DIR)/include/dlg) + $(COPY) $(subst /,$(SEP),$(TOP_DIR)/subprojects/dlg/src/dlg/dlg.c $(TOP_DIR)/src/dlg) # We always need the list of modules in ftmodule.h. @@ -294,15 +294,15 @@ CHANGELOG_SCRIPT = ~/git/config/gitlog-to-changelog do-dist: distclean refdoc @# Without removing the files, `autoconf' and friends follow links. - rm -f builds/unix/aclocal.m4 - rm -f builds/unix/configure.ac - rm -f builds/unix/configure + rm -f $(TOP_DIR)/builds/unix/aclocal.m4 + rm -f $(TOP_DIR)/builds/unix/configure.ac + rm -f $(TOP_DIR)/builds/unix/configure sh autogen.sh - rm -rf builds/unix/autom4te.cache + rm -rf $(TOP_DIR)/builds/unix/autom4te.cache - cp $(CONFIG_GUESS) builds/unix - cp $(CONFIG_SUB) builds/unix + cp $(CONFIG_GUESS) $(TOP_DIR)/builds/unix + cp $(CONFIG_SUB) $(TOP_DIR)/builds/unix @# Generate `ChangeLog' file with commits since release 2.11.0 @# (when we stopped creating this file manually). @@ -313,10 +313,10 @@ do-dist: distclean refdoc > ChangeLog @# Remove intermediate files created by the `refdoc' target. - rm -rf docs/markdown - rm -f docs/mkdocs.yml + rm -rf $(TOP_DIR)/docs/markdown + rm -f $(TOP_DIR)/docs/mkdocs.yml @# Remove more stuff related to git. - rm -rf subprojects + rm -rf $(TOP_DIR)/subprojects/dlg # EOF diff --git a/lib/freetype/builds/unix/configure.ac b/lib/freetype/builds/unix/configure.ac index 393ec3bb6..a98865a43 100644 --- a/lib/freetype/builds/unix/configure.ac +++ b/lib/freetype/builds/unix/configure.ac @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright (C) 2001-2022 by +# Copyright (C) 2001-2023 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.12.1], [freetype@nongnu.org], [freetype]) +AC_INIT([FreeType], [2.13], [freetype@nongnu.org], [freetype]) AC_CONFIG_SRCDIR([ftconfig.h.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='24:3:18' +version_info='25:0:19' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -50,7 +50,7 @@ if test ${cross_compiling} = yes; then AC_MSG_CHECKING([for suffix of native executables]) rm -f a.* b.* a_out.exe conftest.* - echo > conftest.c "int main() { return 0;}" + echo > conftest.c "int main(void) { return 0;}" ${CC_BUILD} conftest.c || AC_MSG_ERROR([native C compiler is not working]) rm -f conftest.c if test -x a.out -o -x b.out -o -x conftest; then @@ -163,9 +163,6 @@ fi AC_SUBST([FTSYS_SRC]) -AC_CHECK_FUNCS([memcpy memmove]) - - # get compiler flags right # # We try to make the compiler work for C99-strict source. Even if the @@ -406,16 +403,12 @@ if test x"$with_png" = xyes -o x"$with_png" = xauto; then have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)" else # fall back to config script - AC_MSG_CHECKING([for libpng-config]) - if which libpng-config > /dev/null 2>&1; then + AC_CHECK_PROG(have_libpng, [libpng-config], [yes (libpng-config)], [no]) + if test "$have_libpng" != no; then LIBPNG_CFLAGS=`libpng-config --cflags` LIBPNG_LIBS=`libpng-config --ldflags` libpng_libspriv=`libpng-config --static --ldflags` libpng_libsstaticconf="$libpng_libspriv" - have_libpng="yes (libpng-config)" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) fi fi fi diff --git a/lib/freetype/builds/unix/configure.raw b/lib/freetype/builds/unix/configure.raw index fb943fd2a..8e982835e 100644 --- a/lib/freetype/builds/unix/configure.raw +++ b/lib/freetype/builds/unix/configure.raw @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright (C) 2001-2022 by +# Copyright (C) 2001-2023 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='24:3:18' +version_info='25:0:19' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -50,7 +50,7 @@ if test ${cross_compiling} = yes; then AC_MSG_CHECKING([for suffix of native executables]) rm -f a.* b.* a_out.exe conftest.* - echo > conftest.c "int main() { return 0;}" + echo > conftest.c "int main(void) { return 0;}" ${CC_BUILD} conftest.c || AC_MSG_ERROR([native C compiler is not working]) rm -f conftest.c if test -x a.out -o -x b.out -o -x conftest; then @@ -163,9 +163,6 @@ fi AC_SUBST([FTSYS_SRC]) -AC_CHECK_FUNCS([memcpy memmove]) - - # get compiler flags right # # We try to make the compiler work for C99-strict source. Even if the @@ -406,16 +403,12 @@ if test x"$with_png" = xyes -o x"$with_png" = xauto; then have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)" else # fall back to config script - AC_MSG_CHECKING([for libpng-config]) - if which libpng-config > /dev/null 2>&1; then + AC_CHECK_PROG(have_libpng, [libpng-config], [yes (libpng-config)], [no]) + if test "$have_libpng" != no; then LIBPNG_CFLAGS=`libpng-config --cflags` LIBPNG_LIBS=`libpng-config --ldflags` libpng_libspriv=`libpng-config --static --ldflags` libpng_libsstaticconf="$libpng_libspriv" - have_libpng="yes (libpng-config)" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) fi fi fi diff --git a/lib/freetype/builds/unix/detect.mk b/lib/freetype/builds/unix/detect.mk index 7ed58ff74..6b87013d5 100644 --- a/lib/freetype/builds/unix/detect.mk +++ b/lib/freetype/builds/unix/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/unix/freetype-config.in b/lib/freetype/builds/unix/freetype-config.in index c076bc1f8..58561126f 100644 --- a/lib/freetype/builds/unix/freetype-config.in +++ b/lib/freetype/builds/unix/freetype-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2000-2022 by +# Copyright (C) 2000-2023 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/lib/freetype/builds/unix/freetype2.m4 b/lib/freetype/builds/unix/freetype2.m4 index 0cafc8e8c..09ead4304 100644 --- a/lib/freetype/builds/unix/freetype2.m4 +++ b/lib/freetype/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-2022 by +# Copyright (C) 2001-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -15,7 +15,7 @@ # generated by Autoconf, under the same distribution terms as the rest of # that program. # -# serial 6 +# serial 7 # AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) # Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS. @@ -121,7 +121,7 @@ AC_DEFUN([AC_CHECK_FT2], #include <stdlib.h> int -main() +main(void) { FT_Library library; FT_Error error; diff --git a/lib/freetype/builds/unix/ft-munmap.m4 b/lib/freetype/builds/unix/ft-munmap.m4 index c536febb2..a0fcf3580 100644 --- a/lib/freetype/builds/unix/ft-munmap.m4 +++ b/lib/freetype/builds/unix/ft-munmap.m4 @@ -1,6 +1,6 @@ ## FreeType specific autoconf tests # -# Copyright (C) 2002-2022 by +# Copyright (C) 2002-2023 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/lib/freetype/builds/unix/ftconfig.h b/lib/freetype/builds/unix/ftconfig.h index 51cb79639..e3f037029 100644 --- a/lib/freetype/builds/unix/ftconfig.h +++ b/lib/freetype/builds/unix/ftconfig.h @@ -5,7 +5,7 @@ * * UNIX-specific configuration file (specification only). * - * Copyright (C) 1996-2020 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/builds/unix/ftconfig.h.in b/lib/freetype/builds/unix/ftconfig.h.in index 67474dcef..3dac56126 100644 --- a/lib/freetype/builds/unix/ftconfig.h.in +++ b/lib/freetype/builds/unix/ftconfig.h.in @@ -4,7 +4,7 @@ * * UNIX-specific configuration file (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/builds/unix/ftsystem.c b/lib/freetype/builds/unix/ftsystem.c index 4d2870b59..5927215df 100644 --- a/lib/freetype/builds/unix/ftsystem.c +++ b/lib/freetype/builds/unix/ftsystem.c @@ -4,7 +4,7 @@ * * Unix-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/builds/unix/install.mk b/lib/freetype/builds/unix/install.mk index 0758d6e1a..2f1729b71 100644 --- a/lib/freetype/builds/unix/install.mk +++ b/lib/freetype/builds/unix/install.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/unix/unix-cc.in b/lib/freetype/builds/unix/unix-cc.in index d5ae46745..802016dda 100644 --- a/lib/freetype/builds/unix/unix-cc.in +++ b/lib/freetype/builds/unix/unix-cc.in @@ -2,7 +2,7 @@ # FreeType 2 template for Unix-specific compiler definitions # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/unix/unix-def.in b/lib/freetype/builds/unix/unix-def.in index 8e298ac59..d50994f3c 100644 --- a/lib/freetype/builds/unix/unix-def.in +++ b/lib/freetype/builds/unix/unix-def.in @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/unix/unix-dev.mk b/lib/freetype/builds/unix/unix-dev.mk index 37543895b..9dd8ad6ae 100644 --- a/lib/freetype/builds/unix/unix-dev.mk +++ b/lib/freetype/builds/unix/unix-dev.mk @@ -6,7 +6,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/unix/unix-lcc.mk b/lib/freetype/builds/unix/unix-lcc.mk index 0198adfd8..ded24f486 100644 --- a/lib/freetype/builds/unix/unix-lcc.mk +++ b/lib/freetype/builds/unix/unix-lcc.mk @@ -6,7 +6,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/unix/unix.mk b/lib/freetype/builds/unix/unix.mk index e660fafa9..3505175b5 100644 --- a/lib/freetype/builds/unix/unix.mk +++ b/lib/freetype/builds/unix/unix.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/unix/unixddef.mk b/lib/freetype/builds/unix/unixddef.mk index 923773e09..71973471d 100644 --- a/lib/freetype/builds/unix/unixddef.mk +++ b/lib/freetype/builds/unix/unixddef.mk @@ -4,7 +4,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/vms/ftconfig.h b/lib/freetype/builds/vms/ftconfig.h index 8f5ca9671..31dfcecbd 100644 --- a/lib/freetype/builds/vms/ftconfig.h +++ b/lib/freetype/builds/vms/ftconfig.h @@ -4,7 +4,7 @@ * * VMS-specific configuration file (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/builds/vms/ftsystem.c b/lib/freetype/builds/vms/ftsystem.c index e700eac5c..0afd07d91 100644 --- a/lib/freetype/builds/vms/ftsystem.c +++ b/lib/freetype/builds/vms/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* VMS-specific FreeType low-level system interface (body). */ /* */ -/* Copyright (C) 1996-2022 by */ +/* Copyright (C) 1996-2023 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/lib/freetype/builds/wince/ftdebug.c b/lib/freetype/builds/wince/ftdebug.c index 7a4fac5d2..6453f8d23 100644 --- a/lib/freetype/builds/wince/ftdebug.c +++ b/lib/freetype/builds/wince/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for WinCE (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/builds/wince/vc2005-ce/index.html b/lib/freetype/builds/wince/vc2005-ce/index.html index 0b711ff90..0a8b3c660 100644 --- a/lib/freetype/builds/wince/vc2005-ce/index.html +++ b/lib/freetype/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.12.1 sources:</p> +It compiles the following libraries from the FreeType 2.13.0 sources:</p> <ul> <pre> diff --git a/lib/freetype/builds/wince/vc2008-ce/index.html b/lib/freetype/builds/wince/vc2008-ce/index.html index 23f06ba03..747370aa9 100644 --- a/lib/freetype/builds/wince/vc2008-ce/index.html +++ b/lib/freetype/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.12.1 sources:</p> +It compiles the following libraries from the FreeType 2.13.0 sources:</p> <ul> <pre> diff --git a/lib/freetype/builds/windows/detect.mk b/lib/freetype/builds/windows/detect.mk index 759a2e640..d7908bee5 100644 --- a/lib/freetype/builds/windows/detect.mk +++ b/lib/freetype/builds/windows/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/ftdebug.c b/lib/freetype/builds/windows/ftdebug.c index a65f54469..360f8c7e3 100644 --- a/lib/freetype/builds/windows/ftdebug.c +++ b/lib/freetype/builds/windows/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for Win32 (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/builds/windows/ftsystem.c b/lib/freetype/builds/windows/ftsystem.c index 6557cea1a..418d7995e 100644 --- a/lib/freetype/builds/windows/ftsystem.c +++ b/lib/freetype/builds/windows/ftsystem.c @@ -4,7 +4,7 @@ * * Windows-specific FreeType low-level system interface (body). * - * Copyright (C) 2021-2022 by + * Copyright (C) 2021-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/builds/windows/vc2010/index.html b/lib/freetype/builds/windows/vc2010/index.html index 904d5e9b6..c03be775e 100644 --- a/lib/freetype/builds/windows/vc2010/index.html +++ b/lib/freetype/builds/windows/vc2010/index.html @@ -12,7 +12,7 @@ <p>This directory contains solution and project files for Visual C++ 2010 or newer, named <tt>freetype.sln</tt>, and <tt>freetype.vcxproj</tt>. It compiles the following libraries -from the FreeType 2.12.1 sources:</p> +from the FreeType 2.13.0 sources:</p> <ul> <li>freetype.dll using 'Release' or 'Debug' configurations</li> diff --git a/lib/freetype/builds/windows/visualc/index.html b/lib/freetype/builds/windows/visualc/index.html index fdced23da..6a70b34b1 100644 --- a/lib/freetype/builds/windows/visualc/index.html +++ b/lib/freetype/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.12.1 sources:</p> +It compiles the following libraries from the FreeType 2.13.0 sources:</p> <ul> <li>freetype.dll using 'Release' or 'Debug' configurations</li> diff --git a/lib/freetype/builds/windows/visualce/index.html b/lib/freetype/builds/windows/visualce/index.html index 579edb56b..cebab29a0 100644 --- a/lib/freetype/builds/windows/visualce/index.html +++ b/lib/freetype/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.12.1 sources:</p> +It compiles the following libraries from the FreeType 2.13.0 sources:</p> <ul> <pre> diff --git a/lib/freetype/builds/windows/w32-bcc.mk b/lib/freetype/builds/windows/w32-bcc.mk index b88dbac6e..e7cf668df 100644 --- a/lib/freetype/builds/windows/w32-bcc.mk +++ b/lib/freetype/builds/windows/w32-bcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-bccd.mk b/lib/freetype/builds/windows/w32-bccd.mk index 2be492cef..64dafdb94 100644 --- a/lib/freetype/builds/windows/w32-bccd.mk +++ b/lib/freetype/builds/windows/w32-bccd.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-dev.mk b/lib/freetype/builds/windows/w32-dev.mk index a58f8247d..7c89ad2a2 100644 --- a/lib/freetype/builds/windows/w32-dev.mk +++ b/lib/freetype/builds/windows/w32-dev.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-gcc.mk b/lib/freetype/builds/windows/w32-gcc.mk index 52b893339..f37c185f5 100644 --- a/lib/freetype/builds/windows/w32-gcc.mk +++ b/lib/freetype/builds/windows/w32-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-icc.mk b/lib/freetype/builds/windows/w32-icc.mk index a05a3a789..cf51ccead 100644 --- a/lib/freetype/builds/windows/w32-icc.mk +++ b/lib/freetype/builds/windows/w32-icc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-intl.mk b/lib/freetype/builds/windows/w32-intl.mk index fb5c96090..0c16b4c84 100644 --- a/lib/freetype/builds/windows/w32-intl.mk +++ b/lib/freetype/builds/windows/w32-intl.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-lcc.mk b/lib/freetype/builds/windows/w32-lcc.mk index 66de0aa56..0dd740e25 100644 --- a/lib/freetype/builds/windows/w32-lcc.mk +++ b/lib/freetype/builds/windows/w32-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-mingw32.mk b/lib/freetype/builds/windows/w32-mingw32.mk index e3b89697a..dc323bd34 100644 --- a/lib/freetype/builds/windows/w32-mingw32.mk +++ b/lib/freetype/builds/windows/w32-mingw32.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-vcc.mk b/lib/freetype/builds/windows/w32-vcc.mk index 4a48407a2..eea7db8b5 100644 --- a/lib/freetype/builds/windows/w32-vcc.mk +++ b/lib/freetype/builds/windows/w32-vcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/w32-wat.mk b/lib/freetype/builds/windows/w32-wat.mk index 4458b2341..5392d2a4b 100644 --- a/lib/freetype/builds/windows/w32-wat.mk +++ b/lib/freetype/builds/windows/w32-wat.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/builds/windows/win32-def.mk b/lib/freetype/builds/windows/win32-def.mk index eb96181dd..324265132 100644 --- a/lib/freetype/builds/windows/win32-def.mk +++ b/lib/freetype/builds/windows/win32-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/devel/ft2build.h b/lib/freetype/devel/ft2build.h index 92bc9e01a..82fdb30f6 100644 --- a/lib/freetype/devel/ft2build.h +++ b/lib/freetype/devel/ft2build.h @@ -4,7 +4,7 @@ * * FreeType 2 build and setup macros (development version). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/devel/ftoption.h b/lib/freetype/devel/ftoption.h index b2363d74c..1ae9b1aed 100644 --- a/lib/freetype/devel/ftoption.h +++ b/lib/freetype/devel/ftoption.h @@ -4,7 +4,7 @@ * * User-selectable configuration macros (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -445,6 +445,8 @@ FT_BEGIN_HEADER * trace log messages to a file instead of `stderr`. For writing logs * to a file, FreeType uses an the external `dlg` library (the source * code is in `src/dlg`). + * + * This option needs a C99 compiler. */ #define FT_DEBUG_LOGGING @@ -459,9 +461,9 @@ FT_BEGIN_HEADER * while compiling in 'release' mode): * * ``` - * _af_debug_disable_horz_hints - * _af_debug_disable_vert_hints - * _af_debug_disable_blue_hints + * af_debug_disable_horz_hints_ + * af_debug_disable_vert_hints_ + * af_debug_disable_blue_hints_ * ``` * * Additionally, the following functions provide dumps of various @@ -478,7 +480,7 @@ FT_BEGIN_HEADER * As an argument, they use another global variable: * * ``` - * _af_debug_hints + * af_debug_hints_ * ``` * * Please have a look at the `ftgrid` demo program to see how those @@ -582,12 +584,12 @@ FT_BEGIN_HEADER /************************************************************************** * * Define `TT_CONFIG_OPTION_POSTSCRIPT_NAMES` if you want to be able to - * load and enumerate the glyph Postscript names in a TrueType or OpenType + * load and enumerate Postscript names of glyphs in a TrueType or OpenType * file. * - * Note that when you do not compile the 'psnames' module by undefining the - * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES`, the 'sfnt' module will - * contain additional code used to read the PS Names table from a font. + * Note that if you do not compile the 'psnames' module by undefining the + * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES` macro, the 'sfnt' module will + * contain additional code to read the PostScript name table from a font. * * (By default, the module uses 'psnames' to extract glyph names.) */ @@ -739,6 +741,24 @@ FT_BEGIN_HEADER /************************************************************************** * + * Define `TT_CONFIG_OPTION_NO_BORING_EXPANSION` if you want to exclude + * support for 'boring' OpenType specification expansions. + * + * https://github.com/harfbuzz/boring-expansion-spec + * + * Right now, the following features are covered: + * + * - 'avar' version 2.0 + * + * Most likely, this is a temporary configuration option to be removed in + * the near future, since it is assumed that eventually those features are + * added to the OpenType standard. + */ +/* #define TT_CONFIG_OPTION_NO_BORING_EXPANSION */ + + + /************************************************************************** + * * Define `TT_CONFIG_OPTION_BDF` if you want to include support for an * embedded 'BDF~' table within SFNT-based bitmap formats. */ diff --git a/lib/freetype/docs/CHANGES b/lib/freetype/docs/CHANGES index 3ad7ec433..3c6a8774b 100644 --- a/lib/freetype/docs/CHANGES +++ b/lib/freetype/docs/CHANGES @@ -1,4 +1,84 @@ -CHANGES BETWEEN 2.12.0 and 2.12.1 +CHANGES BETWEEN 2.12.1 and 2.13.0 (2023-Feb-09) + + I. IMPORTANT CHANGES + + - The demo program `ftinspect` has been completely updated and much + enhanced. It now combines the functionality of almost all other + graphical FreeType demo programs into a single application based + on the Qt framework. This was Charlie Jiang's GSoC 2022 project. + + - The 'COLR' v1 API is now considered as stable. + + https://learn.microsoft.com/en-us/typography/opentype/spec/colr + + + III. MISCELLANEOUS + + - For OpenType Variable Fonts, `avar` table format 2.0 is now + supported. The code was contributed by Behdad Esfahbod. + + Note that this is an extension supported on recent Apple platforms + and by HarfBuzz, but not yet in the OpenType standard! See + + https://github.com/harfbuzz/boring-expansion-spec/blob/main/avar2.md + + for the specification. To deactivate it, define the configuration + macro 'TT_CONFIG_OPTION_NO_BORING_EXPANSION'. + + - A new API `FT_GlyphSlot_Slant` to slant a glyph by a given angle + has been added. Note that this function is part of `ftsynth.h`, + which is still considered to be in alpha stage. + + - TrueType interpreter version 38 (also known as 'Infinality') that + was first introduced about 10 years ago in FreeType 2.4.11 is now + deprecated and slated to be removed in the next version. TrueType + interpreter version 40 has been FreeType's default version for six + years now and provides an excellent alternative. This is the last + FreeType version with TT_INTERPRETER_VERSION_38 and + TT_INTERPRETER_VERSION_40 treated differently. + + - The only referenced but never documented configuration macro + `FT_CONFIG_OPTION_NO_GLYPH_NAMES` has been removed. + + - The `ftbench` demo program got a new command line option `-e` to + set a charmap index. + + - Specifying a point size is now optional for the demo programs + `ftgrid`, `ftmulti`, `ftstring`, and `ftview`. If not given, a + default size is used. + + - For `ftgrid`, `ftstring`, and `ftview`, option `-e` now also + accepts a numeric value to set a charmap index. + + - In `ftstring`, it is now possible to set the displayed text + interactively by pressing the 'Enter' key. + + - `ftmulti` can now handle up to 16 design axes. + + - To avoid reserved identifiers that are globally defined, the + auto-hinter debugging macros (which are only available if + `FT_DEBUG_AUTOFIT` is defined) + + ``` + _af_debug_disable_horz_hints + _af_debug_disable_vert_hints + _af_debug_disable_blue_hints + _af_debug_hints + ``` + + have been renamed to + + ``` + af_debug_disable_horz_hints_ + af_debug_disable_vert_hints_ + af_debug_disable_blue_hints_ + af_debug_hints_ + ``` + + +====================================================================== + +CHANGES BETWEEN 2.12.0 and 2.12.1 (2022-May-01) I. IMPORTANT BUG FIXES @@ -28,7 +108,7 @@ CHANGES BETWEEN 2.12.0 and 2.12.1 ====================================================================== -CHANGES BETWEEN 2.11.1 and 2.12.0 +CHANGES BETWEEN 2.11.1 and 2.12.0 (2022-Mar-30) I. IMPORTANT CHANGES @@ -79,7 +159,7 @@ CHANGES BETWEEN 2.11.1 and 2.12.0 ====================================================================== -CHANGES BETWEEN 2.11.0 and 2.11.1 +CHANGES BETWEEN 2.11.0 and 2.11.1 (2021-Dec-01) I. IMPORTANT CHANGES @@ -111,7 +191,7 @@ CHANGES BETWEEN 2.11.0 and 2.11.1 ====================================================================== -CHANGES BETWEEN 2.10.4 and 2.11.0 +CHANGES BETWEEN 2.10.4 and 2.11.0 (2021-Jul-18) I. IMPORTANT CHANGES @@ -5530,7 +5610,7 @@ Extensions support: ------------------------------------------------------------------------ -Copyright (C) 2000-2022 by +Copyright (C) 2000-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/CUSTOMIZE b/lib/freetype/docs/CUSTOMIZE index 1a750825b..80527db7e 100644 --- a/lib/freetype/docs/CUSTOMIZE +++ b/lib/freetype/docs/CUSTOMIZE @@ -139,7 +139,7 @@ IV. Overriding default configuration and module headers ---------------------------------------------------------------------- -Copyright (C) 2003-2022 by +Copyright (C) 2003-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/DEBUG b/lib/freetype/docs/DEBUG index fd2de134d..4a5ac3a40 100644 --- a/lib/freetype/docs/DEBUG +++ b/lib/freetype/docs/DEBUG @@ -297,7 +297,7 @@ to access them. ------------------------------------------------------------------------ -Copyright (C) 2002-2022 by +Copyright (C) 2002-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/DOCGUIDE b/lib/freetype/docs/DOCGUIDE index 3dbe499d6..b46b7bd54 100644 --- a/lib/freetype/docs/DOCGUIDE +++ b/lib/freetype/docs/DOCGUIDE @@ -285,7 +285,7 @@ is converted to ---------------------------------------------------------------------- -Copyright (C) 2018-2022 by +Copyright (C) 2018-2023 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/lib/freetype/docs/INSTALL.ANY b/lib/freetype/docs/INSTALL.ANY index ceb76f5a9..bb77b1b9c 100644 --- a/lib/freetype/docs/INSTALL.ANY +++ b/lib/freetype/docs/INSTALL.ANY @@ -144,7 +144,7 @@ II. Support for flat-directory compilation ---------------------------------------------------------------------- -Copyright (C) 2003-2022 by +Copyright (C) 2003-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/INSTALL.CROSS b/lib/freetype/docs/INSTALL.CROSS index 931a4d796..21f4c3182 100644 --- a/lib/freetype/docs/INSTALL.CROSS +++ b/lib/freetype/docs/INSTALL.CROSS @@ -163,7 +163,7 @@ procedure. ---------------------------------------------------------------------- -Copyright (C) 2006-2022 by +Copyright (C) 2006-2023 by suzuki toshiya, David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/lib/freetype/docs/INSTALL.GNU b/lib/freetype/docs/INSTALL.GNU index 5e161ad94..7517d9c7c 100644 --- a/lib/freetype/docs/INSTALL.GNU +++ b/lib/freetype/docs/INSTALL.GNU @@ -168,7 +168,7 @@ instructions in the file `INSTALL.UNIX' instead. ---------------------------------------------------------------------- -Copyright (C) 2003-2022 by +Copyright (C) 2003-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/INSTALL.UNIX b/lib/freetype/docs/INSTALL.UNIX index b6f63c871..659f3a21f 100644 --- a/lib/freetype/docs/INSTALL.UNIX +++ b/lib/freetype/docs/INSTALL.UNIX @@ -126,7 +126,7 @@ or MSys on Win32: ---------------------------------------------------------------------- -Copyright (C) 2003-2022 by +Copyright (C) 2003-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/INSTALL.VMS b/lib/freetype/docs/INSTALL.VMS index 6cd390d95..4ed4016a2 100644 --- a/lib/freetype/docs/INSTALL.VMS +++ b/lib/freetype/docs/INSTALL.VMS @@ -49,7 +49,7 @@ V7.2-1. ------------------------------------------------------------------------ -Copyright (C) 2000-2022 by +Copyright (C) 2000-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/TODO b/lib/freetype/docs/TODO index 623866eab..d340880d2 100644 --- a/lib/freetype/docs/TODO +++ b/lib/freetype/docs/TODO @@ -27,7 +27,7 @@ Other bugs have been registered at the savannah bugzilla of FreeType. ------------------------------------------------------------------------ -Copyright (C) 2001-2022 by +Copyright (C) 2001-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/VERSIONS.TXT b/lib/freetype/docs/VERSIONS.TXT index 82dda0f26..92f6a8ccd 100644 --- a/lib/freetype/docs/VERSIONS.TXT +++ b/lib/freetype/docs/VERSIONS.TXT @@ -60,6 +60,7 @@ found on _most_ systems, but not all of them: release libtool so ------------------------------- + 2.13.0 25.0.19 6.19.0 2.12.1 24.3.18 6.18.3 2.12.0 24.2.18 6.18.2 2.11.1 24.1.18 6.18.1 @@ -121,7 +122,7 @@ other release numbers. ---------------------------------------------------------------------- -Copyright (C) 2002-2022 by +Copyright (C) 2002-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/formats.txt b/lib/freetype/docs/formats.txt index e0cafbaa4..7a4bae09b 100644 --- a/lib/freetype/docs/formats.txt +++ b/lib/freetype/docs/formats.txt @@ -200,7 +200,7 @@ which isn't supported yet please send a mail too. ------------------------------------------------------------------------ -Copyright (C) 2004-2022 by +Copyright (C) 2004-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/freetype-config.1 b/lib/freetype/docs/freetype-config.1 index ca067fc36..64594315f 100644 --- a/lib/freetype/docs/freetype-config.1 +++ b/lib/freetype/docs/freetype-config.1 @@ -1,4 +1,4 @@ -.TH FREETYPE-CONFIG 1 "May 2022" "FreeType 2.12.1" +.TH FREETYPE-CONFIG 1 "February 2023" "FreeType 2.13.0" . . .SH NAME diff --git a/lib/freetype/docs/oldlogs/ChangeLog.20 b/lib/freetype/docs/oldlogs/ChangeLog.20 index d31732406..09937286e 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.20 +++ b/lib/freetype/docs/oldlogs/ChangeLog.20 @@ -2597,7 +2597,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2000-2022 by +Copyright (C) 2000-2023 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/lib/freetype/docs/oldlogs/ChangeLog.21 b/lib/freetype/docs/oldlogs/ChangeLog.21 index e8a36ae0f..b331257b7 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.21 +++ b/lib/freetype/docs/oldlogs/ChangeLog.21 @@ -9422,7 +9422,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2002-2022 by +Copyright (C) 2002-2023 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/lib/freetype/docs/oldlogs/ChangeLog.210 b/lib/freetype/docs/oldlogs/ChangeLog.210 index 6139fe8da..adb23d5dd 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.210 +++ b/lib/freetype/docs/oldlogs/ChangeLog.210 @@ -64,7 +64,7 @@ [smooth] Minor fixes. * src/smooth/ftgrays.c (gray_render_conic): Move variable and - structure declarations to beginning of function. Inspite of C99 + structure declarations to beginning of function. In spite of C99 compliance we still do this for the sake of backward compatibility. This also avoids a shadowing declaration of `count`. (gray_convert_glyph_inner): Fix typo. @@ -134,7 +134,7 @@ Before: 17.988 us/op After: 17.389 us/op - * src/smooth/ftgrays.c (grat_TWorker): Replace `num_cells` field with + * src/smooth/ftgrays.c (gray_TWorker): Replace `num_cells` field with `cell_free` and `cell_limit`. (NULL_CELL_PTR, CELL_MAX_X_VALUE, CELL_IS_NULL): New macros. (gray_dump_cells, gray_set_cell, gray_sweep, gray_sweep_direct, @@ -352,7 +352,7 @@ It is undefined behavior to pass `NULL` to `memcpy`. `coords' is passed to `memcpy` but `TT_Get_MM_Blend` and `TT_Get_Var_Design` - explictly call `tt_set_mm_blend` with `coords` as `NULL`. In + explicitly call `tt_set_mm_blend` with `coords` as `NULL`. In addition, `TT_Set_MM_Blend` has a similar possible issue. 2021-06-30 Dominik Röttsches <drott@chromium.org> @@ -534,7 +534,7 @@ Move 'COLR' API to `ftcolor.h`. - * include/freetype/freetype.h: Cut section layer managament + * include/freetype/freetype.h: Cut section layer management containing 'COLR' v0 and v1 API and move it to `ftcolor.h` as requested by Werner on freetype-devel. * include/freetype/ftcolor.h: Paste that section. @@ -1005,23 +1005,23 @@ 2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com> - * src/cid/cidload.c (cid_read_subrs): Tweak allocaton macro. + * src/cid/cidload.c (cid_read_subrs): Tweak allocation macro. 2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com> [sfnt] Avoid some memory zeroing. * src/sfnt/sfobjs.c (sfnt_open_font, sfnt_init_face, - tt_name_ascii_from_{utf16,other}): Tweak allocaton macros. + tt_name_ascii_from_{utf16,other}): Tweak allocation macros. * src/sfnt/ttload.c (tt_face_load_name): Ditto. 2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com> - * src/sfnt/ttpost.c (load_format_{20,25}): Tweak allocaton macros. + * src/sfnt/ttpost.c (load_format_{20,25}): Tweak allocation macros. 2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com> - * src/sfnt/pngshim.c (Load_SBit_Png): Tweak allocaton macro. + * src/sfnt/pngshim.c (Load_SBit_Png): Tweak allocation macro. 2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com> @@ -2343,7 +2343,7 @@ * src/sdf/ftbsdf.c, src/sdf/ftbsdf.h: The rasterizer for the 'bsdf' renderer. - * src/sdf/ftsdfcommon.h: Commmon properties and functions for both + * src/sdf/ftsdfcommon.h: Common properties and functions for both rasterizers. * src/sdf/ftsdferrs.h: Common error defines. @@ -2411,9 +2411,9 @@ units per em (e.g. Inter). This patch fixes it. The return value of af_loader_compute_darkening was also changed to - use 16.16 fixed point to get rid of a redundant truncation operation. + use 16.16 fixed-point to get rid of a redundant truncation operation. This should slightly improve the precision, although it's still - bottlenecked by the emboldening function, which uses 26.6 fixed point. + bottlenecked by the emboldening function, which uses 26.6 fixed-point. * src/autofit/afloader.[ch] (af_loader_compute_darkening): Return FT_Fixed. @@ -3565,7 +3565,7 @@ [builds] Clean up Windows CE project files. - Remove version from filenames that caused a lot of polution in the + Remove version from filenames that caused a lot of pollution in the release process. Use VERSIONINFO resource instead. * builds/wince/vc2005-ce/freetype.vcproj, @@ -4453,7 +4453,7 @@ (reconstruct_font): Change `FT_Byte* sfnt' to `FT_Byte** sfnt_bytes'. This has been done because we reallocate memory to `sfnt' multiple times, which may change the pointer value of `sfnt'. - This new pointer must be propogated back to the caller. Same reason + This new pointer must be propagated back to the caller. Same reason for using a double pointer in `write_buf'. * src/sfnt/woff2tags.h (WOFF2_DEFAULT_MAX_SIZE): New macro used for @@ -4954,7 +4954,7 @@ [truetype] Doh. Fix last commit to make it work. - Very embarassing :-) + Very embarrassing :-) Reported as @@ -5307,7 +5307,7 @@ (dist): Remove remnants of `docmaker' tool. (do-dist): Remove unused intermediate files. - * src/cff/cffparse.c (destrict_c2s_item): Guard function with + * src/cff/cffparse.c (destruct_c2s_item): Guard function with CFF_CONFIG_OPTION_OLD_ENGINE macro. 2019-03-07 Andrei Alexeyev <0x416b617269@gmail.com> @@ -5491,7 +5491,7 @@ members. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. - * src/cffcffdrivr.c (cff_set_mm_weightvector, + * src/cff/cffdrivr.c (cff_set_mm_weightvector, cff_get_mm_weightvector): New functions. (cff_service_multi_masters): Register them. @@ -5521,7 +5521,7 @@ [builds] Belated DLL support with vc2002-vc2008. The solution and project files should be automatically upgraded for - the approriate Visual C++ version. + the appropriate Visual C++ version. * builds/windows/visualc/freetype.{sln,vcproj}: Major upgrades. * builds/windows/visualc/index.html: Document the change. @@ -5900,7 +5900,7 @@ Remove unused fields. * src/pcf.h (PCF_FaceRec): Remove `charmap' and `charmap_handle'. - * src/bdfdrvr.h (BDF_FaceRec): Ditto. + * src/bdfdrivr.h (BDF_FaceRec): Ditto. * src/winfonts/winfnt.h (FNT_FaceRec): Ditto. 2018-09-17 Werner Lemberg <wl@gnu.org> @@ -7799,7 +7799,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2018-2022 by +Copyright (C) 2018-2023 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/lib/freetype/docs/oldlogs/ChangeLog.22 b/lib/freetype/docs/oldlogs/ChangeLog.22 index e7e13604d..b06d6451e 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.22 +++ b/lib/freetype/docs/oldlogs/ChangeLog.22 @@ -2821,7 +2821,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2005-2022 by +Copyright (C) 2005-2023 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/lib/freetype/docs/oldlogs/ChangeLog.23 b/lib/freetype/docs/oldlogs/ChangeLog.23 index d0792cba0..a8a69dd20 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.23 +++ b/lib/freetype/docs/oldlogs/ChangeLog.23 @@ -7932,7 +7932,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2006-2022 by +Copyright (C) 2006-2023 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/lib/freetype/docs/oldlogs/ChangeLog.24 b/lib/freetype/docs/oldlogs/ChangeLog.24 index aa9ca8c26..0dbb2ac78 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.24 +++ b/lib/freetype/docs/oldlogs/ChangeLog.24 @@ -707,7 +707,7 @@ [base] Fix integer overflow. * src/base/ftoutln.c (FT_Outline_EmboldenXY): Normalize incoming and - outgoing vectors and use fixed point arithmetic. + outgoing vectors and use fixed-point arithmetic. 2013-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> @@ -6344,7 +6344,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2010-2022 by +Copyright (C) 2010-2023 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/lib/freetype/docs/oldlogs/ChangeLog.25 b/lib/freetype/docs/oldlogs/ChangeLog.25 index a2b6a91c3..31d511117 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.25 +++ b/lib/freetype/docs/oldlogs/ChangeLog.25 @@ -5145,7 +5145,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2013-2022 by +Copyright (C) 2013-2023 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/lib/freetype/docs/oldlogs/ChangeLog.26 b/lib/freetype/docs/oldlogs/ChangeLog.26 index 59dd6022a..528345e86 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.26 +++ b/lib/freetype/docs/oldlogs/ChangeLog.26 @@ -5695,7 +5695,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2015-2022 by +Copyright (C) 2015-2023 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/lib/freetype/docs/oldlogs/ChangeLog.27 b/lib/freetype/docs/oldlogs/ChangeLog.27 index d35e3446e..6510e4564 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.27 +++ b/lib/freetype/docs/oldlogs/ChangeLog.27 @@ -2090,7 +2090,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2016-2022 by +Copyright (C) 2016-2023 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/lib/freetype/docs/oldlogs/ChangeLog.28 b/lib/freetype/docs/oldlogs/ChangeLog.28 index 8e655e4d9..603fc61b1 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.28 +++ b/lib/freetype/docs/oldlogs/ChangeLog.28 @@ -3120,7 +3120,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2016-2022 by +Copyright (C) 2016-2023 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/lib/freetype/docs/oldlogs/ChangeLog.29 b/lib/freetype/docs/oldlogs/ChangeLog.29 index 1274085f4..3d73d4722 100644 --- a/lib/freetype/docs/oldlogs/ChangeLog.29 +++ b/lib/freetype/docs/oldlogs/ChangeLog.29 @@ -2336,7 +2336,7 @@ ---------------------------------------------------------------------------- -Copyright (C) 2017-2022 by +Copyright (C) 2017-2023 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/lib/freetype/docs/raster.txt b/lib/freetype/docs/raster.txt index 05fbe4917..1642a81d9 100644 --- a/lib/freetype/docs/raster.txt +++ b/lib/freetype/docs/raster.txt @@ -63,7 +63,7 @@ II. Rendering Technology `26.6' means that 26 bits are used for the integer part of a value and 6 bits are used for the fractional part. Consequently, the `distance' between two neighbouring pixels is - 64 `units' (1 unit = 1/64th of a pixel). + 64 `units' (1 unit = 1/64 of a pixel). Note that, for the rasterizer, pixel centers are located at integer coordinates. The TrueType bytecode interpreter, @@ -618,7 +618,7 @@ II. Rendering Technology ------------------------------------------------------------------------ -Copyright (C) 2003-2022 by +Copyright (C) 2003-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/docs/release b/lib/freetype/docs/release index d9cff6799..fec91e8a7 100644 --- a/lib/freetype/docs/release +++ b/lib/freetype/docs/release @@ -190,7 +190,7 @@ How to prepare a new release ---------------------------------------------------------------------- -Copyright (C) 2003-2022 by +Copyright (C) 2003-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/config/ftconfig.h b/lib/freetype/include/freetype/config/ftconfig.h index c696e900a..a85151699 100644 --- a/lib/freetype/include/freetype/config/ftconfig.h +++ b/lib/freetype/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ * * ANSI-specific configuration file (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/config/ftheader.h b/lib/freetype/include/freetype/config/ftheader.h index a8c6833df..e607bce15 100644 --- a/lib/freetype/include/freetype/config/ftheader.h +++ b/lib/freetype/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ * * Build macros of the FreeType 2 library. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/config/ftoption.h b/lib/freetype/include/freetype/config/ftoption.h index cd64a80a2..8ea4aa99e 100644 --- a/lib/freetype/include/freetype/config/ftoption.h +++ b/lib/freetype/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ * * User-selectable configuration macros (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -461,9 +461,9 @@ FT_BEGIN_HEADER * while compiling in 'release' mode): * * ``` - * _af_debug_disable_horz_hints - * _af_debug_disable_vert_hints - * _af_debug_disable_blue_hints + * af_debug_disable_horz_hints_ + * af_debug_disable_vert_hints_ + * af_debug_disable_blue_hints_ * ``` * * Additionally, the following functions provide dumps of various @@ -480,7 +480,7 @@ FT_BEGIN_HEADER * As an argument, they use another global variable: * * ``` - * _af_debug_hints + * af_debug_hints_ * ``` * * Please have a look at the `ftgrid` demo program to see how those @@ -584,12 +584,12 @@ FT_BEGIN_HEADER /************************************************************************** * * Define `TT_CONFIG_OPTION_POSTSCRIPT_NAMES` if you want to be able to - * load and enumerate the glyph Postscript names in a TrueType or OpenType + * load and enumerate Postscript names of glyphs in a TrueType or OpenType * file. * - * Note that when you do not compile the 'psnames' module by undefining the - * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES`, the 'sfnt' module will - * contain additional code used to read the PS Names table from a font. + * Note that if you do not compile the 'psnames' module by undefining the + * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES` macro, the 'sfnt' module will + * contain additional code to read the PostScript name table from a font. * * (By default, the module uses 'psnames' to extract glyph names.) */ @@ -741,6 +741,24 @@ FT_BEGIN_HEADER /************************************************************************** * + * Define `TT_CONFIG_OPTION_NO_BORING_EXPANSION` if you want to exclude + * support for 'boring' OpenType specification expansions. + * + * https://github.com/harfbuzz/boring-expansion-spec + * + * Right now, the following features are covered: + * + * - 'avar' version 2.0 + * + * Most likely, this is a temporary configuration option to be removed in + * the near future, since it is assumed that eventually those features are + * added to the OpenType standard. + */ +/* #define TT_CONFIG_OPTION_NO_BORING_EXPANSION */ + + + /************************************************************************** + * * Define `TT_CONFIG_OPTION_BDF` if you want to include support for an * embedded 'BDF~' table within SFNT-based bitmap formats. */ diff --git a/lib/freetype/include/freetype/config/ftstdlib.h b/lib/freetype/include/freetype/config/ftstdlib.h index 7958c2a5f..3c9d2ae59 100644 --- a/lib/freetype/include/freetype/config/ftstdlib.h +++ b/lib/freetype/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ * ANSI-specific library and header configuration file (specification * only). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/config/integer-types.h b/lib/freetype/include/freetype/config/integer-types.h index d9d2638d1..7258b5085 100644 --- a/lib/freetype/include/freetype/config/integer-types.h +++ b/lib/freetype/include/freetype/config/integer-types.h @@ -4,7 +4,7 @@ * * FreeType integer types definitions. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/config/mac-support.h b/lib/freetype/include/freetype/config/mac-support.h index e42c9fe41..b77b96d5d 100644 --- a/lib/freetype/include/freetype/config/mac-support.h +++ b/lib/freetype/include/freetype/config/mac-support.h @@ -4,7 +4,7 @@ * * Mac/OS X support configuration header. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/config/public-macros.h b/lib/freetype/include/freetype/config/public-macros.h index 0074134f1..23d0fa6a3 100644 --- a/lib/freetype/include/freetype/config/public-macros.h +++ b/lib/freetype/include/freetype/config/public-macros.h @@ -4,7 +4,7 @@ * * Define a set of compiler macros used in public FreeType headers. * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/freetype.h b/lib/freetype/include/freetype/freetype.h index aa1a4fe38..efff74fe3 100644 --- a/lib/freetype/include/freetype/freetype.h +++ b/lib/freetype/include/freetype/freetype.h @@ -4,7 +4,7 @@ * * FreeType high-level API and common types (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -215,7 +215,6 @@ FT_BEGIN_HEADER * FT_Get_Char_Index * FT_Get_First_Char * FT_Get_Next_Char - * FT_Get_Name_Index * FT_Load_Char * * FT_OPEN_MEMORY @@ -254,14 +253,15 @@ FT_BEGIN_HEADER * FT_Get_Kerning * FT_Kerning_Mode * FT_Get_Track_Kerning - * FT_Get_Glyph_Name - * FT_Get_Postscript_Name * * FT_CharMapRec * FT_Select_Charmap * FT_Set_Charmap * FT_Get_Charmap_Index * + * FT_Get_Name_Index + * FT_Get_Glyph_Name + * FT_Get_Postscript_Name * FT_Get_FSType_Flags * FT_Get_SubGlyph_Info * @@ -646,7 +646,7 @@ FT_BEGIN_HEADER * * @note: * Despite the name, this enumeration lists specific character - * repertories (i.e., charsets), and not text encoding methods (e.g., + * repertoires (i.e., charsets), and not text encoding methods (e.g., * UTF-8, UTF-16, etc.). * * Other encodings might be defined in the future. @@ -779,7 +779,7 @@ FT_BEGIN_HEADER * `encoding_id`. If, for example, `encoding_id` is `TT_MAC_ID_ROMAN` * and the language ID (minus~1) is `TT_MAC_LANGID_GREEK`, it is the * Greek encoding, not Roman. `TT_MAC_ID_ARABIC` with - * `TT_MAC_LANGID_FARSI` means the Farsi variant the Arabic encoding. + * `TT_MAC_LANGID_FARSI` means the Farsi variant of the Arabic encoding. */ typedef enum FT_Encoding_ { @@ -1167,9 +1167,9 @@ FT_BEGIN_HEADER * FT_FACE_FLAG_KERNING :: * The face contains kerning information. If set, the kerning distance * can be retrieved using the function @FT_Get_Kerning. Otherwise the - * function always return the vector (0,0). Note that FreeType doesn't - * handle kerning data from the SFNT 'GPOS' table (as present in many - * OpenType fonts). + * function always returns the vector (0,0). Note that FreeType + * doesn't handle kerning data from the SFNT 'GPOS' table (as present + * in many OpenType fonts). * * FT_FACE_FLAG_FAST_GLYPHS :: * THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. @@ -1892,13 +1892,13 @@ FT_BEGIN_HEADER * The advance width of the unhinted glyph. Its value is expressed in * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when * loading the glyph. This field can be important to perform correct - * WYSIWYG layout. Only relevant for outline glyphs. + * WYSIWYG layout. Only relevant for scalable glyphs. * * linearVertAdvance :: * The advance height of the unhinted glyph. Its value is expressed in * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when * loading the glyph. This field can be important to perform correct - * WYSIWYG layout. Only relevant for outline glyphs. + * WYSIWYG layout. Only relevant for scalable glyphs. * * advance :: * This shorthand is, depending on @FT_LOAD_IGNORE_TRANSFORM, the @@ -2593,8 +2593,8 @@ FT_BEGIN_HEADER * stream attachments. */ FT_EXPORT( FT_Error ) - FT_Attach_Stream( FT_Face face, - FT_Open_Args* parameters ); + FT_Attach_Stream( FT_Face face, + const FT_Open_Args* parameters ); /************************************************************************** @@ -3077,7 +3077,7 @@ FT_BEGIN_HEADER * * FT_LOAD_NO_HINTING :: * Disable hinting. This generally generates 'blurrier' bitmap glyphs - * when the glyph are rendered in any of the anti-aliased modes. See + * when the glyphs are rendered in any of the anti-aliased modes. See * also the note below. * * This flag is implied by @FT_LOAD_NO_SCALE. @@ -3434,7 +3434,7 @@ FT_BEGIN_HEADER * are not interested in the value. * * delta :: - * A pointer a translation vector. Set this to NULL if you are not + * A pointer to a translation vector. Set this to NULL if you are not * interested in the value. * * @since: @@ -3559,9 +3559,10 @@ FT_BEGIN_HEADER * * 2. The `sdf` rasterizer has limited support for handling intersecting * contours and *cannot* handle self-intersecting contours whatsoever. - * Self-intersection happens when a single connected contour intersect - * itself at some point; having these in your font definitely pose a - * problem to the rasterizer and cause artifacts, too. + * Self-intersection happens when a single connected contour + * intersects itself at some point; having these in your font + * definitely poses a problem to the rasterizer and cause artifacts, + * too. * * 3. Generating SDF for really small glyphs may result in undesirable * output; the pixel grid (which stores distance information) becomes @@ -3843,89 +3844,6 @@ FT_BEGIN_HEADER /************************************************************************** * * @function: - * FT_Get_Glyph_Name - * - * @description: - * Retrieve the ASCII name of a given glyph in a face. This only works - * for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. - * - * @input: - * face :: - * A handle to a source face object. - * - * glyph_index :: - * The glyph index. - * - * buffer_max :: - * The maximum number of bytes available in the buffer. - * - * @output: - * buffer :: - * A pointer to a target buffer where the name is copied to. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * An error is returned if the face doesn't provide glyph names or if the - * glyph index is invalid. In all cases of failure, the first byte of - * `buffer` is set to~0 to indicate an empty name. - * - * The glyph name is truncated to fit within the buffer if it is too - * long. The returned string is always zero-terminated. - * - * Be aware that FreeType reorders glyph indices internally so that glyph - * index~0 always corresponds to the 'missing glyph' (called '.notdef'). - * - * This function always returns an error if the config macro - * `FT_CONFIG_OPTION_NO_GLYPH_NAMES` is not defined in `ftoption.h`. - */ - FT_EXPORT( FT_Error ) - FT_Get_Glyph_Name( FT_Face face, - FT_UInt glyph_index, - FT_Pointer buffer, - FT_UInt buffer_max ); - - - /************************************************************************** - * - * @function: - * FT_Get_Postscript_Name - * - * @description: - * Retrieve the ASCII PostScript name of a given face, if available. - * This only works with PostScript, TrueType, and OpenType fonts. - * - * @input: - * face :: - * A handle to the source face object. - * - * @return: - * A pointer to the face's PostScript name. `NULL` if unavailable. - * - * @note: - * The returned pointer is owned by the face and is destroyed with it. - * - * For variation fonts, this string changes if you select a different - * instance, and you have to call `FT_Get_PostScript_Name` again to - * retrieve it. FreeType follows Adobe TechNote #5902, 'Generating - * PostScript Names for Fonts Using OpenType Font Variations'. - * - * https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html - * - * [Since 2.9] Special PostScript names for named instances are only - * returned if the named instance is set with @FT_Set_Named_Instance (and - * the font has corresponding entries in its 'fvar' table). If - * @FT_IS_VARIATION returns true, the algorithmically derived PostScript - * name is provided, not looking up special entries for named instances. - */ - FT_EXPORT( const char* ) - FT_Get_Postscript_Name( FT_Face face ); - - - /************************************************************************** - * - * @function: * FT_Select_Charmap * * @description: @@ -4243,7 +4161,8 @@ FT_BEGIN_HEADER * FT_Get_Name_Index * * @description: - * Return the glyph index of a given glyph name. + * Return the glyph index of a given glyph name. This only works + * for those faces where @FT_HAS_GLYPH_NAMES returns true. * * @input: * face :: @@ -4254,6 +4173,16 @@ FT_BEGIN_HEADER * * @return: * The glyph index. 0~means 'undefined character code'. + * + * @note: + * Acceptable glyph names might come from the [Adobe Glyph + * List](https://github.com/adobe-type-tools/agl-aglfn). See + * @FT_Get_Glyph_Name for the inverse functionality. + * + * This function has limited capabilities if the config macro + * `FT_CONFIG_OPTION_POSTSCRIPT_NAMES` is not defined in `ftoption.h`: + * It then works only for fonts that actually embed glyph names (which + * many recent OpenType fonts do not). */ FT_EXPORT( FT_UInt ) FT_Get_Name_Index( FT_Face face, @@ -4262,6 +4191,91 @@ FT_BEGIN_HEADER /************************************************************************** * + * @function: + * FT_Get_Glyph_Name + * + * @description: + * Retrieve the ASCII name of a given glyph in a face. This only works + * for those faces where @FT_HAS_GLYPH_NAMES returns true. + * + * @input: + * face :: + * A handle to a source face object. + * + * glyph_index :: + * The glyph index. + * + * buffer_max :: + * The maximum number of bytes available in the buffer. + * + * @output: + * buffer :: + * A pointer to a target buffer where the name is copied to. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * An error is returned if the face doesn't provide glyph names or if the + * glyph index is invalid. In all cases of failure, the first byte of + * `buffer` is set to~0 to indicate an empty name. + * + * The glyph name is truncated to fit within the buffer if it is too + * long. The returned string is always zero-terminated. + * + * Be aware that FreeType reorders glyph indices internally so that glyph + * index~0 always corresponds to the 'missing glyph' (called '.notdef'). + * + * This function has limited capabilities if the config macro + * `FT_CONFIG_OPTION_POSTSCRIPT_NAMES` is not defined in `ftoption.h`: + * It then works only for fonts that actually embed glyph names (which + * many recent OpenType fonts do not). + */ + FT_EXPORT( FT_Error ) + FT_Get_Glyph_Name( FT_Face face, + FT_UInt glyph_index, + FT_Pointer buffer, + FT_UInt buffer_max ); + + + /************************************************************************** + * + * @function: + * FT_Get_Postscript_Name + * + * @description: + * Retrieve the ASCII PostScript name of a given face, if available. + * This only works with PostScript, TrueType, and OpenType fonts. + * + * @input: + * face :: + * A handle to the source face object. + * + * @return: + * A pointer to the face's PostScript name. `NULL` if unavailable. + * + * @note: + * The returned pointer is owned by the face and is destroyed with it. + * + * For variation fonts, this string changes if you select a different + * instance, and you have to call `FT_Get_PostScript_Name` again to + * retrieve it. FreeType follows Adobe TechNote #5902, 'Generating + * PostScript Names for Fonts Using OpenType Font Variations'. + * + * https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html + * + * [Since 2.9] Special PostScript names for named instances are only + * returned if the named instance is set with @FT_Set_Named_Instance (and + * the font has corresponding entries in its 'fvar' table). If + * @FT_IS_VARIATION returns true, the algorithmically derived PostScript + * name is provided, not looking up special entries for named instances. + */ + FT_EXPORT( const char* ) + FT_Get_Postscript_Name( FT_Face face ); + + + /************************************************************************** + * * @enum: * FT_SUBGLYPH_FLAG_XXX * @@ -4348,13 +4362,6 @@ FT_BEGIN_HEADER /************************************************************************** * - * @section: - * base_interface - * - */ - - /************************************************************************** - * * @enum: * FT_FSTYPE_XXX * @@ -4688,7 +4695,8 @@ FT_BEGIN_HEADER * * @description: * This section contains various functions used to perform computations - * on 16.16 fixed-float numbers or 2d vectors. + * on 16.16 fixed-point numbers or 2D vectors. FreeType does not use + * floating-point data types. * * **Attention**: Most arithmetic functions take `FT_Long` as arguments. * For historical reasons, FreeType was designed under the assumption @@ -4941,8 +4949,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 12 -#define FREETYPE_PATCH 1 +#define FREETYPE_MINOR 13 +#define FREETYPE_PATCH 0 /************************************************************************** diff --git a/lib/freetype/include/freetype/ftadvanc.h b/lib/freetype/include/freetype/ftadvanc.h index 8ce484666..4560ded6d 100644 --- a/lib/freetype/include/freetype/ftadvanc.h +++ b/lib/freetype/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ * * Quick computation of advance widths (specification only). * - * Copyright (C) 2008-2022 by + * Copyright (C) 2008-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftbbox.h b/lib/freetype/include/freetype/ftbbox.h index 768478f39..fc21740fc 100644 --- a/lib/freetype/include/freetype/ftbbox.h +++ b/lib/freetype/include/freetype/ftbbox.h @@ -4,7 +4,7 @@ * * FreeType exact bbox computation (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftbdf.h b/lib/freetype/include/freetype/ftbdf.h index 04d6094f7..e8ce64312 100644 --- a/lib/freetype/include/freetype/ftbdf.h +++ b/lib/freetype/include/freetype/ftbdf.h @@ -4,7 +4,7 @@ * * FreeType API for accessing BDF-specific strings (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftbitmap.h b/lib/freetype/include/freetype/ftbitmap.h index c3462dadc..eb6b4b1ee 100644 --- a/lib/freetype/include/freetype/ftbitmap.h +++ b/lib/freetype/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftbzip2.h b/lib/freetype/include/freetype/ftbzip2.h index c85305806..7d29f4682 100644 --- a/lib/freetype/include/freetype/ftbzip2.h +++ b/lib/freetype/include/freetype/ftbzip2.h @@ -4,7 +4,7 @@ * * Bzip2-compressed stream support. * - * Copyright (C) 2010-2022 by + * Copyright (C) 2010-2023 by * Joel Klinghed. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftcache.h b/lib/freetype/include/freetype/ftcache.h index ecbbd7b8f..c76869545 100644 --- a/lib/freetype/include/freetype/ftcache.h +++ b/lib/freetype/include/freetype/ftcache.h @@ -4,7 +4,7 @@ * * FreeType Cache subsystem (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -424,7 +424,7 @@ FT_BEGIN_HEADER * pixel :: * A Boolean. If 1, the `width` and `height` fields are interpreted as * integer pixel character sizes. Otherwise, they are expressed as - * 1/64th of points. + * 1/64 of points. * * x_res :: * Only used when `pixel` is value~0 to indicate the horizontal diff --git a/lib/freetype/include/freetype/ftcid.h b/lib/freetype/include/freetype/ftcid.h index d80108387..ef2293902 100644 --- a/lib/freetype/include/freetype/ftcid.h +++ b/lib/freetype/include/freetype/ftcid.h @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information (specification). * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * Dereg Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftcolor.h b/lib/freetype/include/freetype/ftcolor.h index 3edaee4ec..eae200fdf 100644 --- a/lib/freetype/include/freetype/ftcolor.h +++ b/lib/freetype/include/freetype/ftcolor.h @@ -4,7 +4,7 @@ * * FreeType's glyph color management (specification). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -456,6 +456,9 @@ FT_BEGIN_HEADER * &iterator ) ); * } * ``` + * + * @since: + * 2.10 */ FT_EXPORT( FT_Bool ) FT_Get_Color_Glyph_Layer( FT_Face face, @@ -475,7 +478,7 @@ FT_BEGIN_HEADER * extensions to the 'COLR' table, see * 'https://github.com/googlefonts/colr-gradients-spec'. * - * The enumeration values losely correspond with the format numbers of + * The enumeration values loosely correspond with the format numbers of * the specification: FreeType always returns a fully specified 'Paint' * structure for the 'Transform', 'Translate', 'Scale', 'Rotate', and * 'Skew' table types even though the specification has different formats @@ -489,9 +492,7 @@ FT_BEGIN_HEADER * structures. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef enum FT_PaintFormat_ { @@ -521,9 +522,10 @@ FT_BEGIN_HEADER * * @description: * This iterator object is needed for @FT_Get_Colorline_Stops. It keeps - * state while iterating over the stops of an @FT_ColorLine, - * representing the `ColorLine` struct of the v1 extensions to 'COLR', - * see 'https://github.com/googlefonts/colr-gradients-spec'. + * state while iterating over the stops of an @FT_ColorLine, representing + * the `ColorLine` struct of the v1 extensions to 'COLR', see + * 'https://github.com/googlefonts/colr-gradients-spec'. Do not manually + * modify fields of this iterator. * * @fields: * num_color_stops :: @@ -537,10 +539,12 @@ FT_BEGIN_HEADER * An opaque pointer into 'COLR' table data. Set by @FT_Get_Paint. * Updated by @FT_Get_Colorline_Stops. * - * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. + * read_variable :: + * A boolean keeping track of whether variable color lines are to be + * read. Set by @FT_Get_Paint. * + * @since: + * 2.13 */ typedef struct FT_ColorStopIterator_ { @@ -549,6 +553,8 @@ FT_BEGIN_HEADER FT_Byte* p; + FT_Bool read_variable; + } FT_ColorStopIterator; @@ -569,9 +575,7 @@ FT_BEGIN_HEADER * Alpha transparency value multiplied with the value from 'CPAL'. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_ColorIndex_ { @@ -592,19 +596,18 @@ FT_BEGIN_HEADER * * @fields: * stop_offset :: - * The stop offset between 0 and 1 along the gradient. + * The stop offset along the gradient, expressed as a 16.16 fixed-point + * coordinate. * * color :: * The color information for this stop, see @FT_ColorIndex. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_ColorStop_ { - FT_F2Dot14 stop_offset; + FT_Fixed stop_offset; FT_ColorIndex color; } FT_ColorStop; @@ -621,9 +624,7 @@ FT_BEGIN_HEADER * It describes how the gradient fill continues at the other boundaries. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef enum FT_PaintExtend_ { @@ -653,9 +654,7 @@ FT_BEGIN_HEADER * actual @FT_ColorStop's. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_ColorLine_ { @@ -699,9 +698,7 @@ FT_BEGIN_HEADER * y translation. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_Affine_23_ { @@ -722,9 +719,7 @@ FT_BEGIN_HEADER * 'https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators'. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef enum FT_Composite_Mode_ { @@ -786,9 +781,7 @@ FT_BEGIN_HEADER * to be provided. Do not set this value. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_Opaque_Paint_ { @@ -815,9 +808,7 @@ FT_BEGIN_HEADER * The layer iterator that describes the layers of this paint. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintColrLayers_ { @@ -842,9 +833,7 @@ FT_BEGIN_HEADER * The color information for this solid paint, see @FT_ColorIndex. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintSolid_ { @@ -883,9 +872,7 @@ FT_BEGIN_HEADER * Otherwise equal to~p0. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintLinearGradient_ { @@ -908,8 +895,7 @@ FT_BEGIN_HEADER * A structure representing a `PaintRadialGradient` value of the 'COLR' * v1 extensions, see * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph - * layer filled with this paint is drawn filled filled with a radial - * gradient. + * layer filled with this paint is drawn filled with a radial gradient. * * @fields: * colorline :: @@ -933,9 +919,7 @@ FT_BEGIN_HEADER * units represented as a 16.16 fixed-point value. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintRadialGradient_ { @@ -983,9 +967,7 @@ FT_BEGIN_HEADER * given counter-clockwise, starting from the (positive) y~axis. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintSweepGradient_ { @@ -1016,9 +998,7 @@ FT_BEGIN_HEADER * information that is filled with paint. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintGlyph_ { @@ -1042,9 +1022,7 @@ FT_BEGIN_HEADER * this paint. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintColrGlyph_ { @@ -1070,9 +1048,7 @@ FT_BEGIN_HEADER * 16.16 fixed-point values. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintTransform_ { @@ -1105,9 +1081,7 @@ FT_BEGIN_HEADER * 16.16 fixed-point value. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintTranslate_ { @@ -1156,9 +1130,7 @@ FT_BEGIN_HEADER * 16.16 fixed-point value. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward-compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintScale_ { @@ -1194,16 +1166,14 @@ FT_BEGIN_HEADER * * center_x :: * The x~coordinate of the pivot point of the rotation in font - * units) represented as a 16.16 fixed-point value. + * units represented as a 16.16 fixed-point value. * * center_y :: * The y~coordinate of the pivot point of the rotation in font * units represented as a 16.16 fixed-point value. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintRotate_ @@ -1252,9 +1222,7 @@ FT_BEGIN_HEADER * represented as a 16.16 fixed-point value. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintSkew_ { @@ -1275,9 +1243,8 @@ FT_BEGIN_HEADER * FT_PaintComposite * * @description: - * A structure representing a 'COLR'v1 `PaintComposite` paint table. - * Used for compositing two paints in a 'COLR' v1 directed acycling - * graph. + * A structure representing a 'COLR' v1 `PaintComposite` paint table. + * Used for compositing two paints in a 'COLR' v1 directed acyclic graph. * * @fields: * source_paint :: @@ -1293,9 +1260,7 @@ FT_BEGIN_HEADER * `source_paint` is composited onto. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_PaintComposite_ { @@ -1339,9 +1304,7 @@ FT_BEGIN_HEADER * * @FT_PaintColrGlyph * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_COLR_Paint_ { @@ -1386,9 +1349,7 @@ FT_BEGIN_HEADER * Do not output an initial root transform. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef enum FT_Color_Root_Transform_ { @@ -1429,9 +1390,7 @@ FT_BEGIN_HEADER * fixed-point coordinates in 26.6 format. * * @since: - * 2.12 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ typedef struct FT_ClipBox_ { @@ -1524,9 +1483,7 @@ FT_BEGIN_HEADER * error, value~0 is returned also. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ FT_EXPORT( FT_Bool ) FT_Get_Color_Glyph_Paint( FT_Face face, @@ -1568,9 +1525,7 @@ FT_BEGIN_HEADER * and remove transforms configured using @FT_Set_Transform. * * @since: - * 2.12 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ FT_EXPORT( FT_Bool ) FT_Get_Color_Glyph_ClipBox( FT_Face face, @@ -1617,9 +1572,7 @@ FT_BEGIN_HEADER * object can not be retrieved or any other error occurs. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ FT_EXPORT( FT_Bool ) FT_Get_Paint_Layers( FT_Face face, @@ -1660,9 +1613,7 @@ FT_BEGIN_HEADER * also. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ FT_EXPORT( FT_Bool ) FT_Get_Colorline_Stops( FT_Face face, @@ -1698,9 +1649,7 @@ FT_BEGIN_HEADER * this paint or any other error occured. * * @since: - * 2.11 -- **currently experimental only!** There might be changes - * without retaining backward compatibility of both the API and ABI. - * + * 2.13 */ FT_EXPORT( FT_Bool ) FT_Get_Paint( FT_Face face, diff --git a/lib/freetype/include/freetype/ftdriver.h b/lib/freetype/include/freetype/ftdriver.h index 0dc91e8b4..f90946fd1 100644 --- a/lib/freetype/include/freetype/ftdriver.h +++ b/lib/freetype/include/freetype/ftdriver.h @@ -4,7 +4,7 @@ * * FreeType API for controlling driver modules (specification only). * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -820,7 +820,6 @@ FT_BEGIN_HEADER * 2.5 */ - /************************************************************************** * * @property: diff --git a/lib/freetype/include/freetype/fterrdef.h b/lib/freetype/include/freetype/fterrdef.h index a3acfce43..d59b3cc2d 100644 --- a/lib/freetype/include/freetype/fterrdef.h +++ b/lib/freetype/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ * * FreeType error codes (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/fterrors.h b/lib/freetype/include/freetype/fterrors.h index ff1b375d7..15ef3f76b 100644 --- a/lib/freetype/include/freetype/fterrors.h +++ b/lib/freetype/include/freetype/fterrors.h @@ -4,7 +4,7 @@ * * FreeType error code handling (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -29,7 +29,7 @@ * * @description: * The header file `fterrors.h` (which is automatically included by - * `freetype.h` defines the handling of FreeType's enumeration + * `freetype.h`) defines the handling of FreeType's enumeration * constants. It can also be used to generate error message strings * with a small macro trick explained below. * diff --git a/lib/freetype/include/freetype/ftfntfmt.h b/lib/freetype/include/freetype/ftfntfmt.h index 77d553578..c0018fc83 100644 --- a/lib/freetype/include/freetype/ftfntfmt.h +++ b/lib/freetype/include/freetype/ftfntfmt.h @@ -4,7 +4,7 @@ * * Support functions for font formats. * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftgasp.h b/lib/freetype/include/freetype/ftgasp.h index d4ab9b32d..d5f19add8 100644 --- a/lib/freetype/include/freetype/ftgasp.h +++ b/lib/freetype/include/freetype/ftgasp.h @@ -4,7 +4,7 @@ * * Access of TrueType's 'gasp' table (specification). * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftglyph.h b/lib/freetype/include/freetype/ftglyph.h index 6b77bd3d2..4658895f7 100644 --- a/lib/freetype/include/freetype/ftglyph.h +++ b/lib/freetype/include/freetype/ftglyph.h @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -355,7 +355,7 @@ FT_BEGIN_HEADER * * @output: * aglyph :: - * A handle to the glyph object. + * A handle to the glyph object. `NULL` in case of error. * * @return: * FreeType error code. 0~means success. @@ -385,7 +385,7 @@ FT_BEGIN_HEADER * * @output: * target :: - * A handle to the target glyph object. 0~in case of error. + * A handle to the target glyph object. `NULL` in case of error. * * @return: * FreeType error code. 0~means success. @@ -413,7 +413,7 @@ FT_BEGIN_HEADER * * delta :: * A pointer to a 2d vector to apply. Coordinates are expressed in - * 1/64th of a pixel. + * 1/64 of a pixel. * * @return: * FreeType error code (if not 0, the glyph format is not scalable). @@ -500,7 +500,7 @@ FT_BEGIN_HEADER * @output: * acbox :: * The glyph coordinate bounding box. Coordinates are expressed in - * 1/64th of pixels if it is grid-fitted. + * 1/64 of pixels if it is grid-fitted. * * @note: * Coordinates are relative to the glyph origin, using the y~upwards @@ -671,7 +671,7 @@ FT_BEGIN_HEADER * * @input: * glyph :: - * A handle to the target glyph object. + * A handle to the target glyph object. Can be `NULL`. */ FT_EXPORT( void ) FT_Done_Glyph( FT_Glyph glyph ); diff --git a/lib/freetype/include/freetype/ftgxval.h b/lib/freetype/include/freetype/ftgxval.h index 2d3f382ac..e8de9a6ed 100644 --- a/lib/freetype/include/freetype/ftgxval.h +++ b/lib/freetype/include/freetype/ftgxval.h @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * Masatake YAMATO, Redhat K.K, * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/include/freetype/ftgzip.h b/lib/freetype/include/freetype/ftgzip.h index 0880290f9..443ec29db 100644 --- a/lib/freetype/include/freetype/ftgzip.h +++ b/lib/freetype/include/freetype/ftgzip.h @@ -4,7 +4,7 @@ * * Gzip-compressed stream support. * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftimage.h b/lib/freetype/include/freetype/ftimage.h index 7f2d721cd..2e8e6734c 100644 --- a/lib/freetype/include/freetype/ftimage.h +++ b/lib/freetype/include/freetype/ftimage.h @@ -5,7 +5,7 @@ * FreeType glyph image formats and default raster interface * (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftincrem.h b/lib/freetype/include/freetype/ftincrem.h index 3b3d93c2d..2d4f5def2 100644 --- a/lib/freetype/include/freetype/ftincrem.h +++ b/lib/freetype/include/freetype/ftincrem.h @@ -4,7 +4,7 @@ * * FreeType incremental loading (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftlcdfil.h b/lib/freetype/include/freetype/ftlcdfil.h index c767c6cb4..d3723e16f 100644 --- a/lib/freetype/include/freetype/ftlcdfil.h +++ b/lib/freetype/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ * FreeType API for color filtering of subpixel bitmap glyphs * (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -137,11 +137,11 @@ FT_BEGIN_HEADER * * FT_LCD_FILTER_DEFAULT :: * This is a beveled, normalized, and color-balanced five-tap filter - * with weights of [0x08 0x4D 0x56 0x4D 0x08] in 1/256th units. + * with weights of [0x08 0x4D 0x56 0x4D 0x08] in 1/256 units. * * FT_LCD_FILTER_LIGHT :: * this is a boxy, normalized, and color-balanced three-tap filter with - * weights of [0x00 0x55 0x56 0x55 0x00] in 1/256th units. + * weights of [0x00 0x55 0x56 0x55 0x00] in 1/256 units. * * FT_LCD_FILTER_LEGACY :: * FT_LCD_FILTER_LEGACY1 :: @@ -226,7 +226,7 @@ FT_BEGIN_HEADER * * weights :: * A pointer to an array; the function copies the first five bytes and - * uses them to specify the filter weights in 1/256th units. + * uses them to specify the filter weights in 1/256 units. * * @return: * FreeType error code. 0~means success. diff --git a/lib/freetype/include/freetype/ftlist.h b/lib/freetype/include/freetype/ftlist.h index 4dca2bf16..b55313133 100644 --- a/lib/freetype/include/freetype/ftlist.h +++ b/lib/freetype/include/freetype/ftlist.h @@ -4,7 +4,7 @@ * * Generic list support for FreeType (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftlogging.h b/lib/freetype/include/freetype/ftlogging.h index 7213dc30a..2246dc836 100644 --- a/lib/freetype/include/freetype/ftlogging.h +++ b/lib/freetype/include/freetype/ftlogging.h @@ -4,7 +4,7 @@ * * Additional debugging APIs. * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftlzw.h b/lib/freetype/include/freetype/ftlzw.h index 3d7cfd52f..adfd17247 100644 --- a/lib/freetype/include/freetype/ftlzw.h +++ b/lib/freetype/include/freetype/ftlzw.h @@ -4,7 +4,7 @@ * * LZW-compressed stream support. * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftmac.h b/lib/freetype/include/freetype/ftmac.h index 3dd61d0fe..a91e38f9e 100644 --- a/lib/freetype/include/freetype/ftmac.h +++ b/lib/freetype/include/freetype/ftmac.h @@ -4,7 +4,7 @@ * * Additional Mac-specific API. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 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/lib/freetype/include/freetype/ftmm.h b/lib/freetype/include/freetype/ftmm.h index c74ce618c..e381ef3d3 100644 --- a/lib/freetype/include/freetype/ftmm.h +++ b/lib/freetype/include/freetype/ftmm.h @@ -4,7 +4,7 @@ * * FreeType Multiple Master font interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -398,6 +398,10 @@ FT_BEGIN_HEADER * 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 + * integers. + * * [Since 2.8.1] To reset all axes to the default values, call the * function with `num_coords` set to zero and `coords` set to `NULL`. * [Since 2.9] 'Default values' means the currently selected named @@ -440,6 +444,11 @@ FT_BEGIN_HEADER * @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 + * integers. + * * @since: * 2.7.1 */ @@ -471,9 +480,9 @@ FT_BEGIN_HEADER * the number of axes, use default values for the remaining axes. * * coords :: - * The design coordinates array (each element 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 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. * * @return: * FreeType error code. 0~means success. @@ -518,7 +527,7 @@ FT_BEGIN_HEADER * * @output: * coords :: - * The normalized blend coordinates array. + * The normalized blend coordinates array (as 16.16 fractional values). * * @return: * FreeType error code. 0~means success. diff --git a/lib/freetype/include/freetype/ftmodapi.h b/lib/freetype/include/freetype/ftmodapi.h index b78db724c..c8f0c2c2a 100644 --- a/lib/freetype/include/freetype/ftmodapi.h +++ b/lib/freetype/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ * * FreeType modules public interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftmoderr.h b/lib/freetype/include/freetype/ftmoderr.h index 88d291777..c8c892dcc 100644 --- a/lib/freetype/include/freetype/ftmoderr.h +++ b/lib/freetype/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ * * FreeType module error offsets (specification). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftotval.h b/lib/freetype/include/freetype/ftotval.h index 172fcf240..011bdfc83 100644 --- a/lib/freetype/include/freetype/ftotval.h +++ b/lib/freetype/include/freetype/ftotval.h @@ -4,7 +4,7 @@ * * FreeType API for validating OpenType tables (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftoutln.h b/lib/freetype/include/freetype/ftoutln.h index 46ebf9371..54434b25f 100644 --- a/lib/freetype/include/freetype/ftoutln.h +++ b/lib/freetype/include/freetype/ftoutln.h @@ -5,7 +5,7 @@ * Support for the FT_Outline type used to store glyph shapes of * most scalable font formats (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftparams.h b/lib/freetype/include/freetype/ftparams.h index 72080f396..6a9f243bc 100644 --- a/lib/freetype/include/freetype/ftparams.h +++ b/lib/freetype/include/freetype/ftparams.h @@ -4,7 +4,7 @@ * * FreeType API for possible FT_Parameter tags (specification only). * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftpfr.h b/lib/freetype/include/freetype/ftpfr.h index 428e32706..7111d40a0 100644 --- a/lib/freetype/include/freetype/ftpfr.h +++ b/lib/freetype/include/freetype/ftpfr.h @@ -4,7 +4,7 @@ * * FreeType API for accessing PFR-specific data (specification only). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -161,7 +161,7 @@ FT_BEGIN_HEADER * * @note: * You can use the `x_scale` or `y_scale` results of @FT_Get_PFR_Metrics - * to convert the advance to device subpixels (i.e., 1/64th of pixels). + * to convert the advance to device subpixels (i.e., 1/64 of pixels). */ FT_EXPORT( FT_Error ) FT_Get_PFR_Advance( FT_Face face, diff --git a/lib/freetype/include/freetype/ftrender.h b/lib/freetype/include/freetype/ftrender.h index 0fab3f8c2..a8576dab0 100644 --- a/lib/freetype/include/freetype/ftrender.h +++ b/lib/freetype/include/freetype/ftrender.h @@ -4,7 +4,7 @@ * * FreeType renderer modules public interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftsizes.h b/lib/freetype/include/freetype/ftsizes.h index e30938d86..7bfb1aed4 100644 --- a/lib/freetype/include/freetype/ftsizes.h +++ b/lib/freetype/include/freetype/ftsizes.h @@ -4,7 +4,7 @@ * * FreeType size objects management (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftsnames.h b/lib/freetype/include/freetype/ftsnames.h index 384096a58..9d5d22bb2 100644 --- a/lib/freetype/include/freetype/ftsnames.h +++ b/lib/freetype/include/freetype/ftsnames.h @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ftstroke.h b/lib/freetype/include/freetype/ftstroke.h index 12c006d3f..b3d90802a 100644 --- a/lib/freetype/include/freetype/ftstroke.h +++ b/lib/freetype/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ * * FreeType path stroker (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -293,7 +293,7 @@ FT_BEGIN_HEADER * * miter_limit :: * The maximum reciprocal sine of half-angle at the miter join, - * expressed as 16.16 fixed point value. + * expressed as 16.16 fixed-point value. * * @note: * The `radius` is expressed in the same units as the outline diff --git a/lib/freetype/include/freetype/ftsynth.h b/lib/freetype/include/freetype/ftsynth.h index afc40b1d8..5d1969765 100644 --- a/lib/freetype/include/freetype/ftsynth.h +++ b/lib/freetype/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ * FreeType synthesizing code for emboldening and slanting * (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -68,10 +68,19 @@ FT_BEGIN_HEADER FT_EXPORT( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); - /* Slant an outline glyph to the right by about 12 degrees. */ + /* Slant an outline glyph to the right by about 12 degrees. */ FT_EXPORT( void ) FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); + /* Slant an outline glyph by a given sine of an angle. You can apply */ + /* slant along either x- or y-axis by choosing a corresponding non-zero */ + /* argument. If both slants are non-zero, some affine transformation */ + /* will result. */ + FT_EXPORT( void ) + FT_GlyphSlot_Slant( FT_GlyphSlot slot, + FT_Fixed xslant, + FT_Fixed yslant ); + /* */ diff --git a/lib/freetype/include/freetype/ftsystem.h b/lib/freetype/include/freetype/ftsystem.h index 5f8aec7b7..a995b078d 100644 --- a/lib/freetype/include/freetype/ftsystem.h +++ b/lib/freetype/include/freetype/ftsystem.h @@ -4,7 +4,7 @@ * * FreeType low-level system interface definition (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -229,7 +229,8 @@ FT_BEGIN_HEADER * A handle to the source stream. * * offset :: - * The offset of read in stream (always from start). + * The offset from the start of the stream to seek to if this is a seek + * operation (see note). * * buffer :: * The address of the read buffer. @@ -241,8 +242,13 @@ FT_BEGIN_HEADER * The number of bytes effectively read by the stream. * * @note: - * This function might be called to perform a seek or skip operation with - * a `count` of~0. A non-zero return value then indicates an error. + * This function performs a seek *or* a read operation depending on the + * argument values. If `count` is zero, the operation is a seek to + * `offset` bytes. If `count` is >~0, the operation is a read of `count` + * bytes from the current position in the stream, and the `offset` value + * should be ignored. + * + * For seek operations, a non-zero return value indicates an error. * */ typedef unsigned long diff --git a/lib/freetype/include/freetype/fttrigon.h b/lib/freetype/include/freetype/fttrigon.h index 4e8d871de..294981a6f 100644 --- a/lib/freetype/include/freetype/fttrigon.h +++ b/lib/freetype/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (specification). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/fttypes.h b/lib/freetype/include/freetype/fttypes.h index 29f32fbb2..5b109f0c7 100644 --- a/lib/freetype/include/freetype/fttypes.h +++ b/lib/freetype/include/freetype/fttypes.h @@ -4,7 +4,7 @@ * * FreeType simple types definitions (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -45,7 +45,10 @@ FT_BEGIN_HEADER * @description: * This section contains the basic data types defined by FreeType~2, * ranging from simple scalar types to bitmap descriptors. More - * font-specific structures are defined in a different section. + * font-specific structures are defined in a different section. Note + * that FreeType does not use floating-point data types. Fractional + * values are represented by fixed-point integers, with lower bits + * storing the fractional part. * * @order: * FT_Byte diff --git a/lib/freetype/include/freetype/ftwinfnt.h b/lib/freetype/include/freetype/ftwinfnt.h index 294f85ae0..7b701ea59 100644 --- a/lib/freetype/include/freetype/ftwinfnt.h +++ b/lib/freetype/include/freetype/ftwinfnt.h @@ -4,7 +4,7 @@ * * FreeType API for accessing Windows fnt-specific data. * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/autohint.h b/lib/freetype/include/freetype/internal/autohint.h index aedf48984..bf9c8b7cf 100644 --- a/lib/freetype/include/freetype/internal/autohint.h +++ b/lib/freetype/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ * * High-level 'autohint' module-specific interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/cffotypes.h b/lib/freetype/include/freetype/internal/cffotypes.h index 700f586c4..50d535384 100644 --- a/lib/freetype/include/freetype/internal/cffotypes.h +++ b/lib/freetype/include/freetype/internal/cffotypes.h @@ -4,7 +4,7 @@ * * Basic OpenType/CFF object type definitions (specification). * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/cfftypes.h b/lib/freetype/include/freetype/internal/cfftypes.h index 23d26c1b3..c2521764c 100644 --- a/lib/freetype/include/freetype/internal/cfftypes.h +++ b/lib/freetype/include/freetype/internal/cfftypes.h @@ -5,7 +5,7 @@ * Basic OpenType/CFF type definitions and interface (specification * only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -315,7 +315,7 @@ FT_BEGIN_HEADER /* The normal stack then points to these values instead of the DICT */ /* because all other operators in Private DICT clear the stack. */ /* `blend_stack' could be cleared at each operator other than blend. */ - /* Blended values are stored as 5-byte fixed point values. */ + /* Blended values are stored as 5-byte fixed-point values. */ FT_Byte* blend_stack; /* base of stack allocation */ FT_Byte* blend_top; /* first empty slot */ diff --git a/lib/freetype/include/freetype/internal/compiler-macros.h b/lib/freetype/include/freetype/internal/compiler-macros.h index 66fa13c3c..7883317fe 100644 --- a/lib/freetype/include/freetype/internal/compiler-macros.h +++ b/lib/freetype/include/freetype/internal/compiler-macros.h @@ -4,7 +4,7 @@ * * Compiler-specific macro definitions used internally by FreeType. * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -36,6 +36,19 @@ FT_BEGIN_HEADER # endif #endif + /* Newer compilers warn for fall-through case statements. */ +#ifndef FALL_THROUGH +# if ( defined( __STDC_VERSION__ ) && __STDC_VERSION__ > 201710L ) || \ + ( defined( __cplusplus ) && __cplusplus > 201402L ) +# define FALL_THROUGH [[__fallthrough__]] +# elif ( defined( __GNUC__ ) && __GNUC__ >= 7 ) || \ + ( defined( __clang__ ) && __clang_major__ >= 10 ) +# define FALL_THROUGH __attribute__(( __fallthrough__ )) +# else +# define FALL_THROUGH ( (void)0 ) +# endif +#endif + /* * When defining a macro that expands to a non-trivial C statement, use * FT_BEGIN_STMNT and FT_END_STMNT to enclose the macro's body. This @@ -258,7 +271,7 @@ FT_BEGIN_HEADER * To export a variable, use `FT_EXPORT_VAR`. */ - /* See `freetype/config/compiler_macros.h` for the `FT_EXPORT` definition */ + /* See `freetype/config/public-macros.h` for the `FT_EXPORT` definition */ #define FT_EXPORT_DEF( x ) FT_FUNCTION_DEFINITION( x ) /* diff --git a/lib/freetype/include/freetype/internal/ftcalc.h b/lib/freetype/include/freetype/internal/ftcalc.h index e6a87db94..d1baa392b 100644 --- a/lib/freetype/include/freetype/internal/ftcalc.h +++ b/lib/freetype/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ * * Arithmetic computations (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -278,6 +278,40 @@ 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 @@ -413,11 +447,11 @@ FT_BEGIN_HEADER extern __inline FT_Int32 FT_MSB_i386( FT_UInt32 x ); -#pragma aux FT_MSB_i386 = \ - "bsr eax, eax" \ - parm [eax] nomemory \ - value [eax] \ - modify exact [eax] nomemory; +#pragma aux FT_MSB_i386 = \ + "bsr eax, eax" \ + __parm [__eax] __nomemory \ + __value [__eax] \ + __modify __exact [__eax] __nomemory; #define FT_MSB( x ) FT_MSB_i386( x ) diff --git a/lib/freetype/include/freetype/internal/ftdebug.h b/lib/freetype/include/freetype/internal/ftdebug.h index f05b1395c..4e013ba1e 100644 --- a/lib/freetype/include/freetype/internal/ftdebug.h +++ b/lib/freetype/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ * * Debugging and logging component (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftdrv.h b/lib/freetype/include/freetype/internal/ftdrv.h index 9459a9a19..f78912ca0 100644 --- a/lib/freetype/include/freetype/internal/ftdrv.h +++ b/lib/freetype/include/freetype/internal/ftdrv.h @@ -4,7 +4,7 @@ * * FreeType internal font driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftgloadr.h b/lib/freetype/include/freetype/internal/ftgloadr.h index f73b6631c..36e5509f9 100644 --- a/lib/freetype/include/freetype/internal/ftgloadr.h +++ b/lib/freetype/include/freetype/internal/ftgloadr.h @@ -4,7 +4,7 @@ * * The FreeType glyph loader (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftmemory.h b/lib/freetype/include/freetype/internal/ftmemory.h index 10d753aa5..5eb1d21ff 100644 --- a/lib/freetype/include/freetype/internal/ftmemory.h +++ b/lib/freetype/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ * * The FreeType memory management macros (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, @@ -96,15 +96,15 @@ extern "C++" #ifdef FT_DEBUG_MEMORY - FT_BASE( const char* ) _ft_debug_file; - FT_BASE( long ) _ft_debug_lineno; + FT_BASE( const char* ) ft_debug_file_; + FT_BASE( long ) ft_debug_lineno_; -#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \ - _ft_debug_lineno = __LINE__, \ +#define FT_DEBUG_INNER( exp ) ( ft_debug_file_ = __FILE__, \ + ft_debug_lineno_ = __LINE__, \ (exp) ) -#define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \ - _ft_debug_lineno = __LINE__, \ +#define FT_ASSIGNP_INNER( p, exp ) ( ft_debug_file_ = __FILE__, \ + ft_debug_lineno_ = __LINE__, \ FT_ASSIGNP( p, exp ) ) #else /* !FT_DEBUG_MEMORY */ diff --git a/lib/freetype/include/freetype/internal/ftmmtypes.h b/lib/freetype/include/freetype/internal/ftmmtypes.h new file mode 100644 index 000000000..b7c66c35d --- /dev/null +++ b/lib/freetype/include/freetype/internal/ftmmtypes.h @@ -0,0 +1,85 @@ +/**************************************************************************** + * + * ftmmtypes.h + * + * OpenType Variations type definitions for internal use + * with the multi-masters service (specification). + * + * Copyright (C) 2022-2023 by + * David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and + * Dominik Röttsches. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.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 FTMMTYPES_H_ +#define FTMMTYPES_H_ + +FT_BEGIN_HEADER + + + typedef FT_Int32 FT_ItemVarDelta; + + typedef struct GX_ItemVarDataRec_ + { + FT_UInt itemCount; /* number of delta sets per item */ + FT_UInt regionIdxCount; /* number of region indices */ + FT_UInt* regionIndices; /* array of `regionCount' indices; */ + /* these index `varRegionList' */ + FT_ItemVarDelta* deltaSet; /* array of `itemCount' deltas */ + /* use `innerIndex' for this array */ + + } GX_ItemVarDataRec, *GX_ItemVarData; + + + /* contribution of one axis to a region */ + typedef struct GX_AxisCoordsRec_ + { + FT_Fixed startCoord; + FT_Fixed peakCoord; /* zero means no effect (factor = 1) */ + FT_Fixed endCoord; + + } GX_AxisCoordsRec, *GX_AxisCoords; + + + typedef struct GX_VarRegionRec_ + { + GX_AxisCoords axisList; /* array of axisCount records */ + + } GX_VarRegionRec, *GX_VarRegion; + + + /* item variation store */ + typedef struct GX_ItemVarStoreRec_ + { + FT_UInt dataCount; + GX_ItemVarData varData; /* array of dataCount records; */ + /* use `outerIndex' for this array */ + FT_UShort axisCount; + FT_UInt regionCount; /* total number of regions defined */ + GX_VarRegion varRegionList; + + } GX_ItemVarStoreRec, *GX_ItemVarStore; + + + typedef struct GX_DeltaSetIdxMapRec_ + { + FT_ULong mapCount; + FT_UInt* outerIndex; /* indices to item var data */ + FT_UInt* innerIndex; /* indices to delta set */ + + } GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap; + + +FT_END_HEADER + +#endif /* FTMMTYPES_H_ */ + + +/* END */ diff --git a/lib/freetype/include/freetype/internal/ftobjs.h b/lib/freetype/include/freetype/internal/ftobjs.h index 1c779ceae..28bc9b65f 100644 --- a/lib/freetype/include/freetype/internal/ftobjs.h +++ b/lib/freetype/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ * * The FreeType private base classes (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftpsprop.h b/lib/freetype/include/freetype/internal/ftpsprop.h index 47373211c..1d5b287ad 100644 --- a/lib/freetype/include/freetype/internal/ftpsprop.h +++ b/lib/freetype/include/freetype/internal/ftpsprop.h @@ -4,7 +4,7 @@ * * Get and set properties of PostScript drivers (specification). * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftrfork.h b/lib/freetype/include/freetype/internal/ftrfork.h index 165e67f24..e96459921 100644 --- a/lib/freetype/include/freetype/internal/ftrfork.h +++ b/lib/freetype/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * Masatake YAMATO and Redhat K.K. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftserv.h b/lib/freetype/include/freetype/internal/ftserv.h index 78996d9c8..1e85d6d38 100644 --- a/lib/freetype/include/freetype/internal/ftserv.h +++ b/lib/freetype/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ * * The FreeType services (specification only). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftstream.h b/lib/freetype/include/freetype/internal/ftstream.h index aa51fe5a8..88e19287c 100644 --- a/lib/freetype/include/freetype/internal/ftstream.h +++ b/lib/freetype/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ * * Stream handling (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -238,42 +238,42 @@ FT_BEGIN_HEADER #define FT_NEXT_BYTE( buffer ) \ ( (unsigned char)*buffer++ ) -#define FT_NEXT_SHORT( buffer ) \ - ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) ) +#define FT_NEXT_SHORT( buffer ) \ + ( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) -#define FT_NEXT_USHORT( buffer ) \ - ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) ) +#define FT_NEXT_USHORT( buffer ) \ + ( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) -#define FT_NEXT_OFF3( buffer ) \ - ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) ) +#define FT_NEXT_OFF3( buffer ) \ + ( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) -#define FT_NEXT_UOFF3( buffer ) \ - ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) ) +#define FT_NEXT_UOFF3( buffer ) \ + ( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) -#define FT_NEXT_LONG( buffer ) \ - ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) ) +#define FT_NEXT_LONG( buffer ) \ + ( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) -#define FT_NEXT_ULONG( buffer ) \ - ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) ) +#define FT_NEXT_ULONG( buffer ) \ + ( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) -#define FT_NEXT_SHORT_LE( buffer ) \ - ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) ) +#define FT_NEXT_SHORT_LE( buffer ) \ + ( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) -#define FT_NEXT_USHORT_LE( buffer ) \ - ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) ) +#define FT_NEXT_USHORT_LE( buffer ) \ + ( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) -#define FT_NEXT_OFF3_LE( buffer ) \ - ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) ) +#define FT_NEXT_OFF3_LE( buffer ) \ + ( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) -#define FT_NEXT_UOFF3_LE( buffer ) \ - ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) ) +#define FT_NEXT_UOFF3_LE( buffer ) \ + ( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) -#define FT_NEXT_LONG_LE( buffer ) \ - ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) ) +#define FT_NEXT_LONG_LE( buffer ) \ + ( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) -#define FT_NEXT_ULONG_LE( buffer ) \ - ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) ) +#define FT_NEXT_ULONG_LE( buffer ) \ + ( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) /************************************************************************** @@ -307,17 +307,17 @@ FT_BEGIN_HEADER #define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetByte, FT_Char ) #define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetByte, FT_Byte ) -#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Short ) -#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort ) -#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong ) -#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Long ) -#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong ) -#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong ) - -#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short ) -#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort ) -#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long ) -#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong ) +#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Int16 ) +#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UInt16 ) +#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_UInt32 ) +#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Int32 ) +#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_UInt32 ) +#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_UInt32 ) + +#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Int16 ) +#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UInt16 ) +#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Int32 ) +#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_UInt32 ) #endif @@ -334,16 +334,16 @@ FT_BEGIN_HEADER */ #define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadByte, FT_Byte, var ) #define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadByte, FT_Char, var ) -#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var ) -#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var ) -#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var ) -#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var ) -#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var ) +#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Int16, var ) +#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UInt16, var ) +#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_UInt32, var ) +#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Int32, var ) +#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_UInt32, var ) -#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var ) -#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var ) -#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var ) -#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var ) +#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Int16, var ) +#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UInt16, var ) +#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Int32, var ) +#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_UInt32, var ) #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM @@ -459,23 +459,23 @@ FT_BEGIN_HEADER FT_Stream_GetByte( FT_Stream stream ); /* read a 16-bit big-endian unsigned integer from an entered frame */ - FT_BASE( FT_UShort ) + FT_BASE( FT_UInt16 ) FT_Stream_GetUShort( FT_Stream stream ); /* read a 24-bit big-endian unsigned integer from an entered frame */ - FT_BASE( FT_ULong ) + FT_BASE( FT_UInt32 ) FT_Stream_GetUOffset( FT_Stream stream ); /* read a 32-bit big-endian unsigned integer from an entered frame */ - FT_BASE( FT_ULong ) + FT_BASE( FT_UInt32 ) FT_Stream_GetULong( FT_Stream stream ); /* read a 16-bit little-endian unsigned integer from an entered frame */ - FT_BASE( FT_UShort ) + FT_BASE( FT_UInt16 ) FT_Stream_GetUShortLE( FT_Stream stream ); /* read a 32-bit little-endian unsigned integer from an entered frame */ - FT_BASE( FT_ULong ) + FT_BASE( FT_UInt32 ) FT_Stream_GetULongLE( FT_Stream stream ); @@ -485,7 +485,7 @@ FT_BEGIN_HEADER FT_Error* error ); /* read a 16-bit big-endian unsigned integer from a stream */ - FT_BASE( FT_UShort ) + FT_BASE( FT_UInt16 ) FT_Stream_ReadUShort( FT_Stream stream, FT_Error* error ); @@ -495,17 +495,17 @@ FT_BEGIN_HEADER FT_Error* error ); /* read a 32-bit big-endian integer from a stream */ - FT_BASE( FT_ULong ) + FT_BASE( FT_UInt32 ) FT_Stream_ReadULong( FT_Stream stream, FT_Error* error ); /* read a 16-bit little-endian unsigned integer from a stream */ - FT_BASE( FT_UShort ) + FT_BASE( FT_UInt16 ) FT_Stream_ReadUShortLE( FT_Stream stream, FT_Error* error ); /* read a 32-bit little-endian unsigned integer from a stream */ - FT_BASE( FT_ULong ) + FT_BASE( FT_UInt32 ) FT_Stream_ReadULongLE( FT_Stream stream, FT_Error* error ); diff --git a/lib/freetype/include/freetype/internal/fttrace.h b/lib/freetype/include/freetype/internal/fttrace.h index 43c6a8713..319fe56fd 100644 --- a/lib/freetype/include/freetype/internal/fttrace.h +++ b/lib/freetype/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ * * Tracing handling (specification only). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/ftvalid.h b/lib/freetype/include/freetype/internal/ftvalid.h index 171c2cb6f..e98ee4e47 100644 --- a/lib/freetype/include/freetype/internal/ftvalid.h +++ b/lib/freetype/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ * * FreeType validation support (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/psaux.h b/lib/freetype/include/freetype/internal/psaux.h index 48ec1df96..dfb1987f8 100644 --- a/lib/freetype/include/freetype/internal/psaux.h +++ b/lib/freetype/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ * Auxiliary functions and data structures related to PostScript fonts * (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -132,9 +132,6 @@ FT_BEGIN_HEADER * max_elems :: * The maximum number of elements in table. * - * num_elems :: - * The current number of elements in table. - * * elements :: * A table of element addresses within the block. * @@ -155,7 +152,6 @@ FT_BEGIN_HEADER FT_ULong init; FT_Int max_elems; - FT_Int num_elems; FT_Byte** elements; /* addresses of table elements */ FT_UInt* lengths; /* lengths of table elements */ diff --git a/lib/freetype/include/freetype/internal/pshints.h b/lib/freetype/include/freetype/internal/pshints.h index 5de83e456..ededc4c72 100644 --- a/lib/freetype/include/freetype/internal/pshints.h +++ b/lib/freetype/include/freetype/internal/pshints.h @@ -6,7 +6,7 @@ * recorders (specification only). These are used to support native * T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers. * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -294,7 +294,7 @@ FT_BEGIN_HEADER * * @note: * On input, all points within the outline are in font coordinates. On - * output, they are in 1/64th of pixels. + * output, they are in 1/64 of pixels. * * The scaling transformation is taken from the 'globals' object which * must correspond to the same font as the glyph. @@ -607,7 +607,7 @@ FT_BEGIN_HEADER * * @note: * On input, all points within the outline are in font coordinates. On - * output, they are in 1/64th of pixels. + * output, they are in 1/64 of pixels. * * The scaling transformation is taken from the 'globals' object which * must correspond to the same font than the glyph. diff --git a/lib/freetype/include/freetype/internal/services/svbdf.h b/lib/freetype/include/freetype/internal/services/svbdf.h index 06e3b531c..bf0c1dcc7 100644 --- a/lib/freetype/include/freetype/internal/services/svbdf.h +++ b/lib/freetype/include/freetype/internal/services/svbdf.h @@ -4,7 +4,7 @@ * * The FreeType BDF services (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svcfftl.h b/lib/freetype/include/freetype/internal/services/svcfftl.h index 1dea6bcda..4a20498ee 100644 --- a/lib/freetype/include/freetype/internal/services/svcfftl.h +++ b/lib/freetype/include/freetype/internal/services/svcfftl.h @@ -4,7 +4,7 @@ * * The FreeType CFF tables loader service (specification). * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svcid.h b/lib/freetype/include/freetype/internal/services/svcid.h index acf9178d0..06d0cb8fd 100644 --- a/lib/freetype/include/freetype/internal/services/svcid.h +++ b/lib/freetype/include/freetype/internal/services/svcid.h @@ -4,7 +4,7 @@ * * The FreeType CID font services (specification). * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svfntfmt.h b/lib/freetype/include/freetype/internal/services/svfntfmt.h index a7280319c..bc45e8056 100644 --- a/lib/freetype/include/freetype/internal/services/svfntfmt.h +++ b/lib/freetype/include/freetype/internal/services/svfntfmt.h @@ -4,7 +4,7 @@ * * The FreeType font format service (specification only). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svgldict.h b/lib/freetype/include/freetype/internal/services/svgldict.h index 489021d89..6437abfbf 100644 --- a/lib/freetype/include/freetype/internal/services/svgldict.h +++ b/lib/freetype/include/freetype/internal/services/svgldict.h @@ -4,7 +4,7 @@ * * The FreeType glyph dictionary services (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svgxval.h b/lib/freetype/include/freetype/internal/services/svgxval.h index 59ae411b5..31016afe0 100644 --- a/lib/freetype/include/freetype/internal/services/svgxval.h +++ b/lib/freetype/include/freetype/internal/services/svgxval.h @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/include/freetype/internal/services/svkern.h b/lib/freetype/include/freetype/internal/services/svkern.h index c567acad4..bcabbc3e6 100644 --- a/lib/freetype/include/freetype/internal/services/svkern.h +++ b/lib/freetype/include/freetype/internal/services/svkern.h @@ -4,7 +4,7 @@ * * The FreeType Kerning service (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svmetric.h b/lib/freetype/include/freetype/internal/services/svmetric.h index 7accdc46f..e588ea487 100644 --- a/lib/freetype/include/freetype/internal/services/svmetric.h +++ b/lib/freetype/include/freetype/internal/services/svmetric.h @@ -4,7 +4,7 @@ * * The FreeType services for metrics variations (specification). * - * Copyright (C) 2016-2022 by + * Copyright (C) 2016-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svmm.h b/lib/freetype/include/freetype/internal/services/svmm.h index c6394890a..d94204232 100644 --- a/lib/freetype/include/freetype/internal/services/svmm.h +++ b/lib/freetype/include/freetype/internal/services/svmm.h @@ -4,8 +4,8 @@ * * The FreeType Multiple Masters and GX var services (specification). * - * Copyright (C) 2003-2022 by - * David Turner, Robert Wilhelm, and Werner Lemberg. + * Copyright (C) 2003-2023 by + * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. * * This file is part of the FreeType project, and may only be used, * modified, and distributed under the terms of the FreeType project @@ -19,7 +19,9 @@ #ifndef SVMM_H_ #define SVMM_H_ +#include <freetype/ftmm.h> #include <freetype/internal/ftserv.h> +#include <freetype/internal/ftmmtypes.h> FT_BEGIN_HEADER @@ -96,53 +98,94 @@ FT_BEGIN_HEADER FT_UInt* len, FT_Fixed* weight_vector ); + typedef FT_Error + (*FT_Var_Load_Delta_Set_Idx_Map_Func)( FT_Face face, + FT_ULong offset, + GX_DeltaSetIdxMap map, + GX_ItemVarStore itemStore, + FT_ULong table_len ); + + typedef FT_Error + (*FT_Var_Load_Item_Var_Store_Func)( FT_Face face, + FT_ULong offset, + GX_ItemVarStore itemStore ); + + typedef FT_ItemVarDelta + (*FT_Var_Get_Item_Delta_Func)( FT_Face face, + GX_ItemVarStore itemStore, + FT_UInt outerIndex, + FT_UInt innerIndex ); + + typedef void + (*FT_Var_Done_Item_Var_Store_Func)( FT_Face face, + GX_ItemVarStore itemStore ); + + typedef void + (*FT_Var_Done_Delta_Set_Idx_Map_Func)( FT_Face face, + GX_DeltaSetIdxMap deltaSetIdxMap ); + FT_DEFINE_SERVICE( MultiMasters ) { - FT_Get_MM_Func get_mm; - FT_Set_MM_Design_Func set_mm_design; - FT_Set_MM_Blend_Func set_mm_blend; - FT_Get_MM_Blend_Func get_mm_blend; - FT_Get_MM_Var_Func get_mm_var; - FT_Set_Var_Design_Func set_var_design; - FT_Get_Var_Design_Func get_var_design; - FT_Set_Instance_Func set_instance; - FT_Set_MM_WeightVector_Func set_mm_weightvector; - FT_Get_MM_WeightVector_Func get_mm_weightvector; + FT_Get_MM_Func get_mm; + FT_Set_MM_Design_Func set_mm_design; + FT_Set_MM_Blend_Func set_mm_blend; + FT_Get_MM_Blend_Func get_mm_blend; + FT_Get_MM_Var_Func get_mm_var; + FT_Set_Var_Design_Func set_var_design; + FT_Get_Var_Design_Func get_var_design; + FT_Set_Instance_Func set_instance; + FT_Set_MM_WeightVector_Func set_mm_weightvector; + FT_Get_MM_WeightVector_Func get_mm_weightvector; /* for internal use; only needed for code sharing between modules */ - FT_Get_Var_Blend_Func get_var_blend; - FT_Done_Blend_Func done_blend; + FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map; + FT_Var_Load_Item_Var_Store_Func load_item_var_store; + FT_Var_Get_Item_Delta_Func get_item_delta; + FT_Var_Done_Item_Var_Store_Func done_item_var_store; + FT_Var_Done_Delta_Set_Idx_Map_Func done_delta_set_idx_map; + FT_Get_Var_Blend_Func get_var_blend; + FT_Done_Blend_Func done_blend; }; -#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - set_instance_, \ - set_weightvector_, \ - get_weightvector_, \ - get_var_blend_, \ - done_blend_ ) \ - static const FT_Service_MultiMastersRec class_ = \ - { \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - set_instance_, \ - set_weightvector_, \ - get_weightvector_, \ - get_var_blend_, \ - done_blend_ \ +#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + set_weightvector_, \ + get_weightvector_, \ + load_delta_set_idx_map_, \ + load_item_var_store_, \ + get_item_delta_, \ + done_item_var_store_, \ + done_delta_set_idx_map_, \ + get_var_blend_, \ + done_blend_ ) \ + static const FT_Service_MultiMastersRec class_ = \ + { \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + set_weightvector_, \ + get_weightvector_, \ + load_delta_set_idx_map_, \ + load_item_var_store_, \ + get_item_delta_, \ + done_item_var_store_, \ + done_delta_set_idx_map_, \ + get_var_blend_, \ + done_blend_ \ }; /* */ diff --git a/lib/freetype/include/freetype/internal/services/svotval.h b/lib/freetype/include/freetype/internal/services/svotval.h index 3c72d1f85..a4683cd5f 100644 --- a/lib/freetype/include/freetype/internal/services/svotval.h +++ b/lib/freetype/include/freetype/internal/services/svotval.h @@ -4,7 +4,7 @@ * * The FreeType OpenType validation service (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svpfr.h b/lib/freetype/include/freetype/internal/services/svpfr.h index bde0ed354..fd189c7de 100644 --- a/lib/freetype/include/freetype/internal/services/svpfr.h +++ b/lib/freetype/include/freetype/internal/services/svpfr.h @@ -4,7 +4,7 @@ * * Internal PFR service functions (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svpostnm.h b/lib/freetype/include/freetype/internal/services/svpostnm.h index 05f6291e1..2b8f6dfec 100644 --- a/lib/freetype/include/freetype/internal/services/svpostnm.h +++ b/lib/freetype/include/freetype/internal/services/svpostnm.h @@ -4,7 +4,7 @@ * * The FreeType PostScript name services (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svprop.h b/lib/freetype/include/freetype/internal/services/svprop.h index 29c568640..932ce32e0 100644 --- a/lib/freetype/include/freetype/internal/services/svprop.h +++ b/lib/freetype/include/freetype/internal/services/svprop.h @@ -4,7 +4,7 @@ * * The FreeType property service (specification). * - * Copyright (C) 2012-2022 by + * Copyright (C) 2012-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svpscmap.h b/lib/freetype/include/freetype/internal/services/svpscmap.h index 7d586587a..fd99d857e 100644 --- a/lib/freetype/include/freetype/internal/services/svpscmap.h +++ b/lib/freetype/include/freetype/internal/services/svpscmap.h @@ -4,7 +4,7 @@ * * The FreeType PostScript charmap service (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svpsinfo.h b/lib/freetype/include/freetype/internal/services/svpsinfo.h index 6e45f3272..09c4cdccc 100644 --- a/lib/freetype/include/freetype/internal/services/svpsinfo.h +++ b/lib/freetype/include/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ * * The FreeType PostScript info service (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svsfnt.h b/lib/freetype/include/freetype/internal/services/svsfnt.h index 03938a562..f98df2ef5 100644 --- a/lib/freetype/include/freetype/internal/services/svsfnt.h +++ b/lib/freetype/include/freetype/internal/services/svsfnt.h @@ -4,7 +4,7 @@ * * The FreeType SFNT table loading service (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svttcmap.h b/lib/freetype/include/freetype/internal/services/svttcmap.h index a0b1bbd2f..5f9eb02d6 100644 --- a/lib/freetype/include/freetype/internal/services/svttcmap.h +++ b/lib/freetype/include/freetype/internal/services/svttcmap.h @@ -4,7 +4,7 @@ * * The FreeType TrueType/sfnt cmap extra information service. * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * Masatake YAMATO, Redhat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/include/freetype/internal/services/svtteng.h b/lib/freetype/include/freetype/internal/services/svtteng.h index f8396eb08..ad577cb29 100644 --- a/lib/freetype/include/freetype/internal/services/svtteng.h +++ b/lib/freetype/include/freetype/internal/services/svtteng.h @@ -4,7 +4,7 @@ * * The FreeType TrueType engine query service (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svttglyf.h b/lib/freetype/include/freetype/internal/services/svttglyf.h index 982630c0a..ca6fff744 100644 --- a/lib/freetype/include/freetype/internal/services/svttglyf.h +++ b/lib/freetype/include/freetype/internal/services/svttglyf.h @@ -4,7 +4,7 @@ * * The FreeType TrueType glyph service. * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/services/svwinfnt.h b/lib/freetype/include/freetype/internal/services/svwinfnt.h index 950f4a882..002923f8c 100644 --- a/lib/freetype/include/freetype/internal/services/svwinfnt.h +++ b/lib/freetype/include/freetype/internal/services/svwinfnt.h @@ -4,7 +4,7 @@ * * The FreeType Windows FNT/FONT service (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/sfnt.h b/lib/freetype/include/freetype/internal/sfnt.h index c67b47e86..a2d4e15ba 100644 --- a/lib/freetype/include/freetype/internal/sfnt.h +++ b/lib/freetype/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ * * High-level 'sfnt' driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/svginterface.h b/lib/freetype/include/freetype/internal/svginterface.h index 1b325e5e9..f464b2c05 100644 --- a/lib/freetype/include/freetype/internal/svginterface.h +++ b/lib/freetype/include/freetype/internal/svginterface.h @@ -4,7 +4,7 @@ * * Interface of ot-svg module (specification only). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 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/lib/freetype/include/freetype/internal/t1types.h b/lib/freetype/include/freetype/internal/t1types.h index b6a3de14d..5a105c587 100644 --- a/lib/freetype/include/freetype/internal/t1types.h +++ b/lib/freetype/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ * Basic Type1/Type2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -172,8 +172,8 @@ FT_BEGIN_HEADER { FT_Bool IsCIDFont; FT_BBox FontBBox; - FT_Fixed Ascender; - FT_Fixed Descender; + FT_Fixed Ascender; /* optional, mind the zero */ + FT_Fixed Descender; /* optional, mind the zero */ AFM_TrackKern TrackKerns; /* free if non-NULL */ FT_UInt NumTrackKern; AFM_KernPair KernPairs; /* free if non-NULL */ diff --git a/lib/freetype/include/freetype/internal/tttypes.h b/lib/freetype/include/freetype/internal/tttypes.h index df719387b..3b521924c 100644 --- a/lib/freetype/include/freetype/internal/tttypes.h +++ b/lib/freetype/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ * Basic SFNT/TrueType type definitions and interface (specification * only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/internal/wofftypes.h b/lib/freetype/include/freetype/internal/wofftypes.h index 94804fa72..0c1d8eeaf 100644 --- a/lib/freetype/include/freetype/internal/wofftypes.h +++ b/lib/freetype/include/freetype/internal/wofftypes.h @@ -5,7 +5,7 @@ * Basic WOFF/WOFF2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/otsvg.h b/lib/freetype/include/freetype/otsvg.h index 2caadfdee..bfe9a6ab7 100644 --- a/lib/freetype/include/freetype/otsvg.h +++ b/lib/freetype/include/freetype/otsvg.h @@ -4,7 +4,7 @@ * * Interface for OT-SVG support related things (specification). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 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/lib/freetype/include/freetype/t1tables.h b/lib/freetype/include/freetype/t1tables.h index 4068b204a..1aecfbbd9 100644 --- a/lib/freetype/include/freetype/t1tables.h +++ b/lib/freetype/include/freetype/t1tables.h @@ -5,7 +5,7 @@ * Basic Type 1/Type 2 tables definitions and interface (specification * only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/ttnameid.h b/lib/freetype/include/freetype/ttnameid.h index 37b505a05..e31c68b9b 100644 --- a/lib/freetype/include/freetype/ttnameid.h +++ b/lib/freetype/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ * * TrueType name ID definitions (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/freetype/tttables.h b/lib/freetype/include/freetype/tttables.h index 21664df7b..a9f60e762 100644 --- a/lib/freetype/include/freetype/tttables.h +++ b/lib/freetype/include/freetype/tttables.h @@ -5,7 +5,7 @@ * Basic SFNT/TrueType tables definitions and interface * (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -424,8 +424,8 @@ FT_BEGIN_HEADER /* only version 5 and higher: */ - FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */ - FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ + FT_UShort usLowerOpticalPointSize; /* in twips (1/20 points) */ + FT_UShort usUpperOpticalPointSize; /* in twips (1/20 points) */ } TT_OS2; diff --git a/lib/freetype/include/freetype/tttags.h b/lib/freetype/include/freetype/tttags.h index 8b807641b..9bf4fca23 100644 --- a/lib/freetype/include/freetype/tttags.h +++ b/lib/freetype/include/freetype/tttags.h @@ -4,7 +4,7 @@ * * Tags for TrueType and OpenType tables (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/include/ft2build.h b/lib/freetype/include/ft2build.h index 2543ac435..58491ceea 100644 --- a/lib/freetype/include/ft2build.h +++ b/lib/freetype/include/ft2build.h @@ -4,7 +4,7 @@ * * FreeType 2 build and setup macros. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/meson.build b/lib/freetype/meson.build index a066325b4..f81de3e2f 100644 --- a/lib/freetype/meson.build +++ b/lib/freetype/meson.build @@ -2,7 +2,7 @@ # Meson project file for FreeType 2 # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -52,6 +52,8 @@ ft2_includes = include_directories('include') freetype_includedir = join_paths(get_option('includedir'), 'freetype2') +ft2_defines = [] + # Generate a custom `ftmodule.h` version based on the content of # `modules.cfg`. @@ -64,6 +66,7 @@ ftmodule_h = custom_target('ftmodule.h', install_dir: join_paths(freetype_includedir, 'freetype/config'), ) ft2_sources = [ftmodule_h] +ft2_defines += ['-DFT_CONFIG_MODULES_H=<ftmodule.h>'] # FreeType 2 modules. @@ -187,7 +190,7 @@ ft2_config_headers = files([ 'include/freetype/config/public-macros.h', ]) -ft2_defines = ['-DFT2_BUILD_LIBRARY=1'] +ft2_defines += ['-DFT2_BUILD_LIBRARY=1'] # System support file. @@ -335,7 +338,8 @@ endif # Harfbuzz support harfbuzz_dep = dependency('harfbuzz', version: '>= 2.0.0', - required: get_option('harfbuzz')) + required: get_option('harfbuzz'), + default_options: ['freetype=disabled']) if harfbuzz_dep.found() ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ'] diff --git a/lib/freetype/meson_options.txt b/lib/freetype/meson_options.txt index 8ea625172..e4ad50ca7 100644 --- a/lib/freetype/meson_options.txt +++ b/lib/freetype/meson_options.txt @@ -2,7 +2,7 @@ # meson_options.txt # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/modules.cfg b/lib/freetype/modules.cfg index aded92e5e..5b6c9b5a5 100644 --- a/lib/freetype/modules.cfg +++ b/lib/freetype/modules.cfg @@ -1,6 +1,6 @@ # modules.cfg # -# Copyright (C) 2005-2022 by +# Copyright (C) 2005-2023 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/lib/freetype/shlib_version b/lib/freetype/shlib_version index d30ffad96..cf147bc49 100644 --- a/lib/freetype/shlib_version +++ b/lib/freetype/shlib_version @@ -1,4 +1,4 @@ major=30 -minor=2 +minor=3 # note: If bumping the major, also bump major for libXft, libXfont2 # and libfontconfig diff --git a/lib/freetype/src/autofit/afblue.c b/lib/freetype/src/autofit/afblue.c index b986eb4a1..d7655b9b9 100644 --- a/lib/freetype/src/autofit/afblue.c +++ b/lib/freetype/src/autofit/afblue.c @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afblue.cin b/lib/freetype/src/autofit/afblue.cin index f7e27ad8e..d561c5093 100644 --- a/lib/freetype/src/autofit/afblue.cin +++ b/lib/freetype/src/autofit/afblue.cin @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afblue.dat b/lib/freetype/src/autofit/afblue.dat index 201acc4f6..b7efe8be6 100644 --- a/lib/freetype/src/autofit/afblue.dat +++ b/lib/freetype/src/autofit/afblue.dat @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright (C) 2013-2022 by +// Copyright (C) 2013-2023 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afblue.h b/lib/freetype/src/autofit/afblue.h index 0e56abb94..76f2f47cb 100644 --- a/lib/freetype/src/autofit/afblue.h +++ b/lib/freetype/src/autofit/afblue.h @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afblue.hin b/lib/freetype/src/autofit/afblue.hin index f9fd5aa3b..6a31298e6 100644 --- a/lib/freetype/src/autofit/afblue.hin +++ b/lib/freetype/src/autofit/afblue.hin @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afcjk.c b/lib/freetype/src/autofit/afcjk.c index 1853a17f5..5daefff35 100644 --- a/lib/freetype/src/autofit/afcjk.c +++ b/lib/freetype/src/autofit/afcjk.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (body). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -650,7 +650,7 @@ af_cjk_metrics_check_digits( metrics, face ); } - FT_Set_Charmap( face, oldmap ); + face->charmap = oldmap; return FT_Err_Ok; } @@ -741,9 +741,11 @@ ( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V', nn, blue->ref.org, blue->shoot.org )); FT_TRACE5(( " ref: cur=%.2f fit=%.2f\n", - blue->ref.cur / 64.0, blue->ref.fit / 64.0 )); + (double)blue->ref.cur / 64, + (double)blue->ref.fit / 64 )); FT_TRACE5(( " shoot: cur=%.2f fit=%.2f\n", - blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); + (double)blue->shoot.cur / 64, + (double)blue->shoot.fit / 64 )); blue->flags |= AF_CJK_BLUE_ACTIVE; } @@ -1044,7 +1046,7 @@ { AF_Edge found = NULL; FT_Pos best = 0xFFFFU; - FT_Int ee; + FT_UInt ee; /* look for an edge corresponding to the segment */ @@ -1629,8 +1631,10 @@ FT_TRACE5(( " CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f," " dist was %.2f, now %.2f\n", stem_edge - hints->axis[dim].edges, stem_edge->fpos, - stem_edge->opos / 64.0, stem_edge->pos / 64.0, - dist / 64.0, fitted_width / 64.0 )); + (double)stem_edge->opos / 64, + (double)stem_edge->pos / 64, + (double)dist / 64, + (double)fitted_width / 64 )); } @@ -1850,8 +1854,8 @@ #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE5(( " CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f," " was %.2f\n", - edge1 - edges, edge1->fpos, edge1->opos / 64.0, - blue->fit / 64.0, edge1->pos / 64.0 )); + edge1 - edges, edge1->fpos, (double)edge1->opos / 64, + (double)blue->fit / 64, (double)edge1->pos / 64 )); num_actions++; #endif @@ -2024,8 +2028,8 @@ #if 0 printf( "stem (%d,%d) adjusted (%.1f,%.1f)\n", edge - edges, edge2 - edges, - ( edge->pos - edge->opos ) / 64.0, - ( edge2->pos - edge2->opos ) / 64.0 ); + (double)( edge->pos - edge->opos ) / 64, + (double)( edge2->pos - edge2->opos ) / 64 ); #endif anchor = edge; diff --git a/lib/freetype/src/autofit/afcjk.h b/lib/freetype/src/autofit/afcjk.h index bf948bcec..bd7b81b3e 100644 --- a/lib/freetype/src/autofit/afcjk.h +++ b/lib/freetype/src/autofit/afcjk.h @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afcover.h b/lib/freetype/src/autofit/afcover.h index be71fe39d..102ed4278 100644 --- a/lib/freetype/src/autofit/afcover.h +++ b/lib/freetype/src/autofit/afcover.h @@ -4,7 +4,7 @@ * * Auto-fitter coverages (specification only). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afdummy.c b/lib/freetype/src/autofit/afdummy.c index 5fdbfcfd4..a4629b528 100644 --- a/lib/freetype/src/autofit/afdummy.c +++ b/lib/freetype/src/autofit/afdummy.c @@ -5,7 +5,7 @@ * Auto-fitter dummy routines to be used if no hinting should be * performed (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afdummy.h b/lib/freetype/src/autofit/afdummy.h index 4dddbd521..a7af3f62c 100644 --- a/lib/freetype/src/autofit/afdummy.h +++ b/lib/freetype/src/autofit/afdummy.h @@ -5,7 +5,7 @@ * Auto-fitter dummy routines to be used if no hinting should be * performed (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/aferrors.h b/lib/freetype/src/autofit/aferrors.h index d31b1a9c8..88faf05c9 100644 --- a/lib/freetype/src/autofit/aferrors.h +++ b/lib/freetype/src/autofit/aferrors.h @@ -4,7 +4,7 @@ * * Autofitter error codes (specification only). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afglobal.c b/lib/freetype/src/autofit/afglobal.c index 87a3fbfb0..ede27eb16 100644 --- a/lib/freetype/src/autofit/afglobal.c +++ b/lib/freetype/src/autofit/afglobal.c @@ -4,7 +4,7 @@ * * Auto-fitter routines to compute global hinting values (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -129,13 +129,13 @@ FT_Face face = globals->face; FT_CharMap old_charmap = face->charmap; FT_UShort* gstyles = globals->glyph_styles; - FT_UInt ss; + FT_UShort ss; + FT_UShort dflt = 0xFFFFU; /* a non-valid value */ FT_UInt i; - FT_UInt dflt = ~0U; /* a non-valid value */ /* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */ - for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ ) + for ( i = 0; i < globals->glyph_count; i++ ) gstyles[i] = AF_STYLE_UNASSIGNED; error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); @@ -168,8 +168,7 @@ */ if ( style_class->coverage == AF_COVERAGE_DEFAULT ) { - if ( (FT_UInt)style_class->script == - globals->module->default_script ) + if ( style_class->script == globals->module->default_script ) dflt = ss; for ( range = script_class->script_uni_ranges; @@ -183,9 +182,9 @@ gindex = FT_Get_Char_Index( face, charcode ); if ( gindex != 0 && - gindex < (FT_ULong)globals->glyph_count && + gindex < globals->glyph_count && ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = (FT_UShort)ss; + gstyles[gindex] = ss; for (;;) { @@ -194,9 +193,9 @@ if ( gindex == 0 || charcode > range->last ) break; - if ( gindex < (FT_ULong)globals->glyph_count && + if ( gindex < globals->glyph_count && ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = (FT_UShort)ss; + gstyles[gindex] = ss; } } @@ -211,9 +210,9 @@ gindex = FT_Get_Char_Index( face, charcode ); - if ( gindex != 0 && - gindex < (FT_ULong)globals->glyph_count && - ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss ) + if ( gindex != 0 && + gindex < globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == ss ) gstyles[gindex] |= AF_NONBASE; for (;;) @@ -223,8 +222,8 @@ if ( gindex == 0 || charcode > range->last ) break; - if ( gindex < (FT_ULong)globals->glyph_count && - ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss ) + if ( gindex < globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == ss ) gstyles[gindex] |= AF_NONBASE; } } @@ -255,7 +254,7 @@ FT_UInt gindex = FT_Get_Char_Index( face, i ); - if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count ) + if ( gindex != 0 && gindex < globals->glyph_count ) gstyles[gindex] |= AF_DIGIT; } @@ -266,7 +265,7 @@ */ if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED ) { - FT_Long nn; + FT_UInt nn; for ( nn = 0; nn < globals->glyph_count; nn++ ) @@ -290,7 +289,7 @@ { AF_StyleClass style_class = af_style_classes[ss]; FT_UInt count = 0; - FT_Long idx; + FT_UInt idx; FT_TRACE4(( "%s:\n", af_style_names[style_class->style] )); @@ -302,7 +301,7 @@ if ( !( count % 10 ) ) FT_TRACE4(( " " )); - FT_TRACE4(( " %ld", idx )); + FT_TRACE4(( " %d", idx )); count++; if ( !( count % 10 ) ) @@ -318,7 +317,7 @@ #endif /* FT_DEBUG_LEVEL_TRACE */ - FT_Set_Charmap( face, old_charmap ); + face->charmap = old_charmap; return error; } @@ -345,7 +344,7 @@ FT_ZERO( &globals->metrics ); globals->face = face; - globals->glyph_count = face->num_glyphs; + globals->glyph_count = (FT_UInt)face->num_glyphs; /* right after the globals structure come the glyph styles */ globals->glyph_styles = (FT_UShort*)( globals + 1 ); globals->module = module; @@ -357,7 +356,7 @@ globals->scale_down_factor = 0; #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - globals->hb_font = hb_ft_font_create( face, NULL ); + globals->hb_font = hb_ft_font_create_( face, NULL ); globals->hb_buf = hb_buffer_create(); #endif @@ -429,7 +428,7 @@ FT_Error error = FT_Err_Ok; - if ( gindex >= (FT_ULong)globals->glyph_count ) + if ( gindex >= globals->glyph_count ) { error = FT_THROW( Invalid_Argument ); goto Exit; @@ -501,7 +500,7 @@ af_face_globals_is_digit( AF_FaceGlobals globals, FT_UInt gindex ) { - if ( gindex < (FT_ULong)globals->glyph_count ) + if ( gindex < globals->glyph_count ) return FT_BOOL( globals->glyph_styles[gindex] & AF_DIGIT ); return FT_BOOL( 0 ); diff --git a/lib/freetype/src/autofit/afglobal.h b/lib/freetype/src/autofit/afglobal.h index f7ebf8d57..83a7c2ff1 100644 --- a/lib/freetype/src/autofit/afglobal.h +++ b/lib/freetype/src/autofit/afglobal.h @@ -5,7 +5,7 @@ * Auto-fitter routines to compute global hinting values * (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -105,7 +105,7 @@ FT_BEGIN_HEADER typedef struct AF_FaceGlobalsRec_ { FT_Face face; - FT_Long glyph_count; /* same as face->num_glyphs */ + FT_UInt glyph_count; /* unsigned face->num_glyphs */ FT_UShort* glyph_styles; #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ @@ -158,7 +158,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) af_face_globals_free( AF_FaceGlobals globals ); - FT_LOCAL_DEF( FT_Bool ) + FT_LOCAL( FT_Bool ) af_face_globals_is_digit( AF_FaceGlobals globals, FT_UInt gindex ); diff --git a/lib/freetype/src/autofit/afhints.c b/lib/freetype/src/autofit/afhints.c index ae7d10528..6515af9f0 100644 --- a/lib/freetype/src/autofit/afhints.c +++ b/lib/freetype/src/autofit/afhints.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -151,9 +151,9 @@ } else if ( axis->num_segments >= axis->max_segments ) { - FT_Int old_max = axis->max_segments; - FT_Int new_max = old_max; - FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *segment ) ); + FT_UInt old_max = axis->max_segments; + FT_UInt new_max = old_max; + FT_UInt big_max = FT_INT_MAX / sizeof ( *segment ); if ( old_max >= big_max ) @@ -193,7 +193,7 @@ /* Get new edge for given axis, direction, and position, */ /* without initializing the edge itself. */ - FT_LOCAL( FT_Error ) + FT_LOCAL_DEF( FT_Error ) af_axis_hints_new_edge( AF_AxisHints axis, FT_Int fpos, AF_Direction dir, @@ -216,9 +216,9 @@ } else if ( axis->num_edges >= axis->max_edges ) { - FT_Int old_max = axis->max_edges; - FT_Int new_max = old_max; - FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *edge ) ); + FT_UInt old_max = axis->max_edges; + FT_UInt new_max = old_max; + FT_UInt big_max = FT_INT_MAX / sizeof ( *edge ); if ( old_max >= big_max ) @@ -471,10 +471,10 @@ point->fx, point->fy, - point->ox / 64.0, - point->oy / 64.0, - point->x / 64.0, - point->y / 64.0, + (double)point->ox / 64, + (double)point->oy / 64, + (double)point->x / 64, + (double)point->y / 64, af_print_idx( buf5, af_get_strong_edge_index( hints, point->before, @@ -597,7 +597,7 @@ FT_Error af_glyph_hints_get_num_segments( AF_GlyphHints hints, FT_Int dimension, - FT_Int* num_segments ) + FT_UInt* num_segments ) { AF_Dimension dim; AF_AxisHints axis; @@ -623,7 +623,7 @@ FT_Error af_glyph_hints_get_segment_offset( AF_GlyphHints hints, FT_Int dimension, - FT_Int idx, + FT_UInt idx, FT_Pos *offset, FT_Bool *is_blue, FT_Pos *blue_offset ) @@ -640,7 +640,7 @@ axis = &hints->axis[dim]; - if ( idx < 0 || idx >= axis->num_segments ) + if ( idx >= axis->num_segments ) return FT_THROW( Invalid_Argument ); seg = &axis->segments[idx]; @@ -692,13 +692,13 @@ if ( dimension == AF_DIMENSION_HORZ ) AF_DUMP(( "Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n", "vertical", - 65536.0 * 64.0 / hints->x_scale, - 10.0 * hints->x_scale / 65536.0 / 64.0 )); + 65536 * 64 / (double)hints->x_scale, + 10 * (double)hints->x_scale / 65536 / 64 )); else AF_DUMP(( "Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n", "horizontal", - 65536.0 * 64.0 / hints->y_scale, - 10.0 * hints->y_scale / 65536.0 / 64.0 )); + 65536 * 64 / (double)hints->y_scale, + 10 * (double)hints->y_scale / 65536 / 64 )); if ( axis->num_edges ) { @@ -714,14 +714,14 @@ AF_DUMP(( " %5d %7.2f %5s %4s %5s" " %c %7.2f %7.2f %11s\n", AF_INDEX_NUM( edge, edges ), - (int)edge->opos / 64.0, + (double)(int)edge->opos / 64, af_dir_str( (AF_Direction)edge->dir ), af_print_idx( buf1, AF_INDEX_NUM( edge->link, edges ) ), af_print_idx( buf2, AF_INDEX_NUM( edge->serif, edges ) ), edge->blue_edge ? 'y' : 'n', - edge->opos / 64.0, - edge->pos / 64.0, + (double)edge->opos / 64, + (double)edge->pos / 64, af_edge_flags_to_string( edge->flags ) )); AF_DUMP(( "\n" )); } diff --git a/lib/freetype/src/autofit/afhints.h b/lib/freetype/src/autofit/afhints.h index 96001cd80..d1cf9529b 100644 --- a/lib/freetype/src/autofit/afhints.h +++ b/lib/freetype/src/autofit/afhints.h @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,8 +21,6 @@ #include "aftypes.h" -#define xxAF_SORT_SEGMENTS - FT_BEGIN_HEADER /* @@ -310,15 +308,12 @@ FT_BEGIN_HEADER typedef struct AF_AxisHintsRec_ { - FT_Int num_segments; /* number of used segments */ - FT_Int max_segments; /* number of allocated segments */ + FT_UInt num_segments; /* number of used segments */ + FT_UInt max_segments; /* number of allocated segments */ AF_Segment segments; /* segments array */ -#ifdef AF_SORT_SEGMENTS - FT_Int mid_segments; -#endif - FT_Int num_edges; /* number of used edges */ - FT_Int max_edges; /* number of allocated edges */ + FT_UInt num_edges; /* number of used edges */ + FT_UInt max_edges; /* number of allocated edges */ AF_Edge edges; /* edges array */ AF_Direction major_dir; /* either vertical or horizontal */ @@ -380,14 +375,14 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_AUTOFIT #define AF_HINTS_DO_HORIZONTAL( h ) \ - ( !_af_debug_disable_horz_hints && \ + ( !af_debug_disable_horz_hints_ && \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) ) #define AF_HINTS_DO_VERTICAL( h ) \ - ( !_af_debug_disable_vert_hints && \ + ( !af_debug_disable_vert_hints_ && \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) ) -#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints ) +#define AF_HINTS_DO_BLUES( h ) ( !af_debug_disable_blue_hints_ ) #else /* !FT_DEBUG_AUTOFIT */ diff --git a/lib/freetype/src/autofit/afindic.c b/lib/freetype/src/autofit/afindic.c index 5bf0b5f94..289a09d71 100644 --- a/lib/freetype/src/autofit/afindic.c +++ b/lib/freetype/src/autofit/afindic.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for Indic writing system (body). * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 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, @@ -49,8 +49,7 @@ af_cjk_metrics_check_digits( metrics, face ); } - FT_Set_Charmap( face, oldmap ); - + face->charmap = oldmap; return FT_Err_Ok; } diff --git a/lib/freetype/src/autofit/afindic.h b/lib/freetype/src/autofit/afindic.h index 59ae11a67..3eb67f63b 100644 --- a/lib/freetype/src/autofit/afindic.h +++ b/lib/freetype/src/autofit/afindic.h @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for Indic writing system * (specification). * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 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/lib/freetype/src/autofit/aflatin.c b/lib/freetype/src/autofit/aflatin.c index bed0ccee0..4b3c59b3c 100644 --- a/lib/freetype/src/autofit/aflatin.c +++ b/lib/freetype/src/autofit/aflatin.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for latin writing system (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1043,7 +1043,7 @@ AF_FaceGlobals globals = metrics->root.globals; FT_UShort* gstyles = globals->glyph_styles; - FT_Long i; + FT_UInt i; FT_TRACE5(( "no blue zones found:" @@ -1157,7 +1157,7 @@ } Exit: - FT_Set_Charmap( face, oldmap ); + face->charmap = oldmap; return error; } @@ -1275,8 +1275,8 @@ FT_TRACE5(( " " " vertical scaling changed" " from %.5f to %.5f (by %ld%%)\n", - scale / 65536.0, - new_scale / 65536.0, + (double)scale / 65536, + (double)new_scale / 65536, ( fitted - scaled ) * 100 / scaled )); FT_TRACE5(( "\n" )); @@ -1327,7 +1327,7 @@ FT_TRACE5(( " %ld scaled to %.2f\n", width->org, - width->cur / 64.0 )); + (double)width->cur / 64 )); } FT_TRACE5(( "\n" )); @@ -1471,13 +1471,13 @@ FT_TRACE5(( " reference %d: %ld scaled to %.2f%s\n", nn, blue->ref.org, - blue->ref.fit / 64.0, + (double)blue->ref.fit / 64, ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? "" : " (inactive)" )); FT_TRACE5(( " overshoot %d: %ld scaled to %.2f%s\n", nn, blue->shoot.org, - blue->shoot.fit / 64.0, + (double)blue->shoot.fit / 64, ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? "" : " (inactive)" )); } @@ -2203,7 +2203,7 @@ for ( seg = segments; seg < segment_limit; seg++ ) { AF_Edge found = NULL; - FT_Int ee; + FT_UInt ee; /* ignore too short segments, too wide ones, and, in this loop, */ @@ -2277,7 +2277,7 @@ for ( seg = segments; seg < segment_limit; seg++ ) { AF_Edge found = NULL; - FT_Int ee; + FT_UInt ee; if ( seg->dir != AF_DIR_NONE ) @@ -2955,8 +2955,9 @@ FT_TRACE5(( " LINK: edge %ld (opos=%.2f) linked to %.2f," " dist was %.2f, now %.2f\n", - stem_edge - hints->axis[dim].edges, stem_edge->opos / 64.0, - stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); + stem_edge - hints->axis[dim].edges, + (double)stem_edge->opos / 64, (double)stem_edge->pos / 64, + (double)dist / 64, (double)fitted_width / 64 )); } @@ -3079,13 +3080,15 @@ if ( !anchor ) FT_TRACE5(( " BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f," " was %.2f (anchor=edge %ld)\n", - edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0, - edge1->pos / 64.0, edge - edges )); + edge1 - edges, + (double)edge1->opos / 64, (double)blue->fit / 64, + (double)edge1->pos / 64, edge - edges )); else FT_TRACE5(( " BLUE: edge %ld (opos=%.2f) snapped to %.2f," " was %.2f\n", - edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0, - edge1->pos / 64.0 )); + edge1 - edges, + (double)edge1->opos / 64, (double)blue->fit / 64, + (double)edge1->pos / 64 )); num_actions++; #endif @@ -3201,9 +3204,9 @@ FT_TRACE5(( " ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)" " snapped to %.2f and %.2f\n", - edge - edges, edge->opos / 64.0, - edge2 - edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0 )); + edge - edges, (double)edge->opos / 64, + edge2 - edges, (double)edge2->opos / 64, + (double)edge->pos / 64, (double)edge2->pos / 64 )); af_latin_align_linked_edge( hints, dim, edge, edge2 ); @@ -3229,8 +3232,8 @@ if ( edge2->flags & AF_EDGE_DONE ) { FT_TRACE5(( " ADJUST: edge %ld (pos=%.2f) moved to %.2f\n", - edge - edges, edge->pos / 64.0, - ( edge2->pos - cur_len ) / 64.0 )); + edge - edges, (double)edge->pos / 64, + (double)( edge2->pos - cur_len ) / 64 )); edge->pos = edge2->pos - cur_len; } @@ -3271,9 +3274,9 @@ FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)" " snapped to %.2f and %.2f\n", - edge - edges, edge->opos / 64.0, - edge2 - edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0 )); + edge - edges, (double)edge->opos / 64, + edge2 - edges, (double)edge2->opos / 64, + (double)edge->pos / 64, (double)edge2->pos / 64 )); } else @@ -3302,9 +3305,9 @@ FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)" " snapped to %.2f and %.2f\n", - edge - edges, edge->opos / 64.0, - edge2 - edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0 )); + edge - edges, (double)edge->opos / 64, + edge2 - edges, (double)edge2->opos / 64, + (double)edge->pos / 64, (double)edge2->pos / 64 )); } #ifdef FT_DEBUG_LEVEL_TRACE @@ -3325,8 +3328,8 @@ #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n", edge - edges, - edge->pos / 64.0, - edge[-1].pos / 64.0 )); + (double)edge->pos / 64, + (double)edge[-1].pos / 64 )); num_actions++; #endif @@ -3427,9 +3430,9 @@ af_latin_align_serif_edge( hints, edge->serif, edge ); FT_TRACE5(( " SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)" " aligned to %.2f\n", - edge - edges, edge->opos / 64.0, - edge->serif - edges, edge->serif->opos / 64.0, - edge->pos / 64.0 )); + edge - edges, (double)edge->opos / 64, + edge->serif - edges, (double)edge->serif->opos / 64, + (double)edge->pos / 64 )); } else if ( !anchor ) { @@ -3437,7 +3440,8 @@ anchor = edge; FT_TRACE5(( " SERIF_ANCHOR: edge %ld (opos=%.2f)" " snapped to %.2f\n", - edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); + edge-edges, + (double)edge->opos / 64, (double)edge->pos / 64 )); } else { @@ -3465,9 +3469,9 @@ FT_TRACE5(( " SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f" " from %ld (opos=%.2f)\n", - edge - edges, edge->opos / 64.0, - edge->pos / 64.0, - before - edges, before->opos / 64.0 )); + edge - edges, (double)edge->opos / 64, + (double)edge->pos / 64, + before - edges, (double)before->opos / 64 )); } else { @@ -3475,7 +3479,8 @@ ( ( edge->opos - anchor->opos + 16 ) & ~31 ); FT_TRACE5(( " SERIF_LINK2: edge %ld (opos=%.2f)" " snapped to %.2f\n", - edge - edges, edge->opos / 64.0, edge->pos / 64.0 )); + edge - edges, + (double)edge->opos / 64, (double)edge->pos / 64 )); } } @@ -3495,8 +3500,8 @@ #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n", edge - edges, - edge->pos / 64.0, - edge[-1].pos / 64.0 )); + (double)edge->pos / 64, + (double)edge[-1].pos / 64 )); num_actions++; #endif @@ -3516,8 +3521,8 @@ #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n", edge - edges, - edge->pos / 64.0, - edge[1].pos / 64.0 )); + (double)edge->pos / 64, + (double)edge[1].pos / 64 )); num_actions++; #endif diff --git a/lib/freetype/src/autofit/aflatin.h b/lib/freetype/src/autofit/aflatin.h index facc66345..3c6a7ee4f 100644 --- a/lib/freetype/src/autofit/aflatin.h +++ b/lib/freetype/src/autofit/aflatin.h @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for latin writing system * (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afloader.c b/lib/freetype/src/autofit/afloader.c index e55183a50..c8082796f 100644 --- a/lib/freetype/src/autofit/afloader.c +++ b/lib/freetype/src/autofit/afloader.c @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -229,9 +229,6 @@ AF_WritingSystemClass writing_system_class; - if ( !size ) - return FT_THROW( Invalid_Size_Handle ); - FT_ZERO( &scaler ); if ( !size_internal->autohint_metrics.x_scale || diff --git a/lib/freetype/src/autofit/afloader.h b/lib/freetype/src/autofit/afloader.h index b345e4639..e4e197e37 100644 --- a/lib/freetype/src/autofit/afloader.h +++ b/lib/freetype/src/autofit/afloader.h @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -75,7 +75,7 @@ FT_BEGIN_HEADER FT_UInt gindex, FT_Int32 load_flags ); - FT_LOCAL_DEF( FT_Fixed ) + FT_LOCAL( FT_Fixed ) af_loader_compute_darkening( AF_Loader loader, FT_Face face, FT_Pos standard_width ); diff --git a/lib/freetype/src/autofit/afmodule.c b/lib/freetype/src/autofit/afmodule.c index 1b14ae682..92e5156ab 100644 --- a/lib/freetype/src/autofit/afmodule.c +++ b/lib/freetype/src/autofit/afmodule.c @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -43,14 +43,14 @@ #endif - int _af_debug_disable_horz_hints; - int _af_debug_disable_vert_hints; - int _af_debug_disable_blue_hints; + int af_debug_disable_horz_hints_; + int af_debug_disable_vert_hints_; + int af_debug_disable_blue_hints_; /* we use a global object instead of a local one for debugging */ - static AF_GlyphHintsRec _af_debug_hints_rec[1]; + static AF_GlyphHintsRec af_debug_hints_rec_[1]; - void* _af_debug_hints = _af_debug_hints_rec; + void* af_debug_hints_ = af_debug_hints_rec_; #endif #include <freetype/internal/ftobjs.h> @@ -119,8 +119,8 @@ if ( !ft_strcmp( property_name, "fallback-script" ) ) { - FT_UInt* fallback_script; - FT_UInt ss; + AF_Script* fallback_script; + FT_UInt ss; #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES @@ -128,7 +128,7 @@ return FT_THROW( Invalid_Argument ); #endif - fallback_script = (FT_UInt*)value; + fallback_script = (AF_Script*)value; /* We translate the fallback script to a fallback style that uses */ /* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */ @@ -138,8 +138,8 @@ AF_StyleClass style_class = af_style_classes[ss]; - if ( (FT_UInt)style_class->script == *fallback_script && - style_class->coverage == AF_COVERAGE_DEFAULT ) + if ( style_class->script == *fallback_script && + style_class->coverage == AF_COVERAGE_DEFAULT ) { module->fallback_style = ss; break; @@ -157,7 +157,7 @@ } else if ( !ft_strcmp( property_name, "default-script" ) ) { - FT_UInt* default_script; + AF_Script* default_script; #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES @@ -165,7 +165,7 @@ return FT_THROW( Invalid_Argument ); #endif - default_script = (FT_UInt*)value; + default_script = (AF_Script*)value; module->default_script = *default_script; @@ -291,8 +291,6 @@ { FT_Error error = FT_Err_Ok; AF_Module module = (AF_Module)ft_module; - FT_UInt fallback_style = module->fallback_style; - FT_UInt default_script = module->default_script; if ( !ft_strcmp( property_name, "glyph-to-script-map" ) ) @@ -309,9 +307,9 @@ } else if ( !ft_strcmp( property_name, "fallback-script" ) ) { - FT_UInt* val = (FT_UInt*)value; + AF_Script* val = (AF_Script*)value; - AF_StyleClass style_class = af_style_classes[fallback_style]; + AF_StyleClass style_class = af_style_classes[module->fallback_style]; *val = style_class->script; @@ -320,10 +318,10 @@ } else if ( !ft_strcmp( property_name, "default-script" ) ) { - FT_UInt* val = (FT_UInt*)value; + AF_Script* val = (AF_Script*)value; - *val = default_script; + *val = module->default_script; return error; } @@ -425,8 +423,8 @@ FT_UNUSED( ft_module ); #ifdef FT_DEBUG_AUTOFIT - if ( _af_debug_hints_rec->memory ) - af_glyph_hints_done( _af_debug_hints_rec ); + if ( af_debug_hints_rec_->memory ) + af_glyph_hints_done( af_debug_hints_rec_ ); #endif } @@ -445,7 +443,7 @@ /* in debug mode, we use a global object that survives this routine */ - AF_GlyphHints hints = _af_debug_hints_rec; + AF_GlyphHints hints = af_debug_hints_rec_; AF_LoaderRec loader[1]; FT_UNUSED( size ); diff --git a/lib/freetype/src/autofit/afmodule.h b/lib/freetype/src/autofit/afmodule.h index 1d1bfaf54..4b8b4562c 100644 --- a/lib/freetype/src/autofit/afmodule.h +++ b/lib/freetype/src/autofit/afmodule.h @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (specification). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -36,7 +36,7 @@ FT_BEGIN_HEADER FT_ModuleRec root; FT_UInt fallback_style; - FT_UInt default_script; + AF_Script default_script; FT_Bool no_stem_darkening; FT_Int darken_params[8]; diff --git a/lib/freetype/src/autofit/afranges.c b/lib/freetype/src/autofit/afranges.c index 2de1991a5..cfcaf340a 100644 --- a/lib/freetype/src/autofit/afranges.c +++ b/lib/freetype/src/autofit/afranges.c @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (body). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afranges.h b/lib/freetype/src/autofit/afranges.h index acd01faf6..5775738bc 100644 --- a/lib/freetype/src/autofit/afranges.h +++ b/lib/freetype/src/autofit/afranges.h @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (specification). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afscript.h b/lib/freetype/src/autofit/afscript.h index 172b59806..3a101937d 100644 --- a/lib/freetype/src/autofit/afscript.h +++ b/lib/freetype/src/autofit/afscript.h @@ -4,7 +4,7 @@ * * Auto-fitter scripts (specification only). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afshaper.c b/lib/freetype/src/autofit/afshaper.c index 298480d86..1b8b870e8 100644 --- a/lib/freetype/src/autofit/afshaper.c +++ b/lib/freetype/src/autofit/afshaper.c @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (body). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afshaper.h b/lib/freetype/src/autofit/afshaper.h index 558f03bde..054a18ffb 100644 --- a/lib/freetype/src/autofit/afshaper.h +++ b/lib/freetype/src/autofit/afshaper.h @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (specification). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -27,7 +27,7 @@ #include <hb.h> #include <hb-ot.h> -#include <hb-ft.h> +#include "ft-hb.h" #endif diff --git a/lib/freetype/src/autofit/afstyles.h b/lib/freetype/src/autofit/afstyles.h index 9080b9fb6..73ebef017 100644 --- a/lib/freetype/src/autofit/afstyles.h +++ b/lib/freetype/src/autofit/afstyles.h @@ -4,7 +4,7 @@ * * Auto-fitter styles (specification only). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/aftypes.h b/lib/freetype/src/autofit/aftypes.h index 754aad7ba..661519449 100644 --- a/lib/freetype/src/autofit/aftypes.h +++ b/lib/freetype/src/autofit/aftypes.h @@ -4,7 +4,7 @@ * * Auto-fitter types (specification only). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -57,10 +57,10 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_AUTOFIT -extern int _af_debug_disable_horz_hints; -extern int _af_debug_disable_vert_hints; -extern int _af_debug_disable_blue_hints; -extern void* _af_debug_hints; +extern int af_debug_disable_horz_hints_; +extern int af_debug_disable_vert_hints_; +extern int af_debug_disable_blue_hints_; +extern void* af_debug_hints_; #endif /* FT_DEBUG_AUTOFIT */ @@ -119,13 +119,13 @@ extern void* _af_debug_hints; typedef struct AF_ScalerRec_ { - FT_Face face; /* source font face */ - FT_Fixed x_scale; /* from font units to 1/64th device pixels */ - FT_Fixed y_scale; /* from font units to 1/64th device pixels */ - FT_Pos x_delta; /* in 1/64th device pixels */ - FT_Pos y_delta; /* in 1/64th device pixels */ - FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc. */ - FT_UInt32 flags; /* additional control flags, see above */ + FT_Face face; /* source font face */ + FT_Fixed x_scale; /* from font units to 1/64 device pixels */ + FT_Fixed y_scale; /* from font units to 1/64 device pixels */ + FT_Pos x_delta; /* in 1/64 device pixels */ + FT_Pos y_delta; /* in 1/64 device pixels */ + FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc. */ + FT_UInt32 flags; /* additional control flags, see above */ } AF_ScalerRec, *AF_Scaler; diff --git a/lib/freetype/src/autofit/afws-decl.h b/lib/freetype/src/autofit/afws-decl.h index c93845ef9..48c888afe 100644 --- a/lib/freetype/src/autofit/afws-decl.h +++ b/lib/freetype/src/autofit/afws-decl.h @@ -4,7 +4,7 @@ * * Auto-fitter writing system declarations (specification only). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/afws-iter.h b/lib/freetype/src/autofit/afws-iter.h index 9cda3509b..a0a686f8c 100644 --- a/lib/freetype/src/autofit/afws-iter.h +++ b/lib/freetype/src/autofit/afws-iter.h @@ -4,7 +4,7 @@ * * Auto-fitter writing systems iterator (specification only). * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/autofit/autofit.c b/lib/freetype/src/autofit/autofit.c index 3d78a9b33..8bd609b5e 100644 --- a/lib/freetype/src/autofit/autofit.c +++ b/lib/freetype/src/autofit/autofit.c @@ -4,7 +4,7 @@ * * Auto-fitter module (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -18,6 +18,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT +#include "ft-hb.c" #include "afblue.c" #include "afcjk.c" #include "afdummy.c" diff --git a/lib/freetype/src/autofit/ft-hb.c b/lib/freetype/src/autofit/ft-hb.c new file mode 100644 index 000000000..09a8401c4 --- /dev/null +++ b/lib/freetype/src/autofit/ft-hb.c @@ -0,0 +1,115 @@ +/* + * 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.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; + + 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 * +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); + } + + 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 *) +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; +} + +#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ + +/* ANSI C doesn't like empty source files */ +typedef int _ft_hb_dummy; + +#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ + +/* END */ diff --git a/lib/freetype/src/autofit/ft-hb.h b/lib/freetype/src/autofit/ft-hb.h new file mode 100644 index 000000000..92a5774bc --- /dev/null +++ b/lib/freetype/src/autofit/ft-hb.h @@ -0,0 +1,48 @@ +/* + * 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_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); + + +FT_END_HEADER + +#endif /* FT_HB_H */ + + +/* END */ diff --git a/lib/freetype/src/autofit/module.mk b/lib/freetype/src/autofit/module.mk index 1d7eda304..95cb20ad2 100644 --- a/lib/freetype/src/autofit/module.mk +++ b/lib/freetype/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2022 by +# Copyright (C) 2003-2023 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/lib/freetype/src/autofit/rules.mk b/lib/freetype/src/autofit/rules.mk index 11ef60717..a46ba3f0f 100644 --- a/lib/freetype/src/autofit/rules.mk +++ b/lib/freetype/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2022 by +# Copyright (C) 2003-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -39,6 +39,7 @@ 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 driver headers # diff --git a/lib/freetype/src/base/ftadvanc.c b/lib/freetype/src/base/ftadvanc.c index fc6b42881..de25476fe 100644 --- a/lib/freetype/src/base/ftadvanc.c +++ b/lib/freetype/src/base/ftadvanc.c @@ -4,7 +4,7 @@ * * Quick computation of advance widths (body). * - * Copyright (C) 2008-2022 by + * Copyright (C) 2008-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -23,7 +23,7 @@ static FT_Error - _ft_face_scale_advances( FT_Face face, + ft_face_scale_advances_( FT_Face face, FT_Fixed* advances, FT_UInt count, FT_Int32 flags ) @@ -96,7 +96,7 @@ error = func( face, gindex, 1, flags, padvance ); if ( !error ) - return _ft_face_scale_advances( face, padvance, 1, flags ); + return ft_face_scale_advances_( face, padvance, 1, flags ); if ( FT_ERR_NEQ( error, Unimplemented_Feature ) ) return error; @@ -142,7 +142,7 @@ { error = func( face, start, count, flags, padvances ); if ( !error ) - return _ft_face_scale_advances( face, padvances, count, flags ); + return ft_face_scale_advances_( face, padvances, count, flags ); if ( FT_ERR_NEQ( error, Unimplemented_Feature ) ) return error; diff --git a/lib/freetype/src/base/ftbase.c b/lib/freetype/src/base/ftbase.c index cd1056890..156510f00 100644 --- a/lib/freetype/src/base/ftbase.c +++ b/lib/freetype/src/base/ftbase.c @@ -4,7 +4,7 @@ * * Single object library component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftbase.h b/lib/freetype/src/base/ftbase.h index f873566f2..00790d3b2 100644 --- a/lib/freetype/src/base/ftbase.h +++ b/lib/freetype/src/base/ftbase.h @@ -4,7 +4,7 @@ * * Private functions used in the `base' module (specification). * - * Copyright (C) 2008-2022 by + * Copyright (C) 2008-2023 by * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftbbox.c b/lib/freetype/src/base/ftbbox.c index 30aedf780..7dd71882e 100644 --- a/lib/freetype/src/base/ftbbox.c +++ b/lib/freetype/src/base/ftbbox.c @@ -4,7 +4,7 @@ * * FreeType bbox computation (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/lib/freetype/src/base/ftbdf.c b/lib/freetype/src/base/ftbdf.c index 4f22113d7..f697c00fe 100644 --- a/lib/freetype/src/base/ftbdf.c +++ b/lib/freetype/src/base/ftbdf.c @@ -4,7 +4,7 @@ * * FreeType API for accessing BDF-specific strings (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftbitmap.c b/lib/freetype/src/base/ftbitmap.c index 7825895ad..1c93648dc 100644 --- a/lib/freetype/src/base/ftbitmap.c +++ b/lib/freetype/src/base/ftbitmap.c @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -66,11 +66,8 @@ { FT_Memory memory; FT_Error error = FT_Err_Ok; - - FT_Int pitch; - FT_ULong size; - - FT_Int source_pitch_sign, target_pitch_sign; + FT_Int pitch; + FT_Int flip; if ( !library ) @@ -82,53 +79,29 @@ if ( source == target ) return FT_Err_Ok; - source_pitch_sign = source->pitch < 0 ? -1 : 1; - target_pitch_sign = target->pitch < 0 ? -1 : 1; + flip = ( source->pitch < 0 && target->pitch > 0 ) || + ( source->pitch > 0 && target->pitch < 0 ); - if ( !source->buffer ) - { - *target = *source; - if ( source_pitch_sign != target_pitch_sign ) - target->pitch = -target->pitch; + memory = library->memory; + FT_FREE( target->buffer ); + + *target = *source; + + if ( flip ) + target->pitch = -target->pitch; + if ( !source->buffer ) return FT_Err_Ok; - } - memory = library->memory; pitch = source->pitch; - if ( pitch < 0 ) pitch = -pitch; - size = (FT_ULong)pitch * source->rows; - - if ( target->buffer ) - { - FT_Int target_pitch = target->pitch; - FT_ULong target_size; - - if ( target_pitch < 0 ) - target_pitch = -target_pitch; - target_size = (FT_ULong)target_pitch * target->rows; - - if ( target_size != size ) - FT_MEM_QREALLOC( target->buffer, target_size, size ); - } - else - FT_MEM_QALLOC( target->buffer, size ); + FT_MEM_QALLOC_MULT( target->buffer, target->rows, pitch ); if ( !error ) { - unsigned char *p; - - - p = target->buffer; - *target = *source; - target->buffer = p; - - if ( source_pitch_sign == target_pitch_sign ) - FT_MEM_COPY( target->buffer, source->buffer, size ); - else + if ( flip ) { /* take care of bitmap flow */ FT_UInt i; @@ -146,6 +119,9 @@ t -= pitch; } } + else + FT_MEM_COPY( target->buffer, source->buffer, + (FT_Long)source->rows * pitch ); } return error; @@ -542,39 +518,31 @@ case FT_PIXEL_MODE_LCD_V: case FT_PIXEL_MODE_BGRA: { - FT_Int pad, old_target_pitch, target_pitch; - FT_ULong old_size; + FT_Int width = (FT_Int)source->width; + FT_Int neg = ( target->pitch == 0 && source->pitch < 0 ) || + target->pitch < 0; - old_target_pitch = target->pitch; - if ( old_target_pitch < 0 ) - old_target_pitch = -old_target_pitch; - - old_size = target->rows * (FT_UInt)old_target_pitch; + FT_Bitmap_Done( library, target ); target->pixel_mode = FT_PIXEL_MODE_GRAY; target->rows = source->rows; target->width = source->width; - pad = 0; - if ( alignment > 0 ) + if ( alignment ) { - pad = (FT_Int)source->width % alignment; - if ( pad != 0 ) - pad = alignment - pad; - } + FT_Int rem = width % alignment; - target_pitch = (FT_Int)source->width + pad; - if ( target_pitch > 0 && - (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch ) - return FT_THROW( Invalid_Argument ); + if ( rem ) + width = alignment > 0 ? width - rem + alignment + : width - rem - alignment; + } - if ( FT_QREALLOC( target->buffer, - old_size, target->rows * (FT_UInt)target_pitch ) ) + if ( FT_QALLOC_MULT( target->buffer, target->rows, width ) ) return error; - target->pitch = target->pitch < 0 ? -target_pitch : target_pitch; + target->pitch = neg ? -width : width; } break; diff --git a/lib/freetype/src/base/ftcalc.c b/lib/freetype/src/base/ftcalc.c index 6c1e7fbd4..13e74f335 100644 --- a/lib/freetype/src/base/ftcalc.c +++ b/lib/freetype/src/base/ftcalc.c @@ -4,7 +4,7 @@ * * Arithmetic computations (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1085,4 +1085,71 @@ } + FT_BASE_DEF( FT_Int32 ) + FT_MulAddFix( FT_Fixed* s, + FT_Int32* f, + FT_UInt count ) + { + FT_UInt i; + FT_Int64 temp; +#ifndef FT_INT64 + FT_Int64 halfUnit; +#endif + + +#ifdef FT_INT64 + temp = 0; + + for ( i = 0; i < count; ++i ) + temp += (FT_Int64)s[i] * f[i]; + + return ( 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; + + + scalar = (FT_UInt32)s[i]; + factor = (FT_UInt32)f[i]; + + FT_MOVE_SIGN( s[i], scalar, sign ); + FT_MOVE_SIGN( f[i], factor, sign ); + + ft_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 ); + } + + /* Round value. */ + halfUnit.hi = 0; + halfUnit.lo = 0x8000; + FT_Add64( &temp, &halfUnit, &temp ); + + return (FT_Int32)( ( (FT_Int32)( temp.hi & 0xFFFF ) << 16 ) | + ( temp.lo >> 16 ) ); + +#endif /* !FT_INT64 */ + + } + + /* END */ diff --git a/lib/freetype/src/base/ftcid.c b/lib/freetype/src/base/ftcid.c index b882ca3de..866cd23e9 100644 --- a/lib/freetype/src/base/ftcid.c +++ b/lib/freetype/src/base/ftcid.c @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information. * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftcolor.c b/lib/freetype/src/base/ftcolor.c index 0edf379b4..bcd6e893d 100644 --- a/lib/freetype/src/base/ftcolor.c +++ b/lib/freetype/src/base/ftcolor.c @@ -4,7 +4,7 @@ * * FreeType's glyph color management (body). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftdbgmem.c b/lib/freetype/src/base/ftdbgmem.c index 1df83c404..6730c4c8d 100644 --- a/lib/freetype/src/base/ftdbgmem.c +++ b/lib/freetype/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ * * Memory debugger (body). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -35,8 +35,8 @@ #include FT_CONFIG_STANDARD_LIBRARY_H - FT_BASE_DEF( const char* ) _ft_debug_file = NULL; - FT_BASE_DEF( long ) _ft_debug_lineno = 0; + FT_BASE_DEF( const char* ) ft_debug_file_ = NULL; + FT_BASE_DEF( long ) ft_debug_lineno_ = 0; extern void FT_DumpMemory( FT_Memory memory ); @@ -415,8 +415,8 @@ /* cast to FT_PtrDist first since void* can be larger */ /* than FT_UInt32 and GCC 4.1.1 emits a warning */ - hash = (FT_UInt32)(FT_PtrDist)(void*)_ft_debug_file + - (FT_UInt32)( 5 * _ft_debug_lineno ); + hash = (FT_UInt32)(FT_PtrDist)(void*)ft_debug_file_ + + (FT_UInt32)( 5 * ft_debug_lineno_ ); pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS]; for (;;) @@ -425,8 +425,8 @@ if ( !node ) break; - if ( node->file_name == _ft_debug_file && - node->line_no == _ft_debug_lineno ) + if ( node->file_name == ft_debug_file_ && + node->line_no == ft_debug_lineno_ ) goto Exit; pnode = &node->link; @@ -437,8 +437,8 @@ ft_mem_debug_panic( "not enough memory to perform memory debugging\n" ); - node->file_name = _ft_debug_file; - node->line_no = _ft_debug_lineno; + node->file_name = ft_debug_file_; + node->line_no = ft_debug_lineno_; node->cur_blocks = 0; node->max_blocks = 0; @@ -495,7 +495,7 @@ "org=%s:%d new=%s:%d\n", node->address, node->size, FT_FILENAME( node->source->file_name ), node->source->line_no, - FT_FILENAME( _ft_debug_file ), _ft_debug_lineno ); + FT_FILENAME( ft_debug_file_ ), ft_debug_lineno_ ); } } @@ -582,7 +582,7 @@ " Block was allocated at (%s:%ld)\n" " and released at (%s:%ld).", address, - FT_FILENAME( _ft_debug_file ), _ft_debug_lineno, + FT_FILENAME( ft_debug_file_ ), ft_debug_lineno_, FT_FILENAME( node->source->file_name ), node->source->line_no, FT_FILENAME( node->free_file_name ), node->free_line_no ); @@ -604,8 +604,8 @@ /* we simply invert the node's size to indicate that the node */ /* was freed. */ node->size = -node->size; - node->free_file_name = _ft_debug_file; - node->free_line_no = _ft_debug_lineno; + node->free_file_name = ft_debug_file_; + node->free_line_no = ft_debug_lineno_; } else { @@ -627,7 +627,7 @@ ft_mem_debug_panic( "trying to free unknown block at %p in (%s:%ld)\n", address, - FT_FILENAME( _ft_debug_file ), _ft_debug_lineno ); + FT_FILENAME( ft_debug_file_ ), ft_debug_lineno_ ); } } @@ -661,8 +661,8 @@ table->alloc_count++; } - _ft_debug_file = "<unknown>"; - _ft_debug_lineno = 0; + ft_debug_file_ = "<unknown>"; + ft_debug_lineno_ = 0; return (FT_Pointer)block; } @@ -677,8 +677,8 @@ if ( !block ) ft_mem_debug_panic( "trying to free NULL in (%s:%ld)", - FT_FILENAME( _ft_debug_file ), - _ft_debug_lineno ); + FT_FILENAME( ft_debug_file_ ), + ft_debug_lineno_ ); ft_mem_table_remove( table, (FT_Byte*)block, 0 ); @@ -687,8 +687,8 @@ table->alloc_count--; - _ft_debug_file = "<unknown>"; - _ft_debug_lineno = 0; + ft_debug_file_ = "<unknown>"; + ft_debug_lineno_ = 0; } @@ -703,8 +703,8 @@ FT_Pointer new_block; FT_Long delta; - const char* file_name = FT_FILENAME( _ft_debug_file ); - FT_Long line_no = _ft_debug_lineno; + const char* file_name = FT_FILENAME( ft_debug_file_ ); + FT_Long line_no = ft_debug_lineno_; /* unlikely, but possible */ @@ -767,8 +767,8 @@ ft_mem_table_remove( table, (FT_Byte*)block, delta ); - _ft_debug_file = "<unknown>"; - _ft_debug_lineno = 0; + ft_debug_file_ = "<unknown>"; + ft_debug_lineno_ = 0; if ( !table->keep_alive ) ft_mem_table_free( table, block ); @@ -874,7 +874,7 @@ } - static int + FT_COMPARE_DEF( int ) ft_mem_source_compare( const void* p1, const void* p2 ) { diff --git a/lib/freetype/src/base/ftdebug.c b/lib/freetype/src/base/ftdebug.c index 648fff44e..61c4563b0 100644 --- a/lib/freetype/src/base/ftdebug.c +++ b/lib/freetype/src/base/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/fterrors.c b/lib/freetype/src/base/fterrors.c index 5846fefc9..5ad9709c8 100644 --- a/lib/freetype/src/base/fterrors.c +++ b/lib/freetype/src/base/fterrors.c @@ -4,7 +4,7 @@ * * FreeType API for error code handling. * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2023 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/lib/freetype/src/base/ftfntfmt.c b/lib/freetype/src/base/ftfntfmt.c index e69c1e068..0b41f7cc8 100644 --- a/lib/freetype/src/base/ftfntfmt.c +++ b/lib/freetype/src/base/ftfntfmt.c @@ -4,7 +4,7 @@ * * FreeType utility file for font formats (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftfstype.c b/lib/freetype/src/base/ftfstype.c index 009d58c57..ea24e64c6 100644 --- a/lib/freetype/src/base/ftfstype.c +++ b/lib/freetype/src/base/ftfstype.c @@ -4,7 +4,7 @@ * * FreeType utility file to access FSType data (body). * - * Copyright (C) 2008-2022 by + * Copyright (C) 2008-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftgasp.c b/lib/freetype/src/base/ftgasp.c index 7567e3077..29b7b08b7 100644 --- a/lib/freetype/src/base/ftgasp.c +++ b/lib/freetype/src/base/ftgasp.c @@ -4,7 +4,7 @@ * * Access of TrueType's `gasp' table (body). * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftgloadr.c b/lib/freetype/src/base/ftgloadr.c index f05abdee8..9823d09e4 100644 --- a/lib/freetype/src/base/ftgloadr.c +++ b/lib/freetype/src/base/ftgloadr.c @@ -4,7 +4,7 @@ * * The FreeType glyph loader (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, @@ -212,12 +212,12 @@ FT_Outline* current = &loader->current.outline; FT_Bool adjust = 0; - FT_UInt new_max, old_max; + FT_UInt new_max, old_max, min_new_max; error = FT_GlyphLoader_CreateExtra( loader ); if ( error ) - return error; + goto Exit; /* check points & tags */ new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points + @@ -226,10 +226,18 @@ if ( new_max > old_max ) { - new_max = FT_PAD_CEIL( new_max, 8 ); + if ( new_max > FT_OUTLINE_POINTS_MAX ) + { + error = FT_THROW( Array_Too_Large ); + goto Exit; + } + min_new_max = old_max + ( old_max >> 1 ); + if ( new_max < min_new_max ) + new_max = min_new_max; + new_max = FT_PAD_CEIL( new_max, 8 ); if ( new_max > FT_OUTLINE_POINTS_MAX ) - return FT_THROW( Array_Too_Large ); + new_max = FT_OUTLINE_POINTS_MAX; if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) || FT_RENEW_ARRAY( base->tags, old_max, new_max ) ) @@ -254,7 +262,7 @@ error = FT_GlyphLoader_CreateExtra( loader ); if ( error ) - return error; + goto Exit; /* check contours */ old_max = loader->max_contours; @@ -262,10 +270,18 @@ n_contours; if ( new_max > old_max ) { - new_max = FT_PAD_CEIL( new_max, 4 ); + if ( new_max > FT_OUTLINE_CONTOURS_MAX ) + { + error = FT_THROW( Array_Too_Large ); + goto Exit; + } + min_new_max = old_max + ( old_max >> 1 ); + if ( new_max < min_new_max ) + new_max = min_new_max; + new_max = FT_PAD_CEIL( new_max, 4 ); if ( new_max > FT_OUTLINE_CONTOURS_MAX ) - return FT_THROW( Array_Too_Large ); + new_max = FT_OUTLINE_CONTOURS_MAX; if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) ) goto Exit; diff --git a/lib/freetype/src/base/ftglyph.c b/lib/freetype/src/base/ftglyph.c index 571dca1a9..393d4949f 100644 --- a/lib/freetype/src/base/ftglyph.c +++ b/lib/freetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -682,7 +682,10 @@ Exit2: /* if an error occurred, destroy the glyph */ if ( error ) + { FT_Done_Glyph( glyph ); + *aglyph = NULL; + } else *aglyph = glyph; diff --git a/lib/freetype/src/base/ftgxval.c b/lib/freetype/src/base/ftgxval.c index 5598a11c6..6b3c5d248 100644 --- a/lib/freetype/src/base/ftgxval.c +++ b/lib/freetype/src/base/ftgxval.c @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * Masatake YAMATO, Redhat K.K, * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/base/ftinit.c b/lib/freetype/src/base/ftinit.c index 0f29a6017..c9c71d24b 100644 --- a/lib/freetype/src/base/ftinit.c +++ b/lib/freetype/src/base/ftinit.c @@ -4,7 +4,7 @@ * * FreeType initialization layer (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftlcdfil.c b/lib/freetype/src/base/ftlcdfil.c index e72f6d668..6c3fd66e0 100644 --- a/lib/freetype/src/base/ftlcdfil.c +++ b/lib/freetype/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ * * FreeType API for color filtering of subpixel bitmap glyphs (body). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftmac.c b/lib/freetype/src/base/ftmac.c index 21f1894ad..de34e834f 100644 --- a/lib/freetype/src/base/ftmac.c +++ b/lib/freetype/src/base/ftmac.c @@ -8,7 +8,7 @@ * This file is for Mac OS X only; see builds/mac/ftoldmac.c for * classic platforms built by MPW. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -67,6 +67,7 @@ #include <freetype/freetype.h> #include <freetype/tttags.h> +#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftstream.h> #include "ftbase.h" diff --git a/lib/freetype/src/base/ftmm.c b/lib/freetype/src/base/ftmm.c index dbbd87c9b..a2b4bd03d 100644 --- a/lib/freetype/src/base/ftmm.c +++ b/lib/freetype/src/base/ftmm.c @@ -4,7 +4,7 @@ * * Multiple Master font support (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftobjs.c b/lib/freetype/src/base/ftobjs.c index eeda69c3e..ad6ef0ae1 100644 --- a/lib/freetype/src/base/ftobjs.c +++ b/lib/freetype/src/base/ftobjs.c @@ -4,7 +4,7 @@ * * The FreeType private base classes (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -508,7 +508,7 @@ case FT_PIXEL_MODE_LCD_V: height *= 3; - /* fall through */ + FALL_THROUGH; case FT_PIXEL_MODE_GRAY: default: @@ -605,7 +605,7 @@ FT_FREE( doc->svg_document ); - slot->internal->load_flags &= ~FT_GLYPH_OWN_GZIP_SVG; + slot->internal->flags &= ~FT_GLYPH_OWN_GZIP_SVG; } } #endif @@ -631,8 +631,9 @@ #ifdef FT_CONFIG_OPTION_SVG if ( slot->face->face_flags & FT_FACE_FLAG_SVG ) { - /* free memory in case SVG was there */ - if ( slot->internal->flags & FT_GLYPH_OWN_GZIP_SVG ) + /* Free memory in case SVG was there. */ + /* `slot->internal` might be NULL in out-of-memory situations. */ + if ( slot->internal && slot->internal->flags & FT_GLYPH_OWN_GZIP_SVG ) { FT_SVG_Document doc = (FT_SVG_Document)slot->other; @@ -1184,28 +1185,34 @@ pixel_modes[slot->bitmap.pixel_mode], slot->bitmap.pixel_mode )); FT_TRACE5(( "\n" )); - FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 )); - FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 )); + FT_TRACE5(( " x advance: %f\n", (double)slot->advance.x / 64 )); + FT_TRACE5(( " y advance: %f\n", (double)slot->advance.y / 64 )); FT_TRACE5(( " linear x advance: %f\n", - slot->linearHoriAdvance / 65536.0 )); + (double)slot->linearHoriAdvance / 65536 )); FT_TRACE5(( " linear y advance: %f\n", - slot->linearVertAdvance / 65536.0 )); + (double)slot->linearVertAdvance / 65536 )); { FT_Glyph_Metrics* metrics = &slot->metrics; FT_TRACE5(( " metrics:\n" )); - FT_TRACE5(( " width: %f\n", metrics->width / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " width: %f\n", (double)metrics->width / 64 )); + FT_TRACE5(( " height: %f\n", (double)metrics->height / 64 )); FT_TRACE5(( "\n" )); - FT_TRACE5(( " horiBearingX: %f\n", metrics->horiBearingX / 64.0 )); - FT_TRACE5(( " horiBearingY: %f\n", metrics->horiBearingY / 64.0 )); - FT_TRACE5(( " horiAdvance: %f\n", metrics->horiAdvance / 64.0 )); + FT_TRACE5(( " horiBearingX: %f\n", + (double)metrics->horiBearingX / 64 )); + FT_TRACE5(( " horiBearingY: %f\n", + (double)metrics->horiBearingY / 64 )); + FT_TRACE5(( " horiAdvance: %f\n", + (double)metrics->horiAdvance / 64 )); FT_TRACE5(( "\n" )); - FT_TRACE5(( " vertBearingX: %f\n", metrics->vertBearingX / 64.0 )); - FT_TRACE5(( " vertBearingY: %f\n", metrics->vertBearingY / 64.0 )); - FT_TRACE5(( " vertAdvance: %f\n", metrics->vertAdvance / 64.0 )); + FT_TRACE5(( " vertBearingX: %f\n", + (double)metrics->vertBearingX / 64 )); + FT_TRACE5(( " vertBearingY: %f\n", + (double)metrics->vertBearingY / 64 )); + FT_TRACE5(( " vertAdvance: %f\n", + (double)metrics->vertAdvance / 64 )); } #endif @@ -1488,7 +1495,7 @@ static FT_Error open_face( FT_Driver driver, FT_Stream *astream, - FT_Bool external_stream, + FT_Bool *anexternal_stream, FT_Long face_index, FT_Int num_params, FT_Parameter* params, @@ -1514,7 +1521,7 @@ face->stream = *astream; /* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */ - if ( external_stream ) + if ( *anexternal_stream ) face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM; if ( FT_NEW( internal ) ) @@ -1544,7 +1551,10 @@ (FT_Int)face_index, num_params, params ); - *astream = face->stream; /* Stream may have been changed. */ + /* Stream may have been changed. */ + *astream = face->stream; + *anexternal_stream = + ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0; if ( error ) goto Fail; @@ -1668,13 +1678,13 @@ static void memory_stream_close( FT_Stream stream ) { - FT_Memory memory = stream->memory; + FT_Memory memory = (FT_Memory)stream->descriptor.pointer; FT_FREE( stream->base ); - stream->size = 0; stream->close = NULL; + FT_FREE( stream ); } @@ -1705,7 +1715,8 @@ FT_Stream_OpenMemory( stream, base, size ); - stream->close = close; + stream->descriptor.pointer = memory; + stream->close = close; *astream = stream; @@ -1726,28 +1737,36 @@ { FT_Open_Args args; FT_Error error; - FT_Stream stream = NULL; FT_Memory memory = library->memory; + args.flags = 0; + + if ( driver_name ) + { + args.driver = FT_Get_Module( library, driver_name ); + if ( !args.driver ) + { + FT_FREE( base ); + return FT_THROW( Missing_Module ); + } + + args.flags = args.flags | FT_OPEN_DRIVER; + } + + /* `memory_stream_close` also frees the stream object. */ error = new_memory_stream( library, base, size, memory_stream_close, - &stream ); + &args.stream ); if ( error ) { FT_FREE( base ); return error; } - args.flags = FT_OPEN_STREAM; - args.stream = stream; - if ( driver_name ) - { - args.flags = args.flags | FT_OPEN_DRIVER; - args.driver = FT_Get_Module( library, driver_name ); - } + args.flags |= FT_OPEN_STREAM; #ifdef FT_MACINTOSH /* At this point, the face index has served its purpose; */ @@ -1759,21 +1778,7 @@ face_index &= 0x7FFF0000L; /* retain GX data */ #endif - error = ft_open_face_internal( library, &args, face_index, aface, 0 ); - - if ( !error ) - (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; - else -#ifdef FT_MACINTOSH - FT_Stream_Free( stream, 0 ); -#else - { - FT_Stream_Close( stream ); - FT_FREE( stream ); - } -#endif - - return error; + return ft_open_face_internal( library, &args, face_index, aface, 0 ); } @@ -1916,7 +1921,7 @@ sfnt_ps, length, FT_MIN( face_index, 0 ), - is_sfnt_cid ? "cid" : "type1", + is_sfnt_cid ? "t1cid" : "type1", aface ); Exit: { @@ -2177,7 +2182,7 @@ FT_Byte* sfnt_data = NULL; FT_Error error; FT_ULong flag_offset; - FT_Long rlen; + FT_ULong rlen; int is_cff; FT_Long face_index_in_resource = 0; @@ -2192,11 +2197,11 @@ if ( error ) goto Exit; - if ( FT_READ_LONG( rlen ) ) + if ( FT_READ_ULONG( rlen ) ) goto Exit; - if ( rlen < 1 ) + if ( !rlen ) return FT_THROW( Cannot_Open_Resource ); - if ( (FT_ULong)rlen > FT_MAC_RFORK_MAX_LEN ) + if ( rlen > FT_MAC_RFORK_MAX_LEN ) return FT_THROW( Invalid_Offset ); error = open_face_PS_from_sfnt_stream( library, @@ -2214,8 +2219,9 @@ if ( FT_QALLOC( sfnt_data, rlen ) ) return error; - error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, (FT_ULong)rlen ); - if ( error ) { + error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen ); + if ( error ) + { FT_FREE( sfnt_data ); goto Exit; } @@ -2223,7 +2229,7 @@ is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 ); error = open_face_from_buffer( library, sfnt_data, - (FT_ULong)rlen, + rlen, face_index_in_resource, is_cff ? "cff" : "truetype", aface ); @@ -2552,7 +2558,7 @@ /* test for valid `library' delayed to `FT_Stream_New' */ - if ( ( !aface && face_index >= 0 ) || !args ) + if ( !args ) return FT_THROW( Invalid_Argument ); external_stream = FT_BOOL( ( args->flags & FT_OPEN_STREAM ) && @@ -2563,6 +2569,14 @@ if ( error ) goto Fail3; + /* Do this error check after `FT_Stream_New` to ensure that the */ + /* 'close' callback is called. */ + if ( !aface && face_index >= 0 ) + { + error = FT_THROW( Invalid_Argument ); + goto Fail3; + } + memory = library->memory; /* If the font driver is specified in the `args' structure, use */ @@ -2584,7 +2598,7 @@ params = args->params; } - error = open_face( driver, &stream, external_stream, face_index, + error = open_face( driver, &stream, &external_stream, face_index, num_params, params, &face ); if ( !error ) goto Success; @@ -2620,7 +2634,7 @@ params = args->params; } - error = open_face( driver, &stream, external_stream, face_index, + error = open_face( driver, &stream, &external_stream, face_index, num_params, params, &face ); if ( !error ) goto Success; @@ -2852,8 +2866,8 @@ /* documentation is in freetype.h */ FT_EXPORT_DEF( FT_Error ) - FT_Attach_Stream( FT_Face face, - FT_Open_Args* parameters ) + FT_Attach_Stream( FT_Face face, + const FT_Open_Args* parameters ) { FT_Stream stream; FT_Error error; @@ -3278,34 +3292,49 @@ scaled_h = FT_REQUEST_HEIGHT( req ); /* determine scales */ - if ( req->width ) + if ( req->height || !req->width ) { - metrics->x_scale = FT_DivFix( scaled_w, w ); - - if ( req->height ) + if ( h == 0 ) { - metrics->y_scale = FT_DivFix( scaled_h, h ); - - if ( req->type == FT_SIZE_REQUEST_TYPE_CELL ) - { - if ( metrics->y_scale > metrics->x_scale ) - metrics->y_scale = metrics->x_scale; - else - metrics->x_scale = metrics->y_scale; - } + FT_ERROR(( "FT_Request_Metrics: Divide by zero\n" )); + error = FT_ERR( Divide_By_Zero ); + goto Exit; } - else + + metrics->y_scale = FT_DivFix( scaled_h, h ); + } + + if ( req->width ) + { + if ( w == 0 ) { - metrics->y_scale = metrics->x_scale; - scaled_h = FT_MulDiv( scaled_w, h, w ); + FT_ERROR(( "FT_Request_Metrics: Divide by zero\n" )); + error = FT_ERR( Divide_By_Zero ); + goto Exit; } + + metrics->x_scale = FT_DivFix( scaled_w, w ); } else { - metrics->x_scale = metrics->y_scale = FT_DivFix( scaled_h, h ); + metrics->x_scale = metrics->y_scale; scaled_w = FT_MulDiv( scaled_h, w, h ); } + if ( !req->height ) + { + metrics->y_scale = metrics->x_scale; + scaled_h = FT_MulDiv( scaled_w, h, w ); + } + + if ( req->type == FT_SIZE_REQUEST_TYPE_CELL ) + { + if ( metrics->y_scale > metrics->x_scale ) + metrics->y_scale = metrics->x_scale; + else + metrics->x_scale = metrics->y_scale; + } + Calculate_Ppem: /* calculate the ppems */ if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL ) @@ -3379,15 +3408,19 @@ FT_TRACE5(( " x scale: %ld (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); + metrics->x_scale, (double)metrics->x_scale / 65536 )); FT_TRACE5(( " y scale: %ld (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + metrics->y_scale, (double)metrics->y_scale / 65536 )); + FT_TRACE5(( " ascender: %f\n", + (double)metrics->ascender / 64 )); + FT_TRACE5(( " descender: %f\n", + (double)metrics->descender / 64 )); + FT_TRACE5(( " height: %f\n", + (double)metrics->height / 64 )); + FT_TRACE5(( " max advance: %f\n", + (double)metrics->max_advance / 64 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } #endif @@ -3459,15 +3492,19 @@ FT_TRACE5(( " x scale: %ld (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); + metrics->x_scale, (double)metrics->x_scale / 65536 )); FT_TRACE5(( " y scale: %ld (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + metrics->y_scale, (double)metrics->y_scale / 65536 )); + FT_TRACE5(( " ascender: %f\n", + (double)metrics->ascender / 64 )); + FT_TRACE5(( " descender: %f\n", + (double)metrics->descender / 64 )); + FT_TRACE5(( " height: %f\n", + (double)metrics->height / 64 )); + FT_TRACE5(( " max advance: %f\n", + (double)metrics->max_advance / 64 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } #endif diff --git a/lib/freetype/src/base/ftotval.c b/lib/freetype/src/base/ftotval.c index f336e9622..192e12a71 100644 --- a/lib/freetype/src/base/ftotval.c +++ b/lib/freetype/src/base/ftotval.c @@ -4,7 +4,7 @@ * * FreeType API for validating OpenType tables (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftoutln.c b/lib/freetype/src/base/ftoutln.c index 624df03ad..30ff21ff3 100644 --- a/lib/freetype/src/base/ftoutln.c +++ b/lib/freetype/src/base/ftoutln.c @@ -4,7 +4,7 @@ * * FreeType outline management (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -130,7 +130,7 @@ } FT_TRACE5(( " move to (%.2f, %.2f)\n", - v_start.x / 64.0, v_start.y / 64.0 )); + (double)v_start.x / 64, (double)v_start.y / 64 )); error = func_interface->move_to( &v_start, user ); if ( error ) goto Exit; @@ -152,7 +152,7 @@ vec.y = SCALED( point->y ); FT_TRACE5(( " line to (%.2f, %.2f)\n", - vec.x / 64.0, vec.y / 64.0 )); + (double)vec.x / 64, (double)vec.y / 64 )); error = func_interface->line_to( &vec, user ); if ( error ) goto Exit; @@ -181,8 +181,10 @@ { FT_TRACE5(( " conic to (%.2f, %.2f)" " with control (%.2f, %.2f)\n", - vec.x / 64.0, vec.y / 64.0, - v_control.x / 64.0, v_control.y / 64.0 )); + (double)vec.x / 64, + (double)vec.y / 64, + (double)v_control.x / 64, + (double)v_control.y / 64 )); error = func_interface->conic_to( &v_control, &vec, user ); if ( error ) goto Exit; @@ -197,8 +199,10 @@ FT_TRACE5(( " conic to (%.2f, %.2f)" " with control (%.2f, %.2f)\n", - v_middle.x / 64.0, v_middle.y / 64.0, - v_control.x / 64.0, v_control.y / 64.0 )); + (double)v_middle.x / 64, + (double)v_middle.y / 64, + (double)v_control.x / 64, + (double)v_control.y / 64 )); error = func_interface->conic_to( &v_control, &v_middle, user ); if ( error ) goto Exit; @@ -209,8 +213,10 @@ FT_TRACE5(( " conic to (%.2f, %.2f)" " with control (%.2f, %.2f)\n", - v_start.x / 64.0, v_start.y / 64.0, - v_control.x / 64.0, v_control.y / 64.0 )); + (double)v_start.x / 64, + (double)v_start.y / 64, + (double)v_control.x / 64, + (double)v_control.y / 64 )); error = func_interface->conic_to( &v_control, &v_start, user ); goto Close; @@ -242,9 +248,12 @@ FT_TRACE5(( " cubic to (%.2f, %.2f)" " with controls (%.2f, %.2f) and (%.2f, %.2f)\n", - vec.x / 64.0, vec.y / 64.0, - vec1.x / 64.0, vec1.y / 64.0, - vec2.x / 64.0, vec2.y / 64.0 )); + (double)vec.x / 64, + (double)vec.y / 64, + (double)vec1.x / 64, + (double)vec1.y / 64, + (double)vec2.x / 64, + (double)vec2.y / 64 )); error = func_interface->cubic_to( &vec1, &vec2, &vec, user ); if ( error ) goto Exit; @@ -253,9 +262,12 @@ FT_TRACE5(( " cubic to (%.2f, %.2f)" " with controls (%.2f, %.2f) and (%.2f, %.2f)\n", - v_start.x / 64.0, v_start.y / 64.0, - vec1.x / 64.0, vec1.y / 64.0, - vec2.x / 64.0, vec2.y / 64.0 )); + (double)v_start.x / 64, + (double)v_start.y / 64, + (double)vec1.x / 64, + (double)vec1.y / 64, + (double)vec2.x / 64, + (double)vec2.y / 64 )); error = func_interface->cubic_to( &vec1, &vec2, &v_start, user ); goto Close; } @@ -264,7 +276,7 @@ /* close the contour with a line segment */ FT_TRACE5(( " line to (%.2f, %.2f)\n", - v_start.x / 64.0, v_start.y / 64.0 )); + (double)v_start.x / 64, (double)v_start.y / 64 )); error = func_interface->line_to( &v_start, user ); Close: diff --git a/lib/freetype/src/base/ftpatent.c b/lib/freetype/src/base/ftpatent.c index 353ed2b53..cb5efadff 100644 --- a/lib/freetype/src/base/ftpatent.c +++ b/lib/freetype/src/base/ftpatent.c @@ -5,7 +5,7 @@ * FreeType API for checking patented TrueType bytecode instructions * (body). Obsolete, retained for backward compatibility. * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftpfr.c b/lib/freetype/src/base/ftpfr.c index 9e748f06e..378385a59 100644 --- a/lib/freetype/src/base/ftpfr.c +++ b/lib/freetype/src/base/ftpfr.c @@ -4,7 +4,7 @@ * * FreeType API for accessing PFR-specific data (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftpsprop.c b/lib/freetype/src/base/ftpsprop.c index 81fcee08f..cefdf489d 100644 --- a/lib/freetype/src/base/ftpsprop.c +++ b/lib/freetype/src/base/ftpsprop.c @@ -5,7 +5,7 @@ * Get and set properties of PostScript drivers (body). * See `ftdriver.h' for available properties. * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftrfork.c b/lib/freetype/src/base/ftrfork.c index 356998d3f..2ab430195 100644 --- a/lib/freetype/src/base/ftrfork.c +++ b/lib/freetype/src/base/ftrfork.c @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * Masatake YAMATO and Redhat K.K. * * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are diff --git a/lib/freetype/src/base/ftsnames.c b/lib/freetype/src/base/ftsnames.c index 3bf20c389..1917a3f1d 100644 --- a/lib/freetype/src/base/ftsnames.c +++ b/lib/freetype/src/base/ftsnames.c @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftstream.c b/lib/freetype/src/base/ftstream.c index cc926565c..05c563757 100644 --- a/lib/freetype/src/base/ftstream.c +++ b/lib/freetype/src/base/ftstream.c @@ -4,7 +4,7 @@ * * I/O stream support (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -261,7 +261,7 @@ } #ifdef FT_DEBUG_MEMORY - /* assume _ft_debug_file and _ft_debug_lineno are already set */ + /* assume `ft_debug_file_` and `ft_debug_lineno_` are already set */ stream->base = (unsigned char*)ft_mem_qalloc( memory, (FT_Long)count, &error ); @@ -363,11 +363,11 @@ } - FT_BASE_DEF( FT_UShort ) + FT_BASE_DEF( FT_UInt16 ) FT_Stream_GetUShort( FT_Stream stream ) { FT_Byte* p; - FT_UShort result; + FT_UInt16 result; FT_ASSERT( stream && stream->cursor ); @@ -382,11 +382,11 @@ } - FT_BASE_DEF( FT_UShort ) + FT_BASE_DEF( FT_UInt16 ) FT_Stream_GetUShortLE( FT_Stream stream ) { FT_Byte* p; - FT_UShort result; + FT_UInt16 result; FT_ASSERT( stream && stream->cursor ); @@ -401,11 +401,11 @@ } - FT_BASE_DEF( FT_ULong ) + FT_BASE_DEF( FT_UInt32 ) FT_Stream_GetUOffset( FT_Stream stream ) { FT_Byte* p; - FT_ULong result; + FT_UInt32 result; FT_ASSERT( stream && stream->cursor ); @@ -419,11 +419,11 @@ } - FT_BASE_DEF( FT_ULong ) + FT_BASE_DEF( FT_UInt32 ) FT_Stream_GetULong( FT_Stream stream ) { FT_Byte* p; - FT_ULong result; + FT_UInt32 result; FT_ASSERT( stream && stream->cursor ); @@ -437,11 +437,11 @@ } - FT_BASE_DEF( FT_ULong ) + FT_BASE_DEF( FT_UInt32 ) FT_Stream_GetULongLE( FT_Stream stream ) { FT_Byte* p; - FT_ULong result; + FT_UInt32 result; FT_ASSERT( stream && stream->cursor ); @@ -493,13 +493,13 @@ } - FT_BASE_DEF( FT_UShort ) + FT_BASE_DEF( FT_UInt16 ) FT_Stream_ReadUShort( FT_Stream stream, FT_Error* error ) { FT_Byte reads[2]; FT_Byte* p; - FT_UShort result = 0; + FT_UInt16 result = 0; FT_ASSERT( stream ); @@ -538,13 +538,13 @@ } - FT_BASE_DEF( FT_UShort ) + FT_BASE_DEF( FT_UInt16 ) FT_Stream_ReadUShortLE( FT_Stream stream, FT_Error* error ) { FT_Byte reads[2]; FT_Byte* p; - FT_UShort result = 0; + FT_UInt16 result = 0; FT_ASSERT( stream ); @@ -628,13 +628,13 @@ } - FT_BASE_DEF( FT_ULong ) + FT_BASE_DEF( FT_UInt32 ) FT_Stream_ReadULong( FT_Stream stream, FT_Error* error ) { FT_Byte reads[4]; FT_Byte* p; - FT_ULong result = 0; + FT_UInt32 result = 0; FT_ASSERT( stream ); @@ -673,13 +673,13 @@ } - FT_BASE_DEF( FT_ULong ) + FT_BASE_DEF( FT_UInt32 ) FT_Stream_ReadULongLE( FT_Stream stream, FT_Error* error ) { FT_Byte reads[4]; FT_Byte* p; - FT_ULong result = 0; + FT_UInt32 result = 0; FT_ASSERT( stream ); diff --git a/lib/freetype/src/base/ftstroke.c b/lib/freetype/src/base/ftstroke.c index aa983f940..db358e772 100644 --- a/lib/freetype/src/base/ftstroke.c +++ b/lib/freetype/src/base/ftstroke.c @@ -4,7 +4,7 @@ * * FreeType path stroker (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftsynth.c b/lib/freetype/src/base/ftsynth.c index 10bbe0dfd..6ec25e13e 100644 --- a/lib/freetype/src/base/ftsynth.c +++ b/lib/freetype/src/base/ftsynth.c @@ -4,7 +4,7 @@ * * FreeType synthesizing code for emboldening and slanting (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -46,6 +46,18 @@ FT_EXPORT_DEF( void ) FT_GlyphSlot_Oblique( FT_GlyphSlot slot ) { + /* Value '0x0366A' corresponds to a shear angle of about 12 degrees. */ + FT_GlyphSlot_Slant( slot, 0x0366A, 0 ); + } + + + /* documentation is in ftsynth.h */ + + FT_EXPORT_DEF( void ) + FT_GlyphSlot_Slant( FT_GlyphSlot slot, + FT_Fixed xslant, + FT_Fixed yslant ) + { FT_Matrix transform; FT_Outline* outline; @@ -61,13 +73,11 @@ /* we don't touch the advance width */ - /* For italic, simply apply a shear transform, with an angle */ - /* of about 12 degrees. */ - + /* For italic, simply apply a shear transform */ transform.xx = 0x10000L; - transform.yx = 0x00000L; + transform.yx = -yslant; - transform.xy = 0x0366AL; + transform.xy = xslant; transform.yy = 0x10000L; FT_Outline_Transform( outline, &transform ); diff --git a/lib/freetype/src/base/ftsystem.c b/lib/freetype/src/base/ftsystem.c index d8826b236..fcd289d19 100644 --- a/lib/freetype/src/base/ftsystem.c +++ b/lib/freetype/src/base/ftsystem.c @@ -4,7 +4,7 @@ * * ANSI-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/fttrigon.c b/lib/freetype/src/base/fttrigon.c index 6964edb0f..2dd2c3459 100644 --- a/lib/freetype/src/base/fttrigon.c +++ b/lib/freetype/src/base/fttrigon.c @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (body). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/fttype1.c b/lib/freetype/src/base/fttype1.c index de3d5a48b..637c5cf77 100644 --- a/lib/freetype/src/base/fttype1.c +++ b/lib/freetype/src/base/fttype1.c @@ -4,7 +4,7 @@ * * FreeType utility file for PS names support (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftutil.c b/lib/freetype/src/base/ftutil.c index 5a9138258..6120846d2 100644 --- a/lib/freetype/src/base/ftutil.c +++ b/lib/freetype/src/base/ftutil.c @@ -4,7 +4,7 @@ * * FreeType utility file for memory and list management (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/ftver.rc b/lib/freetype/src/base/ftver.rc index eb6090ecc..f113cb892 100644 --- a/lib/freetype/src/base/ftver.rc +++ b/lib/freetype/src/base/ftver.rc @@ -4,7 +4,7 @@ /* */ /* FreeType VERSIONINFO resource for Windows DLLs. */ /* */ -/* Copyright (C) 2018-2022 by */ +/* Copyright (C) 2018-2023 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,12,1,0 -#define FT_VERSION_STR "2.12.1" +#define FT_VERSION 2,13,0,0 +#define FT_VERSION_STR "2.13.0" VS_VERSION_INFO VERSIONINFO FILEVERSION FT_VERSION @@ -38,14 +38,14 @@ FILETYPE VFT_STATIC_LIB BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "040904E4" + BLOCK "040904B0" BEGIN VALUE "CompanyName", "The FreeType Project" VALUE "FileDescription", "Font Rendering Library" VALUE "FileVersion", FT_VERSION_STR VALUE "ProductName", "FreeType" VALUE "ProductVersion", FT_VERSION_STR - VALUE "LegalCopyright", "\251 2000-2022 The FreeType Project www.freetype.org. All rights reserved." + VALUE "LegalCopyright", L"\x00A9 2000-2023 The FreeType Project www.freetype.org. All rights reserved." VALUE "InternalName", "freetype" VALUE "OriginalFilename", FT_FILENAME END @@ -56,6 +56,6 @@ BEGIN /* The following line should only be modified for localized versions. */ /* It consists of any number of WORD,WORD pairs, with each pair */ /* describing a "language,codepage" combination supported by the file. */ - VALUE "Translation", 0x409, 1252 + VALUE "Translation", 0x409, 1200 END END diff --git a/lib/freetype/src/base/ftwinfnt.c b/lib/freetype/src/base/ftwinfnt.c index 193f7fa04..03b023e07 100644 --- a/lib/freetype/src/base/ftwinfnt.c +++ b/lib/freetype/src/base/ftwinfnt.c @@ -4,7 +4,7 @@ * * FreeType API for accessing Windows FNT specific info (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/base/rules.mk b/lib/freetype/src/base/rules.mk index 9a224b14e..b7de9b5ca 100644 --- a/lib/freetype/src/base/rules.mk +++ b/lib/freetype/src/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/bdf/bdfdrivr.c b/lib/freetype/src/bdf/bdfdrivr.c index eb73a7cf9..d7e8e0efc 100644 --- a/lib/freetype/src/bdf/bdfdrivr.c +++ b/lib/freetype/src/bdf/bdfdrivr.c @@ -92,24 +92,18 @@ THE SOFTWARE. { BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; - FT_ULong min, max, mid; /* num_encodings */ FT_UShort result = 0; /* encodings->glyph */ + FT_ULong min = 0; + FT_ULong max = cmap->num_encodings; + FT_ULong mid = ( min + max ) >> 1; - min = 0; - max = cmap->num_encodings; - mid = ( min + max ) >> 1; while ( min < max ) { - FT_ULong code; + FT_ULong code = encodings[mid].enc; - if ( mid >= max || mid < min ) - mid = ( min + max ) >> 1; - - code = encodings[mid].enc; - if ( charcode == code ) { /* increase glyph index by 1 -- */ @@ -123,8 +117,10 @@ THE SOFTWARE. else min = mid + 1; - /* prediction in a continuous block */ + /* reasonable prediction in a continuous block */ mid += charcode - code; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; } return result; @@ -137,25 +133,19 @@ THE SOFTWARE. { BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; - FT_ULong min, max, mid; /* num_encodings */ FT_UShort result = 0; /* encodings->glyph */ FT_ULong charcode = *acharcode + 1; + FT_ULong min = 0; + FT_ULong max = cmap->num_encodings; + FT_ULong mid = ( min + max ) >> 1; - min = 0; - max = cmap->num_encodings; - mid = ( min + max ) >> 1; while ( min < max ) { - FT_ULong code; /* same as BDF_encoding_el.enc */ + FT_ULong code = encodings[mid].enc; - if ( mid >= max || mid < min ) - mid = ( min + max ) >> 1; - - code = encodings[mid].enc; - if ( charcode == code ) { /* increase glyph index by 1 -- */ @@ -171,6 +161,8 @@ THE SOFTWARE. /* prediction in a continuous block */ mid += charcode - code; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; } charcode = 0; diff --git a/lib/freetype/src/bdf/bdflib.c b/lib/freetype/src/bdf/bdflib.c index 6603148a0..2224698fc 100644 --- a/lib/freetype/src/bdf/bdflib.c +++ b/lib/freetype/src/bdf/bdflib.c @@ -58,7 +58,7 @@ */ - static const bdf_options_t _bdf_opts = + static const bdf_options_t bdf_opts_ = { 1, /* Correct metrics. */ 1, /* Preserve unencoded glyphs. */ @@ -76,7 +76,7 @@ /* List of most properties that might appear in a font. Doesn't include */ /* the RAW_* and AXIS_* properties in X11R6 polymorphic fonts. */ - static const bdf_property_t _bdf_properties[] = + static const bdf_property_t bdf_properties_[] = { { "ADD_STYLE_NAME", BDF_ATOM, 1, { 0 } }, { "AVERAGE_WIDTH", BDF_INTEGER, 1, { 0 } }, @@ -164,8 +164,8 @@ }; static const unsigned long - _num_bdf_properties = sizeof ( _bdf_properties ) / - sizeof ( _bdf_properties[0] ); + num_bdf_properties_ = sizeof ( bdf_properties_ ) / + sizeof ( bdf_properties_[0] ); /* An auxiliary macro to parse properties, to be used in conditionals. */ @@ -227,7 +227,7 @@ /* Function type for parsing lines of a BDF font. */ typedef FT_Error - (*_bdf_line_func_t)( char* line, + (*bdf_line_func_t_)( char* line, unsigned long linelen, unsigned long lineno, void* call_data, @@ -236,19 +236,19 @@ /* List structure for splitting lines into fields. */ - typedef struct _bdf_list_t_ + typedef struct bdf_list_t__ { char** field; unsigned long size; unsigned long used; FT_Memory memory; - } _bdf_list_t; + } bdf_list_t_; /* Structure used while loading BDF fonts. */ - typedef struct _bdf_parse_t_ + typedef struct bdf_parse_t__ { unsigned long flags; unsigned long cnt; @@ -268,12 +268,12 @@ bdf_font_t* font; bdf_options_t* opts; - _bdf_list_t list; + bdf_list_t_ list; FT_Memory memory; unsigned long size; /* the stream size */ - } _bdf_parse_t; + } bdf_parse_t_; #define setsbit( m, cc ) \ @@ -283,7 +283,7 @@ static void - _bdf_list_init( _bdf_list_t* list, + bdf_list_init_( bdf_list_t_* list, FT_Memory memory ) { FT_ZERO( list ); @@ -292,7 +292,7 @@ static void - _bdf_list_done( _bdf_list_t* list ) + bdf_list_done_( bdf_list_t_* list ) { FT_Memory memory = list->memory; @@ -306,15 +306,15 @@ static FT_Error - _bdf_list_ensure( _bdf_list_t* list, - unsigned long num_items ) /* same as _bdf_list_t.used */ + 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 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; @@ -340,7 +340,7 @@ static void - _bdf_list_shift( _bdf_list_t* list, + bdf_list_shift_( bdf_list_t_* list, unsigned long n ) { unsigned long i, u; @@ -367,7 +367,7 @@ static char * - _bdf_list_join( _bdf_list_t* list, + bdf_list_join_( bdf_list_t_* list, int c, unsigned long *alen ) { @@ -405,7 +405,7 @@ /* don't have to check the number of fields in most cases. */ static FT_Error - _bdf_list_split( _bdf_list_t* list, + bdf_list_split_( bdf_list_t_* list, const char* separators, char* line, unsigned long linelen ) @@ -467,7 +467,7 @@ /* Resize the list if necessary. */ if ( list->used == list->size ) { - error = _bdf_list_ensure( list, list->used + 1 ); + error = bdf_list_ensure_( list, list->used + 1 ); if ( error ) goto Exit; } @@ -496,7 +496,7 @@ /* Finally, NULL-terminate the list. */ if ( list->used + final_empty >= list->size ) { - error = _bdf_list_ensure( list, list->used + final_empty + 1 ); + error = bdf_list_ensure_( list, list->used + final_empty + 1 ); if ( error ) goto Exit; } @@ -515,12 +515,12 @@ static FT_Error - _bdf_readstream( FT_Stream stream, - _bdf_line_func_t callback, + bdf_readstream_( FT_Stream stream, + bdf_line_func_t_ callback, void* client_data, unsigned long *lno ) { - _bdf_line_func_t cb; + bdf_line_func_t_ cb; unsigned long lineno, buf_size; int refill, hold, to_skip; ptrdiff_t bytes, start, end, cursor, avail; @@ -603,7 +603,7 @@ error = FT_THROW( Missing_Startfont_Field ); else { - FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno )); + FT_ERROR(( "bdf_readstream_: " ERRMSG6, lineno )); error = FT_THROW( Invalid_Argument ); } goto Exit; @@ -702,7 +702,7 @@ /* Routine to convert a decimal ASCII string to an unsigned long integer. */ static unsigned long - _bdf_atoul( const char* s ) + bdf_atoul_( const char* s ) { unsigned long v; @@ -727,7 +727,7 @@ /* Routine to convert a decimal ASCII string to a signed long integer. */ static long - _bdf_atol( const char* s ) + bdf_atol_( const char* s ) { long v, neg; @@ -760,7 +760,7 @@ /* Routine to convert a decimal ASCII string to an unsigned short integer. */ static unsigned short - _bdf_atous( const char* s ) + bdf_atous_( const char* s ) { unsigned short v; @@ -785,7 +785,7 @@ /* Routine to convert a decimal ASCII string to a signed short integer. */ static short - _bdf_atos( const char* s ) + bdf_atos_( const char* s ) { short v, neg; @@ -874,7 +874,7 @@ p->builtin = 0; p->value.atom = NULL; /* nothing is ever stored here */ - n = _num_bdf_properties + font->nuser_props; + n = num_bdf_properties_ + font->nuser_props; error = ft_hash_str_insert( p->name, n, &(font->proptbl), memory ); if ( error ) @@ -900,10 +900,10 @@ if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL ) return 0; - if ( *propid >= _num_bdf_properties ) - return font->user_props + ( *propid - _num_bdf_properties ); + if ( *propid >= num_bdf_properties_ ) + return font->user_props + ( *propid - num_bdf_properties_ ); - return (bdf_property_t*)_bdf_properties + *propid; + return (bdf_property_t*)bdf_properties_ + *propid; } @@ -943,7 +943,7 @@ static FT_Error - _bdf_add_comment( bdf_font_t* font, + bdf_add_comment_( bdf_font_t* font, char* comment, unsigned long len ) { @@ -972,13 +972,13 @@ /* 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_set_default_spacing_( bdf_font_t* font, bdf_options_t* opts, unsigned long lineno ) { size_t len; char name[256]; - _bdf_list_t list; + bdf_list_t_ list; FT_Memory memory; FT_Error error = FT_Err_Ok; @@ -993,7 +993,7 @@ memory = font->memory; - _bdf_list_init( &list, memory ); + bdf_list_init_( &list, memory ); font->spacing = opts->font_spacing; @@ -1001,14 +1001,14 @@ /* Limit ourselves to 256 characters in the font name. */ if ( len >= 256 ) { - FT_ERROR(( "_bdf_set_default_spacing: " ERRMSG7, lineno )); + 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 ); + error = bdf_list_split_( &list, "-", name, (unsigned long)len ); if ( error ) goto Fail; @@ -1032,7 +1032,7 @@ } Fail: - _bdf_list_done( &list ); + bdf_list_done_( &list ); Exit: return error; @@ -1042,7 +1042,7 @@ /* 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 - _bdf_is_atom( char* line, + bdf_is_atom_( char* line, unsigned long linelen, char** name, char** value, @@ -1106,7 +1106,7 @@ static FT_Error - _bdf_add_property( bdf_font_t* font, + bdf_add_property_( bdf_font_t* font, const char* name, char* value, unsigned long lineno ) @@ -1141,11 +1141,11 @@ break; case BDF_INTEGER: - fp->value.l = _bdf_atol( value ); + fp->value.l = bdf_atol_( value ); break; case BDF_CARDINAL: - fp->value.ul = _bdf_atoul( value ); + fp->value.ul = bdf_atoul_( value ); break; default: @@ -1177,10 +1177,10 @@ font->props_size++; } - if ( *propid >= _num_bdf_properties ) - prop = font->user_props + ( *propid - _num_bdf_properties ); + if ( *propid >= num_bdf_properties_ ) + prop = font->user_props + ( *propid - num_bdf_properties_ ); else - prop = (bdf_property_t*)_bdf_properties + *propid; + prop = (bdf_property_t*)bdf_properties_ + *propid; fp = font->props + font->props_used; @@ -1200,11 +1200,11 @@ break; case BDF_INTEGER: - fp->value.l = _bdf_atol( value ); + fp->value.l = bdf_atol_( value ); break; case BDF_CARDINAL: - fp->value.ul = _bdf_atoul( value ); + fp->value.ul = bdf_atoul_( value ); break; } @@ -1238,7 +1238,7 @@ { if ( !fp->value.atom ) { - FT_ERROR(( "_bdf_add_property: " ERRMSG8, lineno, "SPACING" )); + FT_ERROR(( "bdf_add_property_: " ERRMSG8, lineno, "SPACING" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1263,7 +1263,7 @@ static FT_Error - _bdf_parse_end( char* line, + bdf_parse_end_( char* line, unsigned long linelen, unsigned long lineno, void* call_data, @@ -1283,7 +1283,7 @@ /* Actually parse the glyph info and bitmaps. */ static FT_Error - _bdf_parse_glyphs( char* line, + bdf_parse_glyphs_( char* line, unsigned long linelen, unsigned long lineno, void* call_data, @@ -1294,8 +1294,8 @@ unsigned char* bp; unsigned long i, slen, nibbles; - _bdf_line_func_t* next; - _bdf_parse_t* p; + bdf_line_func_t_* next; + bdf_parse_t_* p; bdf_glyph_t* glyph; bdf_font_t* font; @@ -1305,8 +1305,8 @@ FT_UNUSED( lineno ); /* only used in debug mode */ - next = (_bdf_line_func_t *)call_data; - p = (_bdf_parse_t *) client_data; + next = (bdf_line_func_t_ *)call_data; + p = (bdf_parse_t_ *) client_data; font = p->font; memory = font->memory; @@ -1324,7 +1324,7 @@ s++; linelen--; } - error = _bdf_add_comment( p->font, s, linelen ); + error = bdf_add_comment_( p->font, s, linelen ); } goto Exit; } @@ -1334,21 +1334,21 @@ { if ( _bdf_strncmp( line, "CHARS", 5 ) != 0 ) { - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "CHARS" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "CHARS" )); error = FT_THROW( Missing_Chars_Field ); goto Exit; } - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; - p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1] ); + p->cnt = font->glyphs_size = bdf_atoul_( p->list.field[1] ); /* 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 )); + FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG17, p->cnt )); } /* Make sure the number of glyphs is non-zero. */ @@ -1359,7 +1359,7 @@ /* number of code points available in Unicode). */ if ( p->cnt >= 0x110000UL ) { - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "CHARS" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "CHARS" )); error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1378,7 +1378,7 @@ if ( p->flags & BDF_GLYPH_BITS_ ) { /* Missing ENDCHAR field. */ - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENDCHAR" )); error = FT_THROW( Corrupted_Font_Glyphs ); goto Exit; } @@ -1390,7 +1390,7 @@ by_encoding ); p->flags &= ~BDF_START_; - *next = _bdf_parse_end; + *next = bdf_parse_end_; goto Exit; } @@ -1417,7 +1417,7 @@ if ( p->flags & BDF_GLYPH_BITS_ ) { /* Missing ENDCHAR field. */ - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENDCHAR" )); error = FT_THROW( Missing_Startchar_Field ); goto Exit; } @@ -1426,17 +1426,17 @@ /* encoding can be checked for an unencoded character. */ FT_FREE( p->glyph_name ); - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; - _bdf_list_shift( &p->list, 1 ); + bdf_list_shift_( &p->list, 1 ); - s = _bdf_list_join( &p->list, ' ', &slen ); + s = bdf_list_join_( &p->list, ' ', &slen ); if ( !s ) { - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG8, lineno, "STARTCHAR" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG8, lineno, "STARTCHAR" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1459,16 +1459,16 @@ if ( !( p->flags & BDF_GLYPH_ ) ) { /* Missing STARTCHAR field. */ - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "STARTCHAR" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "STARTCHAR" )); error = FT_THROW( Missing_Startchar_Field ); goto Exit; } - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; - p->glyph_enc = _bdf_atol( p->list.field[1] ); + p->glyph_enc = bdf_atol_( p->list.field[1] ); /* Normalize negative encoding values. The specification only */ /* allows -1, but we can be more generous here. */ @@ -1477,7 +1477,7 @@ /* Check for alternative encoding format. */ if ( p->glyph_enc == -1 && p->list.used > 2 ) - p->glyph_enc = _bdf_atol( p->list.field[2] ); + p->glyph_enc = bdf_atol_( p->list.field[2] ); if ( p->glyph_enc < -1 || p->glyph_enc >= 0x110000L ) p->glyph_enc = -1; @@ -1564,7 +1564,7 @@ { if ( !( p->flags & BDF_GLYPH_HEIGHT_CHECK_ ) ) { - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG13, glyph->encoding )); + FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG13, glyph->encoding )); p->flags |= BDF_GLYPH_HEIGHT_CHECK_; } @@ -1591,7 +1591,7 @@ if ( i < nibbles && !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) ) { - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding )); + FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG16, glyph->encoding )); p->flags |= BDF_GLYPH_WIDTH_CHECK_; } @@ -1605,7 +1605,7 @@ sbitset( hdigits, line[nibbles] ) && !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) ) { - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); + FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG14, glyph->encoding )); p->flags |= BDF_GLYPH_WIDTH_CHECK_; } @@ -1616,11 +1616,11 @@ /* Expect the SWIDTH (scalable width) field next. */ if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 ) { - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; - glyph->swidth = _bdf_atous( p->list.field[1] ); + glyph->swidth = bdf_atous_( p->list.field[1] ); p->flags |= BDF_SWIDTH_; goto Exit; @@ -1629,17 +1629,17 @@ /* Expect the DWIDTH (device width) field next. */ if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 ) { - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; - glyph->dwidth = _bdf_atous( p->list.field[1] ); + glyph->dwidth = bdf_atous_( p->list.field[1] ); if ( !( p->flags & BDF_SWIDTH_ ) ) { /* Missing SWIDTH field. Emit an auto correction message and set */ /* the scalable width from the device width. */ - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno )); + FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG9, lineno )); glyph->swidth = (unsigned short)FT_MulDiv( glyph->dwidth, 72000L, @@ -1654,14 +1654,14 @@ /* Expect the BBX field next. */ if ( _bdf_strncmp( line, "BBX", 3 ) == 0 ) { - error = _bdf_list_split( &p->list, " +", line, linelen ); + 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] ); + 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] ); /* Generate the ascent and descent of the character. */ glyph->bbx.ascent = (short)( glyph->bbx.height + glyph->bbx.y_offset ); @@ -1682,7 +1682,7 @@ { /* Missing DWIDTH field. Emit an auto correction message and set */ /* the device width to the glyph width. */ - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG10, lineno )); + FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG10, lineno )); glyph->dwidth = glyph->bbx.width; } @@ -1718,7 +1718,7 @@ if ( !( p->flags & BDF_BBX_ ) ) { /* Missing BBX field. */ - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "BBX" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "BBX" )); error = FT_THROW( Missing_Bbx_Field ); goto Exit; } @@ -1729,7 +1729,7 @@ bitmap_size = glyph->bpr * glyph->bbx.height; if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU ) { - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG4, lineno )); error = FT_THROW( Bbx_Too_Big ); goto Exit; } @@ -1745,13 +1745,13 @@ goto Exit; } - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG9, lineno )); error = FT_THROW( Invalid_File_Format ); goto Exit; Missing_Encoding: /* Missing ENCODING field. */ - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENCODING" )); error = FT_THROW( Missing_Encoding_Field ); Exit: @@ -1764,15 +1764,15 @@ /* Load the font properties. */ static FT_Error - _bdf_parse_properties( char* line, + bdf_parse_properties_( char* line, unsigned long linelen, unsigned long lineno, void* call_data, void* client_data ) { unsigned long vlen; - _bdf_line_func_t* next; - _bdf_parse_t* p; + bdf_line_func_t_* next; + bdf_parse_t_* p; char* name; char* value; char nbuf[128]; @@ -1781,8 +1781,8 @@ FT_UNUSED( lineno ); - next = (_bdf_line_func_t *)call_data; - p = (_bdf_parse_t *) client_data; + 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 ) @@ -1797,28 +1797,28 @@ { p->font->font_ascent = p->font->bbx.ascent; ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); - error = _bdf_add_property( p->font, "FONT_ASCENT", + error = bdf_add_property_( p->font, "FONT_ASCENT", nbuf, lineno ); if ( error ) goto Exit; - FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent )); + 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_sprintf( nbuf, "%hd", p->font->bbx.descent ); - error = _bdf_add_property( p->font, "FONT_DESCENT", + error = bdf_add_property_( p->font, "FONT_DESCENT", nbuf, lineno ); if ( error ) goto Exit; - FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent )); + FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent )); } p->flags &= ~BDF_PROPS_; - *next = _bdf_parse_glyphs; + *next = bdf_parse_glyphs_; goto Exit; } @@ -1835,27 +1835,27 @@ value += 7; if ( *value ) *value++ = 0; - error = _bdf_add_property( p->font, name, value, lineno ); + error = bdf_add_property_( p->font, name, value, lineno ); if ( error ) goto Exit; } - else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) ) + else if ( bdf_is_atom_( line, linelen, &name, &value, p->font ) ) { - error = _bdf_add_property( p->font, name, value, lineno ); + error = bdf_add_property_( p->font, name, value, lineno ); if ( error ) goto Exit; } else { - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; name = p->list.field[0]; - _bdf_list_shift( &p->list, 1 ); - value = _bdf_list_join( &p->list, ' ', &vlen ); + 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_( p->font, name, value, lineno ); if ( error ) goto Exit; } @@ -1867,15 +1867,15 @@ /* Load the font header. */ static FT_Error - _bdf_parse_start( char* line, + bdf_parse_start_( char* line, unsigned long linelen, unsigned long lineno, void* call_data, void* client_data ) { unsigned long slen; - _bdf_line_func_t* next; - _bdf_parse_t* p; + bdf_line_func_t_* next; + bdf_parse_t_* p; bdf_font_t* font; char *s; @@ -1885,8 +1885,8 @@ FT_UNUSED( lineno ); /* only used in debug mode */ - next = (_bdf_line_func_t *)call_data; - p = (_bdf_parse_t *) client_data; + next = (bdf_line_func_t_ *)call_data; + p = (bdf_parse_t_ *) client_data; if ( p->font ) memory = p->font->memory; @@ -1905,7 +1905,7 @@ s++; linelen--; } - error = _bdf_add_comment( p->font, s, linelen ); + error = bdf_add_comment_( p->font, s, linelen ); } goto Exit; } @@ -1939,8 +1939,8 @@ 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++ ) + 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 ); @@ -1966,23 +1966,23 @@ if ( !( p->flags & BDF_FONT_BBX_ ) ) { /* Missing the FONTBOUNDINGBOX field. */ - FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); + FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); error = FT_THROW( Missing_Fontboundingbox_Field ); goto Exit; } - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; /* at this point, `p->font' can't be NULL */ - p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1] ); + 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 ) { p->font->props_size = 0; - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "STARTPROPERTIES" )); + FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "STARTPROPERTIES" )); error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1994,7 +1994,7 @@ } p->flags |= BDF_PROPS_; - *next = _bdf_parse_properties; + *next = bdf_parse_properties_; goto Exit; } @@ -2005,20 +2005,20 @@ if ( !( p->flags & BDF_SIZE_ ) ) { /* Missing the SIZE field. */ - FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "SIZE" )); + FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "SIZE" )); error = FT_THROW( Missing_Size_Field ); goto Exit; } - error = _bdf_list_split( &p->list, " +", line, linelen ); + 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.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] ); + p->font->bbx.x_offset = bdf_atos_( p->list.field[3] ); + p->font->bbx.y_offset = bdf_atos_( p->list.field[4] ); p->font->bbx.ascent = (short)( p->font->bbx.height + p->font->bbx.y_offset ); @@ -2033,16 +2033,16 @@ /* The next thing to check for is the FONT field. */ if ( _bdf_strncmp( line, "FONT", 4 ) == 0 ) { - error = _bdf_list_split( &p->list, " +", line, linelen ); + error = bdf_list_split_( &p->list, " +", line, linelen ); if ( error ) goto Exit; - _bdf_list_shift( &p->list, 1 ); + bdf_list_shift_( &p->list, 1 ); - s = _bdf_list_join( &p->list, ' ', &slen ); + s = bdf_list_join_( &p->list, ' ', &slen ); if ( !s ) { - FT_ERROR(( "_bdf_parse_start: " ERRMSG8, lineno, "FONT" )); + FT_ERROR(( "bdf_parse_start_: " ERRMSG8, lineno, "FONT" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -2056,7 +2056,7 @@ /* 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 ); + error = bdf_set_default_spacing_( p->font, p->opts, lineno ); if ( error ) goto Exit; @@ -2071,18 +2071,18 @@ if ( !( p->flags & BDF_FONT_NAME_ ) ) { /* Missing the FONT field. */ - FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONT" )); + FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONT" )); error = FT_THROW( Missing_Font_Field ); goto Exit; } - error = _bdf_list_split( &p->list, " +", line, linelen ); + 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] ); + 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] ); /* Check for the bits per pixel field. */ if ( p->list.used == 5 ) @@ -2090,7 +2090,7 @@ unsigned short bpp; - bpp = _bdf_atous( p->list.field[4] ); + bpp = bdf_atous_( p->list.field[4] ); /* Only values 1, 2, 4, 8 are allowed for greymap fonts. */ if ( bpp > 4 ) @@ -2103,7 +2103,7 @@ p->font->bpp = 1; if ( p->font->bpp != bpp ) - FT_TRACE2(( "_bdf_parse_start: " ACMSG11, p->font->bpp )); + FT_TRACE2(( "bdf_parse_start_: " ACMSG11, p->font->bpp )); } else p->font->bpp = 1; @@ -2122,7 +2122,7 @@ if ( !( p->flags & BDF_FONT_BBX_ ) ) { /* Missing the FONTBOUNDINGBOX field. */ - FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); + FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); error = FT_THROW( Missing_Fontboundingbox_Field ); goto Exit; } @@ -2131,28 +2131,28 @@ /* for compiling fonts. */ p->font->font_ascent = p->font->bbx.ascent; ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); - error = _bdf_add_property( p->font, "FONT_ASCENT", + error = bdf_add_property_( p->font, "FONT_ASCENT", nbuf, lineno ); if ( error ) goto Exit; - FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent )); + FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent )); p->font->font_descent = p->font->bbx.descent; ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); - error = _bdf_add_property( p->font, "FONT_DESCENT", + error = bdf_add_property_( p->font, "FONT_DESCENT", nbuf, lineno ); if ( error ) goto Exit; - FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent )); + FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent )); - *next = _bdf_parse_glyphs; + *next = bdf_parse_glyphs_; /* A special return value. */ error = -1; goto Exit; } - FT_ERROR(( "_bdf_parse_start: " ERRMSG9, lineno )); + FT_ERROR(( "bdf_parse_start_: " ERRMSG9, lineno )); error = FT_THROW( Invalid_File_Format ); Exit: @@ -2174,7 +2174,7 @@ bdf_font_t* *font ) { unsigned long lineno = 0; /* make compiler happy */ - _bdf_parse_t *p = NULL; + bdf_parse_t_ *p = NULL; FT_Error error = FT_Err_Ok; @@ -2182,14 +2182,14 @@ if ( FT_NEW( p ) ) goto Exit; - p->opts = (bdf_options_t*)( opts ? opts : &_bdf_opts ); + p->opts = (bdf_options_t*)( opts ? opts : &bdf_opts_ ); p->minlb = 32767; p->size = stream->size; p->memory = memory; /* only during font creation */ - _bdf_list_init( &p->list, memory ); + bdf_list_init_( &p->list, memory ); - error = _bdf_readstream( stream, _bdf_parse_start, + error = bdf_readstream_( stream, bdf_parse_start_, (void *)p, &lineno ); if ( error ) goto Fail; @@ -2283,7 +2283,7 @@ Exit: if ( p ) { - _bdf_list_done( &p->list ); + bdf_list_done_( &p->list ); FT_FREE( p->glyph_name ); FT_FREE( p ); diff --git a/lib/freetype/src/bzip2/ftbzip2.c b/lib/freetype/src/bzip2/ftbzip2.c index ab2da7e62..6cf10678b 100644 --- a/lib/freetype/src/bzip2/ftbzip2.c +++ b/lib/freetype/src/bzip2/ftbzip2.c @@ -8,7 +8,7 @@ * parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2010-2022 by + * Copyright (C) 2010-2023 by * Joel Klinghed. * * based on `src/gzip/ftgzip.c' diff --git a/lib/freetype/src/bzip2/rules.mk b/lib/freetype/src/bzip2/rules.mk index 93a820c85..f4d3733eb 100644 --- a/lib/freetype/src/bzip2/rules.mk +++ b/lib/freetype/src/bzip2/rules.mk @@ -2,7 +2,7 @@ # FreeType 2 BZIP2 support configuration rules # -# Copyright (C) 2010-2022 by +# Copyright (C) 2010-2023 by # Joel Klinghed. # # based on `src/lzw/rules.mk' diff --git a/lib/freetype/src/cache/ftcache.c b/lib/freetype/src/cache/ftcache.c index e26b44a70..1af2e6772 100644 --- a/lib/freetype/src/cache/ftcache.c +++ b/lib/freetype/src/cache/ftcache.c @@ -4,7 +4,7 @@ * * The FreeType Caching sub-system (body only). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcbasic.c b/lib/freetype/src/cache/ftcbasic.c index 635b17d07..4c6d41b2c 100644 --- a/lib/freetype/src/cache/ftcbasic.c +++ b/lib/freetype/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ * * The FreeType basic cache interface (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -120,8 +120,7 @@ } #endif - if ( !error ) - result = (FT_UInt)face->num_glyphs; + result = (FT_UInt)face->num_glyphs; return result; } @@ -320,7 +319,7 @@ #if 0xFFFFFFFFUL > FT_UINT_MAX if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" - " higher bits in load_flags 0x%x are dropped\n", + " higher bits in load_flags 0x%lx are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); #endif @@ -518,7 +517,7 @@ #if 0xFFFFFFFFUL > FT_UINT_MAX if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" - " higher bits in load_flags 0x%x are dropped\n", + " higher bits in load_flags 0x%lx are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); #endif diff --git a/lib/freetype/src/cache/ftccache.c b/lib/freetype/src/cache/ftccache.c index ab4ad2faa..d54e68ca9 100644 --- a/lib/freetype/src/cache/ftccache.c +++ b/lib/freetype/src/cache/ftccache.c @@ -4,7 +4,7 @@ * * The FreeType internal cache interface (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -307,7 +307,7 @@ #if 0 /* check, just in case of general corruption :-) */ if ( manager->num_nodes == 0 ) - FT_TRACE0(( "ftc_node_destroy: invalid cache node count (%d)\n", + FT_TRACE0(( "ftc_node_destroy: invalid cache node count (%u)\n", manager->num_nodes )); #endif } diff --git a/lib/freetype/src/cache/ftccache.h b/lib/freetype/src/cache/ftccache.h index ae0ae8b17..23bcb6585 100644 --- a/lib/freetype/src/cache/ftccache.h +++ b/lib/freetype/src/cache/ftccache.h @@ -4,7 +4,7 @@ * * FreeType internal cache interface (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftccback.h b/lib/freetype/src/cache/ftccback.h index ba01af2e7..5f9db213a 100644 --- a/lib/freetype/src/cache/ftccback.h +++ b/lib/freetype/src/cache/ftccback.h @@ -4,7 +4,7 @@ * * Callback functions of the caching sub-system (specification only). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftccmap.c b/lib/freetype/src/cache/ftccmap.c index 0ee1834e2..84f22a667 100644 --- a/lib/freetype/src/cache/ftccmap.c +++ b/lib/freetype/src/cache/ftccmap.c @@ -4,7 +4,7 @@ * * FreeType CharMap cache (body) * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -295,21 +295,19 @@ if ( error ) goto Exit; - if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps ) + if ( cmap_index < face->num_charmaps ) { - FT_CharMap old, cmap = NULL; + FT_CharMap old = face->charmap; + FT_CharMap cmap = face->charmaps[cmap_index]; - old = face->charmap; - cmap = face->charmaps[cmap_index]; - - if ( old != cmap && !no_cmap_change ) - FT_Set_Charmap( face, cmap ); + if ( !no_cmap_change ) + face->charmap = cmap; gindex = FT_Get_Char_Index( face, char_code ); - if ( old != cmap && !no_cmap_change ) - FT_Set_Charmap( face, old ); + if ( !no_cmap_change ) + face->charmap = old; } FTC_CMAP_NODE( node )->indices[char_code - diff --git a/lib/freetype/src/cache/ftcerror.h b/lib/freetype/src/cache/ftcerror.h index 44e74d36b..dc1a62013 100644 --- a/lib/freetype/src/cache/ftcerror.h +++ b/lib/freetype/src/cache/ftcerror.h @@ -4,7 +4,7 @@ * * Caching sub-system error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcglyph.c b/lib/freetype/src/cache/ftcglyph.c index f826c8dd8..b3fb2f219 100644 --- a/lib/freetype/src/cache/ftcglyph.c +++ b/lib/freetype/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ * * FreeType Glyph Image (FT_Glyph) cache (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcglyph.h b/lib/freetype/src/cache/ftcglyph.h index cbb807773..728d4db1d 100644 --- a/lib/freetype/src/cache/ftcglyph.h +++ b/lib/freetype/src/cache/ftcglyph.h @@ -4,7 +4,7 @@ * * FreeType abstract glyph cache (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcimage.c b/lib/freetype/src/cache/ftcimage.c index 39ce61a51..428e5e1a7 100644 --- a/lib/freetype/src/cache/ftcimage.c +++ b/lib/freetype/src/cache/ftcimage.c @@ -4,7 +4,7 @@ * * FreeType Image cache (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcimage.h b/lib/freetype/src/cache/ftcimage.h index 55270a436..d2a807f15 100644 --- a/lib/freetype/src/cache/ftcimage.h +++ b/lib/freetype/src/cache/ftcimage.h @@ -4,7 +4,7 @@ * * FreeType Generic Image cache (specification) * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcmanag.c b/lib/freetype/src/cache/ftcmanag.c index 49f037aa7..6c8433910 100644 --- a/lib/freetype/src/cache/ftcmanag.c +++ b/lib/freetype/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ * * FreeType Cache Manager (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -383,6 +383,7 @@ manager->library = library; manager->memory = memory; manager->max_weight = max_bytes; + manager->cur_weight = 0; manager->request_face = requester; manager->request_data = req_data; @@ -488,8 +489,8 @@ FTC_Cache cache = manager->caches[node->cache_index]; - if ( (FT_UInt)node->cache_index >= manager->num_caches ) - FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %ld\n", + if ( node->cache_index >= manager->num_caches ) + FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %hu\n", node->cache_index )); else weight += cache->clazz.node_weight( node, cache ); @@ -519,7 +520,7 @@ if ( count != manager->num_nodes ) FT_TRACE0(( "FTC_Manager_Check:" - " invalid cache node count %d instead of %d\n", + " invalid cache node count %u instead of %u\n", manager->num_nodes, count )); } } @@ -547,7 +548,7 @@ #ifdef FT_DEBUG_ERROR FTC_Manager_Check( manager ); - FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n", + FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %u\n", manager->cur_weight, manager->max_weight, manager->num_nodes )); #endif @@ -693,9 +694,9 @@ FTC_Node_Unref( FTC_Node node, FTC_Manager manager ) { - if ( node && - manager && - (FT_UInt)node->cache_index < manager->num_caches ) + if ( node && + manager && + node->cache_index < manager->num_caches ) node->ref_count--; } diff --git a/lib/freetype/src/cache/ftcmanag.h b/lib/freetype/src/cache/ftcmanag.h index 5c67af30b..5b30929c9 100644 --- a/lib/freetype/src/cache/ftcmanag.h +++ b/lib/freetype/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ * * FreeType Cache Manager (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcmru.c b/lib/freetype/src/cache/ftcmru.c index 6a14ae36e..67227033e 100644 --- a/lib/freetype/src/cache/ftcmru.c +++ b/lib/freetype/src/cache/ftcmru.c @@ -4,7 +4,7 @@ * * FreeType MRU support (body). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcmru.h b/lib/freetype/src/cache/ftcmru.h index 4fcadef47..45e5249ca 100644 --- a/lib/freetype/src/cache/ftcmru.h +++ b/lib/freetype/src/cache/ftcmru.h @@ -4,7 +4,7 @@ * * Simple MRU list-cache (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcsbits.c b/lib/freetype/src/cache/ftcsbits.c index 4a8b1963e..ee9dab263 100644 --- a/lib/freetype/src/cache/ftcsbits.c +++ b/lib/freetype/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ * * FreeType sbits manager (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/ftcsbits.h b/lib/freetype/src/cache/ftcsbits.h index 8f1007045..3473923f0 100644 --- a/lib/freetype/src/cache/ftcsbits.h +++ b/lib/freetype/src/cache/ftcsbits.h @@ -4,7 +4,7 @@ * * A small-bitmap cache (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cache/rules.mk b/lib/freetype/src/cache/rules.mk index 778e19e58..82b39aa33 100644 --- a/lib/freetype/src/cache/rules.mk +++ b/lib/freetype/src/cache/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2000-2022 by +# Copyright (C) 2000-2023 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/lib/freetype/src/cff/cff.c b/lib/freetype/src/cff/cff.c index 1ac0beb06..b486c389e 100644 --- a/lib/freetype/src/cff/cff.c +++ b/lib/freetype/src/cff/cff.c @@ -4,7 +4,7 @@ * * FreeType OpenType driver component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cffcmap.c b/lib/freetype/src/cff/cffcmap.c index 2d667a724..6ed314322 100644 --- a/lib/freetype/src/cff/cffcmap.c +++ b/lib/freetype/src/cff/cffcmap.c @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cffcmap.h b/lib/freetype/src/cff/cffcmap.h index 2818d3c6f..b2afc2fab 100644 --- a/lib/freetype/src/cff/cffcmap.h +++ b/lib/freetype/src/cff/cffcmap.h @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cffdrivr.c b/lib/freetype/src/cff/cffdrivr.c index d945afdfe..4e2e0e00d 100644 --- a/lib/freetype/src/cff/cffdrivr.c +++ b/lib/freetype/src/cff/cffdrivr.c @@ -4,8 +4,8 @@ * * OpenType font driver implementation (body). * - * Copyright (C) 1996-2022 by - * David Turner, Robert Wilhelm, and Werner Lemberg. + * Copyright (C) 1996-2023 by + * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. * * This file is part of the FreeType project, and may only be used, * modified, and distributed under the terms of the FreeType project @@ -936,22 +936,103 @@ } + static FT_Error + cff_load_item_variation_store( CFF_Face face, + FT_ULong offset, + GX_ItemVarStore itemStore ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->load_item_var_store( FT_FACE(face), offset, itemStore ); + } + + + static FT_Error + cff_load_delta_set_index_mapping( CFF_Face face, + FT_ULong offset, + GX_DeltaSetIdxMap map, + GX_ItemVarStore itemStore, + FT_ULong table_len ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->load_delta_set_idx_map( FT_FACE( face ), offset, map, + itemStore, table_len ); + } + + + static FT_Int + cff_get_item_delta( CFF_Face face, + GX_ItemVarStore itemStore, + FT_UInt outerIndex, + FT_UInt innerIndex ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->get_item_delta( FT_FACE( face ), itemStore, + outerIndex, innerIndex ); + } + + + static void + cff_done_item_variation_store( CFF_Face face, + GX_ItemVarStore itemStore ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + mm->done_item_var_store( FT_FACE( face ), itemStore ); + } + + + static void + cff_done_delta_set_index_map( CFF_Face face, + GX_DeltaSetIdxMap deltaSetIdxMap ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + mm->done_delta_set_idx_map( FT_FACE ( face ), deltaSetIdxMap ); + } + + + FT_DEFINE_SERVICE_MULTIMASTERSREC( cff_service_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */ - (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ - (FT_Set_Var_Design_Func) cff_set_var_design, /* set_var_design */ - (FT_Get_Var_Design_Func) cff_get_var_design, /* get_var_design */ - (FT_Set_Instance_Func) cff_set_instance, /* set_instance */ - (FT_Set_MM_WeightVector_Func)cff_set_mm_weightvector, /* set_mm_weightvector */ - (FT_Get_MM_WeightVector_Func)cff_get_mm_weightvector, /* get_mm_weightvector */ - - (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) cff_done_blend /* done_blend */ + (FT_Get_MM_Func) NULL, /* get_mm */ + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ + (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */ + (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ + (FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */ + (FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */ + (FT_Set_Instance_Func) cff_set_instance, /* set_instance */ + (FT_Set_MM_WeightVector_Func) + cff_set_mm_weightvector, + /* set_mm_weightvector */ + (FT_Get_MM_WeightVector_Func) + cff_get_mm_weightvector, + /* get_mm_weightvector */ + (FT_Var_Load_Delta_Set_Idx_Map_Func) + cff_load_delta_set_index_mapping, + /* load_delta_set_idx_map */ + (FT_Var_Load_Item_Var_Store_Func) + cff_load_item_variation_store, + /* load_item_variation_store */ + (FT_Var_Get_Item_Delta_Func) + cff_get_item_delta, /* get_item_delta */ + (FT_Var_Done_Item_Var_Store_Func) + cff_done_item_variation_store, + /* done_item_variation_store */ + (FT_Var_Done_Delta_Set_Idx_Map_Func) + cff_done_delta_set_index_map, + /* done_delta_set_index_map */ + (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ + (FT_Done_Blend_Func) cff_done_blend /* done_blend */ ) @@ -1027,8 +1108,7 @@ /*************************************************************************/ /*************************************************************************/ -#if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \ - defined TT_CONFIG_OPTION_GX_VAR_SUPPORT +#if defined TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_DEFINE_SERVICEDESCREC10( cff_services, @@ -1043,7 +1123,7 @@ FT_SERVICE_ID_PROPERTIES, &cff_service_properties, FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load ) -#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES +#else FT_DEFINE_SERVICEDESCREC8( cff_services, @@ -1056,32 +1136,6 @@ FT_SERVICE_ID_PROPERTIES, &cff_service_properties, FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load ) -#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC9( - cff_services, - - FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_MULTI_MASTERS, &cff_service_multi_masters, - FT_SERVICE_ID_METRICS_VARIATIONS, &cff_service_metrics_var, - FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name, - FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info, - FT_SERVICE_ID_CID, &cff_service_cid_info, - FT_SERVICE_ID_PROPERTIES, &cff_service_properties, - FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load - ) -#else - FT_DEFINE_SERVICEDESCREC7( - cff_services, - - FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name, - FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info, - FT_SERVICE_ID_CID, &cff_service_cid_info, - FT_SERVICE_ID_PROPERTIES, &cff_service_properties, - FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load - ) #endif diff --git a/lib/freetype/src/cff/cffdrivr.h b/lib/freetype/src/cff/cffdrivr.h index a312003be..ab1f147bb 100644 --- a/lib/freetype/src/cff/cffdrivr.h +++ b/lib/freetype/src/cff/cffdrivr.h @@ -4,7 +4,7 @@ * * High-level OpenType driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cfferrs.h b/lib/freetype/src/cff/cfferrs.h index 90d32897c..bc9a3043f 100644 --- a/lib/freetype/src/cff/cfferrs.h +++ b/lib/freetype/src/cff/cfferrs.h @@ -4,7 +4,7 @@ * * CFF error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cffgload.c b/lib/freetype/src/cff/cffgload.c index 7586b886f..cfa0aaf2b 100644 --- a/lib/freetype/src/cff/cffgload.c +++ b/lib/freetype/src/cff/cffgload.c @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -356,18 +356,14 @@ #ifdef FT_CONFIG_OPTION_SVG /* check for OT-SVG */ - if ( ( load_flags & FT_LOAD_COLOR ) && - ( (TT_Face)glyph->root.face )->svg ) + if ( ( load_flags & FT_LOAD_COLOR ) && face->svg ) { /* * We load the SVG document and try to grab the advances from the * table. For the bearings we rely on the presetting hook to do that. */ - FT_Short dummy; - FT_UShort advanceX; - FT_UShort advanceY; - SFNT_Service sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; if ( size && (size->root.metrics.x_ppem < 1 || @@ -379,10 +375,17 @@ FT_TRACE3(( "Trying to load SVG glyph\n" )); - sfnt = (SFNT_Service)((TT_Face)glyph->root.face)->sfnt; error = sfnt->load_svg_doc( (FT_GlyphSlot)glyph, glyph_index ); if ( !error ) { + FT_Fixed x_scale = size->root.metrics.x_scale; + FT_Fixed y_scale = size->root.metrics.y_scale; + + FT_Short dummy; + FT_UShort advanceX; + FT_UShort advanceY; + + FT_TRACE3(( "Successfully loaded SVG glyph\n" )); glyph->root.format = FT_GLYPH_FORMAT_SVG; @@ -404,17 +407,11 @@ &dummy, &advanceY ); - advanceX = - (FT_UShort)FT_MulDiv( advanceX, - glyph->root.face->size->metrics.x_ppem, - glyph->root.face->units_per_EM ); - advanceY = - (FT_UShort)FT_MulDiv( advanceY, - glyph->root.face->size->metrics.y_ppem, - glyph->root.face->units_per_EM ); + glyph->root.linearHoriAdvance = advanceX; + glyph->root.linearVertAdvance = advanceY; - glyph->root.metrics.horiAdvance = advanceX << 6; - glyph->root.metrics.vertAdvance = advanceY << 6; + glyph->root.metrics.horiAdvance = FT_MulFix( advanceX, x_scale ); + glyph->root.metrics.vertAdvance = FT_MulFix( advanceY, y_scale ); return error; } @@ -491,13 +488,14 @@ decoder.builder.no_recurse = FT_BOOL( load_flags & FT_LOAD_NO_RECURSE ); - /* now load the unscaled outline */ - error = cff_get_glyph_data( face, glyph_index, - &charstring, &charstring_len ); + /* this function also checks for a valid subfont index */ + error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( error ) goto Glyph_Build_Finished; - error = decoder_funcs->prepare( &decoder, size, glyph_index ); + /* now load the unscaled outline */ + error = cff_get_glyph_data( face, glyph_index, + &charstring, &charstring_len ); if ( error ) goto Glyph_Build_Finished; diff --git a/lib/freetype/src/cff/cffgload.h b/lib/freetype/src/cff/cffgload.h index 33616b968..3b8cf236d 100644 --- a/lib/freetype/src/cff/cffgload.h +++ b/lib/freetype/src/cff/cffgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cffload.c b/lib/freetype/src/cff/cffload.c index d6f8a1013..4b8c6e16c 100644 --- a/lib/freetype/src/cff/cffload.c +++ b/lib/freetype/src/cff/cffload.c @@ -4,7 +4,7 @@ * * OpenType and CFF data/program tables loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1288,7 +1288,7 @@ /* Blended values are written to a different buffer, */ /* using reserved operator 255. */ /* */ - /* Blend calculation is done in 16.16 fixed point. */ + /* Blend calculation is done in 16.16 fixed-point. */ FT_LOCAL_DEF( FT_Error ) cff_blend_doBlend( CFF_SubFont subFont, CFF_Parser parser, @@ -1364,7 +1364,7 @@ FT_UInt32 sum; - /* convert inputs to 16.16 fixed point */ + /* convert inputs to 16.16 fixed-point */ sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000; for ( j = 1; j < blend->lenBV; j++ ) @@ -1373,7 +1373,7 @@ /* point parser stack to new value on blend_stack */ parser->stack[i + base] = subFont->blend_top; - /* Push blended result as Type 2 5-byte fixed point number. This */ + /* Push blended result as Type 2 5-byte fixed-point number. This */ /* will not conflict with actual DICTs because 255 is a reserved */ /* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */ /* decode of this, which rounds to an integer. */ diff --git a/lib/freetype/src/cff/cffload.h b/lib/freetype/src/cff/cffload.h index a3cc642b7..5a41cdebc 100644 --- a/lib/freetype/src/cff/cffload.h +++ b/lib/freetype/src/cff/cffload.h @@ -4,7 +4,7 @@ * * OpenType & CFF data/program tables loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cffobjs.c b/lib/freetype/src/cff/cffobjs.c index fa42accb6..40cd9bf91 100644 --- a/lib/freetype/src/cff/cffobjs.c +++ b/lib/freetype/src/cff/cffobjs.c @@ -4,7 +4,7 @@ * * OpenType objects manager (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1031,12 +1031,10 @@ cffface->style_flags = flags; } -#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES /* CID-keyed CFF or CFF2 fonts don't have glyph names -- the SFNT */ /* loader has unset this flag because of the 3.0 `post' table. */ if ( dict->cid_registry == 0xFFFFU && !cff2 ) cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; -#endif if ( dict->cid_registry != 0xFFFFU && pure_cff ) cffface->face_flags |= FT_FACE_FLAG_CID_KEYED; diff --git a/lib/freetype/src/cff/cffobjs.h b/lib/freetype/src/cff/cffobjs.h index d48c1cded..8f05f6132 100644 --- a/lib/freetype/src/cff/cffobjs.h +++ b/lib/freetype/src/cff/cffobjs.h @@ -4,7 +4,7 @@ * * OpenType objects manager (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cffparse.c b/lib/freetype/src/cff/cffparse.c index 2536a2186..e16206fd5 100644 --- a/lib/freetype/src/cff/cffparse.c +++ b/lib/freetype/src/cff/cffparse.c @@ -4,7 +4,7 @@ * * CFF token stream parser (body) * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -530,7 +530,7 @@ else if ( **d == 255 ) { - /* 16.16 fixed point is used internally for CFF2 blend results. */ + /* 16.16 fixed-point is used internally for CFF2 blend results. */ /* Since these are trusted values, a limit check is not needed. */ /* After the 255, 4 bytes give the number. */ @@ -758,12 +758,12 @@ *upm = (FT_ULong)power_tens[-max_scaling]; FT_TRACE4(( " [%f %f %f %f %f %f]\n", - (double)matrix->xx / *upm / 65536, - (double)matrix->xy / *upm / 65536, - (double)matrix->yx / *upm / 65536, - (double)matrix->yy / *upm / 65536, - (double)offset->x / *upm / 65536, - (double)offset->y / *upm / 65536 )); + (double)matrix->xx / (double)*upm / 65536, + (double)matrix->xy / (double)*upm / 65536, + (double)matrix->yx / (double)*upm / 65536, + (double)matrix->yy / (double)*upm / 65536, + (double)offset->x / (double)*upm / 65536, + (double)offset->y / (double)*upm / 65536 )); if ( !FT_Matrix_Check( matrix ) ) { diff --git a/lib/freetype/src/cff/cffparse.h b/lib/freetype/src/cff/cffparse.h index 55b6fe6e7..58d59fa4a 100644 --- a/lib/freetype/src/cff/cffparse.h +++ b/lib/freetype/src/cff/cffparse.h @@ -4,7 +4,7 @@ * * CFF token stream parser (specification) * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/cfftoken.h b/lib/freetype/src/cff/cfftoken.h index 15237de9e..b61cb0e66 100644 --- a/lib/freetype/src/cff/cfftoken.h +++ b/lib/freetype/src/cff/cfftoken.h @@ -4,7 +4,7 @@ * * CFF token definitions (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cff/module.mk b/lib/freetype/src/cff/module.mk index eb1227175..b881d049f 100644 --- a/lib/freetype/src/cff/module.mk +++ b/lib/freetype/src/cff/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/cff/rules.mk b/lib/freetype/src/cff/rules.mk index 569a84c7c..629424adf 100644 --- a/lib/freetype/src/cff/rules.mk +++ b/lib/freetype/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/cid/ciderrs.h b/lib/freetype/src/cid/ciderrs.h index d07da5a01..40a1097d0 100644 --- a/lib/freetype/src/cid/ciderrs.h +++ b/lib/freetype/src/cid/ciderrs.h @@ -4,7 +4,7 @@ * * CID error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidgload.c b/lib/freetype/src/cid/cidgload.c index 24d37d329..ba4b7565d 100644 --- a/lib/freetype/src/cid/cidgload.c +++ b/lib/freetype/src/cid/cidgload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 Glyph Loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidgload.h b/lib/freetype/src/cid/cidgload.h index c06bb29d3..97954d418 100644 --- a/lib/freetype/src/cid/cidgload.h +++ b/lib/freetype/src/cid/cidgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidload.c b/lib/freetype/src/cid/cidload.c index fe8fa1abf..26daa5da7 100644 --- a/lib/freetype/src/cid/cidload.c +++ b/lib/freetype/src/cid/cidload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidload.h b/lib/freetype/src/cid/cidload.h index 90ced9280..d12d2962a 100644 --- a/lib/freetype/src/cid/cidload.h +++ b/lib/freetype/src/cid/cidload.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidobjs.c b/lib/freetype/src/cid/cidobjs.c index c39de6369..06b2139a9 100644 --- a/lib/freetype/src/cid/cidobjs.c +++ b/lib/freetype/src/cid/cidobjs.c @@ -4,7 +4,7 @@ * * CID objects manager (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -153,7 +153,7 @@ } - FT_LOCAL( FT_Error ) + FT_LOCAL_DEF( FT_Error ) cid_size_request( FT_Size size, FT_Size_Request req ) { diff --git a/lib/freetype/src/cid/cidobjs.h b/lib/freetype/src/cid/cidobjs.h index fd76a1cba..83c0c61c3 100644 --- a/lib/freetype/src/cid/cidobjs.h +++ b/lib/freetype/src/cid/cidobjs.h @@ -4,7 +4,7 @@ * * CID objects manager (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidparse.c b/lib/freetype/src/cid/cidparse.c index cfc820561..16889db9b 100644 --- a/lib/freetype/src/cid/cidparse.c +++ b/lib/freetype/src/cid/cidparse.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidparse.h b/lib/freetype/src/cid/cidparse.h index ba363f780..2fd4e7a93 100644 --- a/lib/freetype/src/cid/cidparse.h +++ b/lib/freetype/src/cid/cidparse.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidriver.c b/lib/freetype/src/cid/cidriver.c index a63c01064..f7499237d 100644 --- a/lib/freetype/src/cid/cidriver.c +++ b/lib/freetype/src/cid/cidriver.c @@ -4,7 +4,7 @@ * * CID driver interface (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidriver.h b/lib/freetype/src/cid/cidriver.h index 5073b7a8e..a6249385c 100644 --- a/lib/freetype/src/cid/cidriver.h +++ b/lib/freetype/src/cid/cidriver.h @@ -4,7 +4,7 @@ * * High-level CID driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/cidtoken.h b/lib/freetype/src/cid/cidtoken.h index 7640137ea..925951acd 100644 --- a/lib/freetype/src/cid/cidtoken.h +++ b/lib/freetype/src/cid/cidtoken.h @@ -4,7 +4,7 @@ * * CID token definitions (specification only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/cid/module.mk b/lib/freetype/src/cid/module.mk index d4beef80e..563cb3489 100644 --- a/lib/freetype/src/cid/module.mk +++ b/lib/freetype/src/cid/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/cid/rules.mk b/lib/freetype/src/cid/rules.mk index 7ed85291f..c526ad38d 100644 --- a/lib/freetype/src/cid/rules.mk +++ b/lib/freetype/src/cid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/cid/type1cid.c b/lib/freetype/src/cid/type1cid.c index b32c26137..905c896a3 100644 --- a/lib/freetype/src/cid/type1cid.c +++ b/lib/freetype/src/cid/type1cid.c @@ -4,7 +4,7 @@ * * FreeType OpenType driver component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/dlg/dlgwrap.c b/lib/freetype/src/dlg/dlgwrap.c index b149b7948..271241f0a 100644 --- a/lib/freetype/src/dlg/dlgwrap.c +++ b/lib/freetype/src/dlg/dlgwrap.c @@ -4,7 +4,7 @@ * * Wrapper file for the 'dlg' library (body only) * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/dlg/rules.mk b/lib/freetype/src/dlg/rules.mk index 0afa5d7a0..7f506fd35 100644 --- a/lib/freetype/src/dlg/rules.mk +++ b/lib/freetype/src/dlg/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/src/gxvalid/README b/lib/freetype/src/gxvalid/README index 921b3ac92..0e3db322e 100644 --- a/lib/freetype/src/gxvalid/README +++ b/lib/freetype/src/gxvalid/README @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator ------------------------------------------------------------------------ -Copyright (C) 2004-2022 by +Copyright (C) 2004-2023 by suzuki toshiya, Masatake YAMATO, Red hat K.K., David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/lib/freetype/src/gxvalid/gxvalid.c b/lib/freetype/src/gxvalid/gxvalid.c index 9f380337c..e0359f4df 100644 --- a/lib/freetype/src/gxvalid/gxvalid.c +++ b/lib/freetype/src/gxvalid/gxvalid.c @@ -4,7 +4,7 @@ * * FreeType validator for TrueTypeGX/AAT tables (body only). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvalid.h b/lib/freetype/src/gxvalid/gxvalid.h index 170fde340..a83408b41 100644 --- a/lib/freetype/src/gxvalid/gxvalid.h +++ b/lib/freetype/src/gxvalid/gxvalid.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT table validation (specification only). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvbsln.c b/lib/freetype/src/gxvalid/gxvbsln.c index 9784d18c5..030a64ee4 100644 --- a/lib/freetype/src/gxvalid/gxvbsln.c +++ b/lib/freetype/src/gxvalid/gxvbsln.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT bsln table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvcommn.c b/lib/freetype/src/gxvalid/gxvcommn.c index 999cba4e4..7f908742a 100644 --- a/lib/freetype/src/gxvalid/gxvcommn.c +++ b/lib/freetype/src/gxvalid/gxvcommn.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common tables validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvcommn.h b/lib/freetype/src/gxvalid/gxvcommn.h index 794cf0a44..f88d23a41 100644 --- a/lib/freetype/src/gxvalid/gxvcommn.h +++ b/lib/freetype/src/gxvalid/gxvcommn.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common tables validation (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxverror.h b/lib/freetype/src/gxvalid/gxverror.h index 8d2faac80..09311ed3c 100644 --- a/lib/freetype/src/gxvalid/gxverror.h +++ b/lib/freetype/src/gxvalid/gxverror.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT validation module error codes (specification only). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvfeat.c b/lib/freetype/src/gxvalid/gxvfeat.c index 77200564e..6cf18212a 100644 --- a/lib/freetype/src/gxvalid/gxvfeat.c +++ b/lib/freetype/src/gxvalid/gxvfeat.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT feat table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvfeat.h b/lib/freetype/src/gxvalid/gxvfeat.h index 3deeb521d..b33c1bc68 100644 --- a/lib/freetype/src/gxvalid/gxvfeat.h +++ b/lib/freetype/src/gxvalid/gxvfeat.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT feat table validation (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvfgen.c b/lib/freetype/src/gxvalid/gxvfgen.c index 57f11a841..115354228 100644 --- a/lib/freetype/src/gxvalid/gxvfgen.c +++ b/lib/freetype/src/gxvalid/gxvfgen.c @@ -5,7 +5,7 @@ * Generate feature registry data for gxv `feat' validator. * This program is derived from gxfeatreg.c in gxlayout. * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * Masatake YAMATO and Redhat K.K. * * This file may only be used, diff --git a/lib/freetype/src/gxvalid/gxvjust.c b/lib/freetype/src/gxvalid/gxvjust.c index 6af2c79c8..5cca94d8f 100644 --- a/lib/freetype/src/gxvalid/gxvjust.c +++ b/lib/freetype/src/gxvalid/gxvjust.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT just table validation (body). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -156,7 +156,6 @@ { FT_Bytes p = table; FT_Bytes wdc_end = table + GXV_JUST_DATA( wdc_offset_max ); - FT_UInt i; GXV_NAME_ENTER( "just justDeltaClusters" ); @@ -164,7 +163,7 @@ if ( limit <= wdc_end ) FT_INVALID_OFFSET; - for ( i = 0; p <= wdc_end; i++ ) + while ( p <= wdc_end ) { gxv_just_wdc_entry_validate( p, limit, gxvalid ); p += gxvalid->subtable_length; diff --git a/lib/freetype/src/gxvalid/gxvkern.c b/lib/freetype/src/gxvalid/gxvkern.c index f0804e37b..21fc24596 100644 --- a/lib/freetype/src/gxvalid/gxvkern.c +++ b/lib/freetype/src/gxvalid/gxvkern.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT kern table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvlcar.c b/lib/freetype/src/gxvalid/gxvlcar.c index be6e491f9..5f3bf8907 100644 --- a/lib/freetype/src/gxvalid/gxvlcar.c +++ b/lib/freetype/src/gxvalid/gxvlcar.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT lcar table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmod.c b/lib/freetype/src/gxvalid/gxvmod.c index 8c505dd23..0b4115bbc 100644 --- a/lib/freetype/src/gxvalid/gxvmod.c +++ b/lib/freetype/src/gxvalid/gxvmod.c @@ -4,7 +4,7 @@ * * FreeType's TrueTypeGX/AAT validation module implementation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmod.h b/lib/freetype/src/gxvalid/gxvmod.h index 1758d4c86..db3d1d9f5 100644 --- a/lib/freetype/src/gxvalid/gxvmod.h +++ b/lib/freetype/src/gxvalid/gxvmod.h @@ -5,7 +5,7 @@ * FreeType's TrueTypeGX/AAT validation module implementation * (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmort.c b/lib/freetype/src/gxvalid/gxvmort.c index 01a77d6a5..7032d6349 100644 --- a/lib/freetype/src/gxvalid/gxvmort.c +++ b/lib/freetype/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT mort table validation (body). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmort.h b/lib/freetype/src/gxvalid/gxvmort.h index 1a1d8961b..5c819bdbc 100644 --- a/lib/freetype/src/gxvalid/gxvmort.h +++ b/lib/freetype/src/gxvalid/gxvmort.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common definition for mort table (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmort0.c b/lib/freetype/src/gxvalid/gxvmort0.c index fa6c7368f..24e70a0da 100644 --- a/lib/freetype/src/gxvalid/gxvmort0.c +++ b/lib/freetype/src/gxvalid/gxvmort0.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type0 (Indic Script Rearrangement) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmort1.c b/lib/freetype/src/gxvalid/gxvmort1.c index 170acee2c..ea5591f98 100644 --- a/lib/freetype/src/gxvalid/gxvmort1.c +++ b/lib/freetype/src/gxvalid/gxvmort1.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type1 (Contextual Substitution) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmort2.c b/lib/freetype/src/gxvalid/gxvmort2.c index faf446741..50644f06a 100644 --- a/lib/freetype/src/gxvalid/gxvmort2.c +++ b/lib/freetype/src/gxvalid/gxvmort2.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type2 (Ligature Substitution) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmort4.c b/lib/freetype/src/gxvalid/gxvmort4.c index 12555da82..0641b1133 100644 --- a/lib/freetype/src/gxvalid/gxvmort4.c +++ b/lib/freetype/src/gxvalid/gxvmort4.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type4 (Non-Contextual Glyph Substitution) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmort5.c b/lib/freetype/src/gxvalid/gxvmort5.c index 48caac434..9225bb0c6 100644 --- a/lib/freetype/src/gxvalid/gxvmort5.c +++ b/lib/freetype/src/gxvalid/gxvmort5.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type5 (Contextual Glyph Insertion) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmorx.c b/lib/freetype/src/gxvalid/gxvmorx.c index 4b848b1e1..931bf006b 100644 --- a/lib/freetype/src/gxvalid/gxvmorx.c +++ b/lib/freetype/src/gxvalid/gxvmorx.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT morx table validation (body). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmorx.h b/lib/freetype/src/gxvalid/gxvmorx.h index a849d573b..27572553d 100644 --- a/lib/freetype/src/gxvalid/gxvmorx.h +++ b/lib/freetype/src/gxvalid/gxvmorx.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common definition for morx table (specification). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmorx0.c b/lib/freetype/src/gxvalid/gxvmorx0.c index 7eb27d143..73523f363 100644 --- a/lib/freetype/src/gxvalid/gxvmorx0.c +++ b/lib/freetype/src/gxvalid/gxvmorx0.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type0 (Indic Script Rearrangement) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmorx1.c b/lib/freetype/src/gxvalid/gxvmorx1.c index 6ffbf151b..71a201880 100644 --- a/lib/freetype/src/gxvalid/gxvmorx1.c +++ b/lib/freetype/src/gxvalid/gxvmorx1.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type1 (Contextual Substitution) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmorx2.c b/lib/freetype/src/gxvalid/gxvmorx2.c index eb79e9b40..858c81143 100644 --- a/lib/freetype/src/gxvalid/gxvmorx2.c +++ b/lib/freetype/src/gxvalid/gxvmorx2.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type2 (Ligature Substitution) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmorx4.c b/lib/freetype/src/gxvalid/gxvmorx4.c index 30c602cb8..c9ad19906 100644 --- a/lib/freetype/src/gxvalid/gxvmorx4.c +++ b/lib/freetype/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-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvmorx5.c b/lib/freetype/src/gxvalid/gxvmorx5.c index afdef05a8..95fa4e288 100644 --- a/lib/freetype/src/gxvalid/gxvmorx5.c +++ b/lib/freetype/src/gxvalid/gxvmorx5.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type5 (Contextual Glyph Insertion) subtable. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvopbd.c b/lib/freetype/src/gxvalid/gxvopbd.c index a6b04a4b1..5e9a9665e 100644 --- a/lib/freetype/src/gxvalid/gxvopbd.c +++ b/lib/freetype/src/gxvalid/gxvopbd.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT opbd table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvprop.c b/lib/freetype/src/gxvalid/gxvprop.c index bf1ed112f..63a052a8e 100644 --- a/lib/freetype/src/gxvalid/gxvprop.c +++ b/lib/freetype/src/gxvalid/gxvprop.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT prop table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/gxvtrak.c b/lib/freetype/src/gxvalid/gxvtrak.c index 93ac3e76a..f3fb51c8a 100644 --- a/lib/freetype/src/gxvalid/gxvtrak.c +++ b/lib/freetype/src/gxvalid/gxvtrak.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT trak table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/lib/freetype/src/gxvalid/module.mk b/lib/freetype/src/gxvalid/module.mk index 7635587c3..49491348a 100644 --- a/lib/freetype/src/gxvalid/module.mk +++ b/lib/freetype/src/gxvalid/module.mk @@ -2,7 +2,7 @@ # FreeType 2 gxvalid module definition # -# Copyright (C) 2004-2022 by +# Copyright (C) 2004-2023 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/lib/freetype/src/gxvalid/rules.mk b/lib/freetype/src/gxvalid/rules.mk index cc103b270..95ae6334e 100644 --- a/lib/freetype/src/gxvalid/rules.mk +++ b/lib/freetype/src/gxvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2022 by +# Copyright (C) 2004-2023 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/lib/freetype/src/gzip/README.freetype b/lib/freetype/src/gzip/README.freetype index 493b80719..e0c8ced18 100644 --- a/lib/freetype/src/gzip/README.freetype +++ b/lib/freetype/src/gzip/README.freetype @@ -18,5 +18,6 @@ The files in this directory have been prepared as follows. - Take the unmodified source code files from the zlib distribution that are included by `ftgzip.c`. + - Copy `zconf.h` to `ftzconf.h` (which stays unmodified otherwise). - Run zlib's `zlib2ansi` script on all `.c` files. - Apply the diff file(s) in the `patches` folder. diff --git a/lib/freetype/src/gzip/crc32.c b/lib/freetype/src/gzip/crc32.c index 827a1ed5d..8b7ba414e 100644 --- a/lib/freetype/src/gzip/crc32.c +++ b/lib/freetype/src/gzip/crc32.c @@ -7,7 +7,7 @@ * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. */ -/* @(#) $Id: crc32.c,v 1.1 2022/07/23 19:27:30 matthieu Exp $ */ +/* @(#) $Id: crc32.c,v 1.2 2023/05/21 09:25:32 matthieu Exp $ */ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore @@ -98,13 +98,24 @@ # endif #endif +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif + +#ifndef Z_FREETYPE /* Local functions. */ local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); +#endif /* Z_FREETYPE */ -/* If available, use the ARM processor CRC32 instruction. */ -#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 -# define ARMCRC32 +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +#endif + +#if defined(W) && !defined(ARMCRC32) + local z_crc_t crc_word OF((z_word_t data)); + local z_word_t crc_word_big OF((z_word_t data)); #endif #if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) @@ -535,6 +546,8 @@ local void braid(ltl, big, n, w) * generation above. */ +#ifndef Z_FREETYPE + /* Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, reflected. For speed, this requires that a not be zero. @@ -591,6 +604,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table() return (const z_crc_t FAR *)crc_table; } +#endif /* Z_FREETYPE */ + /* ========================================================================= * Use ARM machine instructions if available. This will compute the CRC about * ten times faster than the braided calculation. This code does not check for @@ -630,7 +645,7 @@ unsigned long ZEXPORT crc32_z( #endif /* DYNAMIC_CRC_TABLE */ /* Pre-condition the CRC */ - crc ^= 0xffffffff; + crc = (~crc) & 0xffffffff; /* Compute the CRC up to a word boundary. */ while (len && ((z_size_t)buf & 7) != 0) { @@ -645,8 +660,8 @@ unsigned long ZEXPORT crc32_z( len &= 7; /* Do three interleaved CRCs to realize the throughput of one crc32x - instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three - CRCs are combined into a single CRC after each set of batches. */ + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ while (num >= 3 * Z_BATCH) { crc1 = 0; crc2 = 0; @@ -749,7 +764,7 @@ unsigned long ZEXPORT crc32_z( #endif /* DYNAMIC_CRC_TABLE */ /* Pre-condition the CRC */ - crc ^= 0xffffffff; + crc = (~crc) & 0xffffffff; #ifdef W @@ -1068,6 +1083,8 @@ unsigned long ZEXPORT crc32( return crc32_z(crc, buf, len); } +#ifndef Z_FREETYPE + /* ========================================================================= */ uLong ZEXPORT crc32_combine64( uLong crc1, @@ -1077,7 +1094,7 @@ uLong ZEXPORT crc32_combine64( #ifdef DYNAMIC_CRC_TABLE once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ - return multmodp(x2nmodp(len2, 3), crc1) ^ crc2; + return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); } /* ========================================================================= */ @@ -1086,7 +1103,7 @@ uLong ZEXPORT crc32_combine( uLong crc2, z_off_t len2) { - return crc32_combine64(crc1, crc2, len2); + return crc32_combine64(crc1, crc2, (z_off64_t)len2); } /* ========================================================================= */ @@ -1103,14 +1120,16 @@ uLong ZEXPORT crc32_combine_gen64( uLong ZEXPORT crc32_combine_gen( z_off_t len2) { - return crc32_combine_gen64(len2); + return crc32_combine_gen64((z_off64_t)len2); } /* ========================================================================= */ -uLong crc32_combine_op( +uLong ZEXPORT crc32_combine_op( uLong crc1, uLong crc2, uLong op) { - return multmodp(op, crc1) ^ crc2; + return multmodp(op, crc1) ^ (crc2 & 0xffffffff); } + +#endif /* Z_FREETYPE */ diff --git a/lib/freetype/src/gzip/ftgzip.c b/lib/freetype/src/gzip/ftgzip.c index 34bbe4daf..48da6ff9c 100644 --- a/lib/freetype/src/gzip/ftgzip.c +++ b/lib/freetype/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ * parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -70,20 +70,14 @@ /* so that configuration with `FT_CONFIG_OPTION_SYSTEM_ZLIB' might */ /* include the wrong `zconf.h' file, leading to errors. */ - /* `HAVE_HIDDEN` should be defined if */ - /* */ - /* __attribute__((visibility("hidden"))) */ - /* */ - /* is supported by the compiler, which prevents internal symbols from */ - /* being exported by the library. */ #if defined( __GNUC__ ) || defined( __clang__ ) -#define HAVE_HIDDEN 1 #define ZEXPORT #define ZEXTERN static #endif -#define Z_SOLO 1 -#define Z_FREETYPE 1 +#define HAVE_MEMCPY 1 +#define Z_SOLO 1 +#define Z_FREETYPE 1 #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ /* We disable the warning `conversion from XXX to YYY, */ @@ -96,7 +90,9 @@ #if defined( __GNUC__ ) #pragma GCC diagnostic push +#ifndef __cplusplus #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif @@ -157,28 +153,6 @@ FT_MEM_FREE( address ); } - -#if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC ) - - voidpf ZLIB_INTERNAL - zcalloc ( voidpf opaque, - unsigned items, - unsigned size ) - { - return ft_gzip_alloc( opaque, items, size ); - } - - - void ZLIB_INTERNAL - zcfree( voidpf opaque, - voidpf ptr ) - { - ft_gzip_free( opaque, ptr ); - } - -#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */ - - /***************************************************************************/ /***************************************************************************/ /***** *****/ @@ -790,6 +764,9 @@ if ( err == Z_DATA_ERROR ) return FT_THROW( Invalid_Table ); + if ( err == Z_NEED_DICT ) + return FT_THROW( Invalid_Table ); + return FT_Err_Ok; } diff --git a/lib/freetype/src/gzip/ftzconf.h b/lib/freetype/src/gzip/ftzconf.h index 7af9b00f1..6df777486 100644 --- a/lib/freetype/src/gzip/ftzconf.h +++ b/lib/freetype/src/gzip/ftzconf.h @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: ftzconf.h,v 1.2 2022/07/23 19:27:31 matthieu Exp $ */ +/* @(#) $Id: ftzconf.h,v 1.3 2023/05/21 09:25:32 matthieu Exp $ */ #ifndef ZCONF_H #define ZCONF_H @@ -38,6 +38,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -349,6 +352,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include <windows.h> /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -467,11 +473,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include <unixio.h> /* for off_t */ diff --git a/lib/freetype/src/gzip/infback.c b/lib/freetype/src/gzip/infback.c index 5fb8c6794..264c14e0d 100644 --- a/lib/freetype/src/gzip/infback.c +++ b/lib/freetype/src/gzip/infback.c @@ -66,6 +66,7 @@ int ZEXPORT inflateBackInit_( state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -605,25 +606,27 @@ int ZEXPORT inflateBack( break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ inf_leave: + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left) && + ret == Z_STREAM_END) + ret = Z_BUF_ERROR; + } strm->next_in = next; strm->avail_in = have; return ret; diff --git a/lib/freetype/src/gzip/inffast.h b/lib/freetype/src/gzip/inffast.h index e5c1aa4ca..684ae878c 100644 --- a/lib/freetype/src/gzip/inffast.h +++ b/lib/freetype/src/gzip/inffast.h @@ -8,4 +8,4 @@ subject to change. Applications should only use zlib.h. */ -void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); +static void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/lib/freetype/src/gzip/inflate.c b/lib/freetype/src/gzip/inflate.c index 5bf5b815e..5117e2e26 100644 --- a/lib/freetype/src/gzip/inflate.c +++ b/lib/freetype/src/gzip/inflate.c @@ -170,6 +170,8 @@ int ZEXPORT inflateReset2( /* extract wrap request from windowBits parameter */ if (windowBits < 0) { + if (windowBits < -15) + return Z_STREAM_ERROR; wrap = 0; windowBits = -windowBits; } @@ -239,6 +241,8 @@ int ZEXPORT inflateInit2_( return ret; } +#ifndef Z_FREETYPE + int ZEXPORT inflateInit_( z_streamp strm, const char *version, @@ -247,8 +251,6 @@ int ZEXPORT inflateInit_( return inflateInit2_(strm, DEF_WBITS, version, stream_size); } -#ifndef Z_FREETYPE - int ZEXPORT inflatePrime( z_streamp strm, int bits, @@ -770,8 +772,9 @@ int ZEXPORT inflate( if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); @@ -1479,8 +1482,6 @@ int ZEXPORT inflateSync( return Z_OK; } -#endif /* !Z_FREETYPE */ - /* Returns true if inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP @@ -1499,8 +1500,6 @@ int ZEXPORT inflateSyncPoint( return state->mode == STORED && state->bits == 0; } -#ifndef Z_FREETYPE - int ZEXPORT inflateCopy( z_streamp dest, z_streamp source) @@ -1548,8 +1547,6 @@ int ZEXPORT inflateCopy( return Z_OK; } -#endif /* !Z_FREETYPE */ - int ZEXPORT inflateUndermine( z_streamp strm, int subvert) @@ -1583,8 +1580,6 @@ int ZEXPORT inflateValidate( return Z_OK; } -#ifndef Z_FREETYPE - long ZEXPORT inflateMark( z_streamp strm) { diff --git a/lib/freetype/src/gzip/inftrees.c b/lib/freetype/src/gzip/inftrees.c index 0b58b29b1..dd4965e9a 100644 --- a/lib/freetype/src/gzip/inftrees.c +++ b/lib/freetype/src/gzip/inftrees.c @@ -8,8 +8,8 @@ #define MAXBITS 15 -const char inflate_copyright[] = - " inflate 1.2.12 Copyright 1995-2022 Mark Adler "; +static const char inflate_copyright[] = + " inflate 1.2.13 Copyright 1995-2022 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 @@ -62,7 +62,7 @@ int ZLIB_INTERNAL inflate_table( 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, 199, 202}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65}; 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/lib/freetype/src/gzip/inftrees.h b/lib/freetype/src/gzip/inftrees.h index c94eb78b5..a2207efb1 100644 --- a/lib/freetype/src/gzip/inftrees.h +++ b/lib/freetype/src/gzip/inftrees.h @@ -41,7 +41,7 @@ typedef struct { /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that + 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. @@ -60,7 +60,7 @@ typedef enum { DISTS } codetype; -int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, +static int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, unsigned codes, code FAR * FAR *table, unsigned FAR *bits, unsigned short FAR *work)); diff --git a/lib/freetype/src/gzip/patches/freetype-zlib.diff b/lib/freetype/src/gzip/patches/freetype-zlib.diff index 20d84293f..6ac76df62 100644 --- a/lib/freetype/src/gzip/patches/freetype-zlib.diff +++ b/lib/freetype/src/gzip/patches/freetype-zlib.diff @@ -3,19 +3,22 @@ We must ensure that they do not issue compiler errors or warnings when they are compiled as part of `src/gzip/ftgzip.c`. -* src/gzip/adler32.c: Do not define unused functions when `Z_FREETYPE` -is set. - * src/gzip/gzguts.h (COPY): Rename to... (COPY__): ... this since `COPY` and `COPY_` conflict with enum values, which have the same name in `zlib.h`. -* src/gzip/inflate.c, src/gzip/adler32.c: Omit unused function -declarations when `Z_FREETYPE` is defined. +* src/gzip/inflate.c, src/gzip/adler32.c, src/gzip/crc32.c, +src/gzip/zutil.c: Omit unused function declarations and definitions when +`Z_FREETYPE` is defined. + +* src/gzip/inffast.h (inflate_fast): Declare as static. + +* src/gzip/inftrees.c (inflate_copyright): Declare as static. * src/gzip/zlib.h: Include `ftzconf.h` instead of `zconf.h` to avoid conflicts with system-installed headers. Omit unused function declarations when `Z_FREETYPE` is defined. +(inflateInit2)[Z_FREETYPE]: Provide proper declaration. * src/gzip/zutil.h: Use `ft_memxxx` functions instead of `memxxx`. Omit unused function declarations when `Z_FREETYPE` is defined. @@ -23,10 +26,13 @@ Omit unused function declarations when `Z_FREETYPE` is defined. * src/gzip/inflate.h, src/gzip/inftrees.h: Add header guard macros to prevent compiler errors. -diff --git a/src/gzip/adler32.c b/src/gzip/adler32.c +* src/gzip/inftrees.h: Add header guard macros to prevent compiler errors. +(inflate_table): Declare as static. + +diff --git b/src/gzip/adler32.c a/src/gzip/adler32.c index be5e8a247..aa032e1dd 100644 ---- a/src/gzip/adler32.c -+++ b/src/gzip/adler32.c +--- b/src/gzip/adler32.c ++++ a/src/gzip/adler32.c @@ -7,7 +7,9 @@ #include "zutil.h" @@ -52,10 +58,59 @@ index be5e8a247..aa032e1dd 100644 } + +#endif /* !Z_FREETYPE */ -diff --git a/src/gzip/gzguts.h b/src/gzip/gzguts.h +diff --git b/src/gzip/crc32.c a/src/gzip/crc32.c +index 3a52aa89d..6cd1b09d5 100644 +--- b/src/gzip/crc32.c ++++ a/src/gzip/crc32.c +@@ -103,9 +103,11 @@ + # define ARMCRC32 + #endif + ++#ifndef Z_FREETYPE + /* Local functions. */ + local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); + local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); ++#endif /* Z_FREETYPE */ + + #if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +@@ -544,6 +546,8 @@ local void braid(ltl, big, n, w) + * generation above. + */ + ++#ifndef Z_FREETYPE ++ + /* + Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, + reflected. For speed, this requires that a not be zero. +@@ -600,6 +604,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table() + return (const z_crc_t FAR *)crc_table; + } + ++#endif /* Z_FREETYPE */ ++ + /* ========================================================================= + * Use ARM machine instructions if available. This will compute the CRC about + * ten times faster than the braided calculation. This code does not check for +@@ -1077,6 +1083,8 @@ unsigned long ZEXPORT crc32( + return crc32_z(crc, buf, len); + } + ++#ifndef Z_FREETYPE ++ + /* ========================================================================= */ + uLong ZEXPORT crc32_combine64( + uLong crc1, +@@ -1123,3 +1131,5 @@ uLong ZEXPORT crc32_combine_op( + { + return multmodp(op, crc1) ^ (crc2 & 0xffffffff); + } ++ ++#endif /* Z_FREETYPE */ +diff --git b/src/gzip/gzguts.h a/src/gzip/gzguts.h index 57faf3716..4f09a52a7 100644 ---- a/src/gzip/gzguts.h -+++ b/src/gzip/gzguts.h +--- b/src/gzip/gzguts.h ++++ a/src/gzip/gzguts.h @@ -163,7 +163,7 @@ /* values for gz_state how */ @@ -65,10 +120,20 @@ index 57faf3716..4f09a52a7 100644 #define GZIP 2 /* decompress a gzip stream */ /* internal gzip file state data structure */ -diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c -index 4375557b4..5bf5b815e 100644 ---- a/src/gzip/inflate.c -+++ b/src/gzip/inflate.c +diff --git b/src/gzip/inffast.h a/src/gzip/inffast.h +index e5c1aa4ca..684ae878c 100644 +--- b/src/gzip/inffast.h ++++ a/src/gzip/inffast.h +@@ -8,4 +8,4 @@ + subject to change. Applications should only use zlib.h. + */ + +-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); ++static void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); +diff --git b/src/gzip/inflate.c a/src/gzip/inflate.c +index c9e566b03..5117e2e26 100644 +--- b/src/gzip/inflate.c ++++ a/src/gzip/inflate.c @@ -99,8 +99,10 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, #ifdef BUILDFIXED void makefixed OF((void)); @@ -80,16 +145,16 @@ index 4375557b4..5bf5b815e 100644 local int inflateStateCheck( z_streamp strm) -@@ -245,6 +247,8 @@ int ZEXPORT inflateInit_( - return inflateInit2_(strm, DEF_WBITS, version, stream_size); +@@ -239,6 +241,8 @@ int ZEXPORT inflateInit2_( + return ret; } +#ifndef Z_FREETYPE + - int ZEXPORT inflatePrime( + int ZEXPORT inflateInit_( z_streamp strm, - int bits, -@@ -266,6 +270,8 @@ int ZEXPORT inflatePrime( + const char *version, +@@ -268,6 +272,8 @@ int ZEXPORT inflatePrime( return Z_OK; } @@ -98,7 +163,7 @@ index 4375557b4..5bf5b815e 100644 /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. -@@ -1312,6 +1318,8 @@ int ZEXPORT inflateEnd( +@@ -1315,6 +1321,8 @@ int ZEXPORT inflateEnd( return Z_OK; } @@ -107,52 +172,16 @@ index 4375557b4..5bf5b815e 100644 int ZEXPORT inflateGetDictionary( z_streamp strm, Bytef *dictionary, -@@ -1471,6 +1479,8 @@ int ZEXPORT inflateSync( - return Z_OK; - } - -+#endif /* !Z_FREETYPE */ -+ - /* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP -@@ -1489,6 +1499,8 @@ int ZEXPORT inflateSyncPoint( - return state->mode == STORED && state->bits == 0; - } - -+#ifndef Z_FREETYPE -+ - int ZEXPORT inflateCopy( - z_streamp dest, - z_streamp source) -@@ -1536,6 +1548,8 @@ int ZEXPORT inflateCopy( - return Z_OK; - } - -+#endif /* !Z_FREETYPE */ -+ - int ZEXPORT inflateUndermine( - z_streamp strm, - int subvert) -@@ -1569,6 +1583,8 @@ int ZEXPORT inflateValidate( - return Z_OK; - } - -+#ifndef Z_FREETYPE -+ - long ZEXPORT inflateMark( - z_streamp strm) - { -@@ -1590,3 +1606,5 @@ unsigned long ZEXPORT inflateCodesUsed( +@@ -1593,3 +1601,5 @@ unsigned long ZEXPORT inflateCodesUsed( state = (struct inflate_state FAR *)strm->state; return (unsigned long)(state->next - state->codes); } + +#endif /* !Z_FREETYPE */ -diff --git a/src/gzip/inflate.h b/src/gzip/inflate.h +diff --git b/src/gzip/inflate.h a/src/gzip/inflate.h index f127b6b1f..c6f5a52e1 100644 ---- a/src/gzip/inflate.h -+++ b/src/gzip/inflate.h +--- b/src/gzip/inflate.h ++++ a/src/gzip/inflate.h @@ -3,6 +3,9 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -169,10 +198,23 @@ index f127b6b1f..c6f5a52e1 100644 }; + +#endif /* INFLATE_H */ -diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h -index baa53a0b1..c94eb78b5 100644 ---- a/src/gzip/inftrees.h -+++ b/src/gzip/inftrees.h +diff --git b/src/gzip/inftrees.c a/src/gzip/inftrees.c +index d8405a24c..dd4965e9a 100644 +--- b/src/gzip/inftrees.c ++++ a/src/gzip/inftrees.c +@@ -8,7 +8,7 @@ + + #define MAXBITS 15 + +-const char inflate_copyright[] = ++static const char inflate_copyright[] = + " inflate 1.2.13 Copyright 1995-2022 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 f53665311..a2207efb1 100644 +--- b/src/gzip/inftrees.h ++++ a/src/gzip/inftrees.h @@ -3,6 +3,9 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -183,16 +225,20 @@ index baa53a0b1..c94eb78b5 100644 /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. -@@ -60,3 +63,5 @@ typedef enum { - int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, +@@ -57,6 +60,8 @@ typedef enum { + DISTS + } codetype; + +-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, ++static int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, unsigned codes, code FAR * FAR *table, unsigned FAR *bits, unsigned short FAR *work)); + +#endif /* INFTREES_H_ */ -diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h -index 4a98e38bf..d760140c2 100644 ---- a/src/gzip/zlib.h -+++ b/src/gzip/zlib.h +diff --git b/src/gzip/zlib.h a/src/gzip/zlib.h +index 953cb5012..3f2f76e3c 100644 +--- b/src/gzip/zlib.h ++++ a/src/gzip/zlib.h @@ -31,7 +31,7 @@ #ifndef ZLIB_H #define ZLIB_H @@ -211,15 +257,7 @@ index 4a98e38bf..d760140c2 100644 #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ -@@ -246,7 +248,6 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - this will be done by deflate(). - */ - -- - ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); - /* - deflate compresses as much data as possible, and stops when the input -@@ -373,6 +374,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +@@ -373,6 +375,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); deallocated). */ @@ -227,7 +265,7 @@ index 4a98e38bf..d760140c2 100644 /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); -@@ -534,6 +536,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +@@ -534,6 +537,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); The following functions are needed only in some special applications. */ @@ -236,7 +274,7 @@ index 4a98e38bf..d760140c2 100644 /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, -@@ -956,6 +960,8 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, +@@ -956,6 +961,8 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, destination. */ @@ -245,7 +283,7 @@ index 4a98e38bf..d760140c2 100644 ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, -@@ -980,6 +986,8 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, +@@ -980,6 +987,8 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, the windowBits parameter is invalid. */ @@ -254,7 +292,7 @@ index 4a98e38bf..d760140c2 100644 ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); -@@ -1069,6 +1077,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, +@@ -1069,6 +1078,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, stream state was inconsistent. */ @@ -263,7 +301,7 @@ index 4a98e38bf..d760140c2 100644 /* ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, unsigned char FAR *window)); -@@ -1095,6 +1105,8 @@ typedef unsigned (*in_func) OF((void FAR *, +@@ -1095,6 +1106,8 @@ typedef unsigned (*in_func) OF((void FAR *, z_const unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); @@ -272,7 +310,7 @@ index 4a98e38bf..d760140c2 100644 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); -@@ -1214,6 +1226,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +@@ -1214,6 +1227,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); 27-31: 0 (reserved) */ @@ -281,16 +319,16 @@ index 4a98e38bf..d760140c2 100644 #ifndef Z_SOLO /* utility functions */ -@@ -1742,6 +1756,8 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); - if (crc != original_crc) error(); +@@ -1765,6 +1780,8 @@ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2)); + crc32_combine_op(). */ +#ifndef Z_FREETYPE + - ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf, - z_size_t len)); + ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op)); /* -@@ -1822,6 +1838,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + Give the same result as crc32_combine(), using op in place of len2. op is +@@ -1822,6 +1839,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, ZLIB_VERSION, (int)sizeof(z_stream)) #endif @@ -310,7 +348,7 @@ index 4a98e38bf..d760140c2 100644 #ifndef Z_SOLO /* gzgetc() macro and its supporting function and exposed data structure. Note -@@ -1901,13 +1930,16 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +@@ -1901,20 +1931,25 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ #else /* Z_SOLO */ @@ -327,7 +365,16 @@ index 4a98e38bf..d760140c2 100644 ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); -@@ -1927,6 +1959,7 @@ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, + ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); + ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); + ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp)); ++#endif /* !Z_FREETYPE */ + ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ++#ifndef Z_FREETYPE + ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); + #if defined(_WIN32) && !defined(Z_SOLO) + ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, +@@ -1927,6 +1962,7 @@ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, va_list va)); # endif #endif @@ -335,11 +382,61 @@ index 4a98e38bf..d760140c2 100644 #ifdef __cplusplus } -diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h -index d9a20ae1b..14f0f1a85 100644 ---- a/src/gzip/zutil.h -+++ b/src/gzip/zutil.h -@@ -188,6 +188,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +diff --git b/src/gzip/zutil.c a/src/gzip/zutil.c +index ef174ca64..542706ca0 100644 +--- b/src/gzip/zutil.c ++++ a/src/gzip/zutil.c +@@ -10,6 +10,8 @@ + # include "gzguts.h" + #endif + ++#ifndef Z_FREETYPE ++ + z_const char * const z_errmsg[10] = { + (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ + (z_const char *)"stream end", /* Z_STREAM_END 1 */ +@@ -138,6 +140,8 @@ const char * ZEXPORT zError( + return ERR_MSG(err); + } + ++#endif /* !Z_FREETYPE */ ++ + #if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 + /* The older Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. +@@ -159,6 +163,8 @@ void ZLIB_INTERNAL zmemcpy( + } while (--len != 0); + } + ++#ifndef Z_FREETYPE ++ + int ZLIB_INTERNAL zmemcmp( + const Bytef* s1, + const Bytef* s2, +@@ -181,6 +187,7 @@ void ZLIB_INTERNAL zmemzero( + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); + } ++#endif /* !Z_FREETYPE */ + #endif + + #ifndef Z_SOLO +diff --git b/src/gzip/zutil.h a/src/gzip/zutil.h +index 0bc7f4ecd..055ba8b62 100644 +--- b/src/gzip/zutil.h ++++ a/src/gzip/zutil.h +@@ -53,8 +53,10 @@ typedef unsigned long ulg; + # endif + #endif + ++#ifndef Z_FREETYPE + extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + /* (size given to avoid silly warnings with Visual C++) */ ++#endif /* !Z_FREETYPE */ + + #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +@@ -188,6 +190,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #pragma warn -8066 #endif @@ -348,8 +445,8 @@ index d9a20ae1b..14f0f1a85 100644 /* provide prototypes for these when building zlib without LFS */ #if !defined(_WIN32) && \ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) -@@ -195,6 +197,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +@@ -196,6 +200,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); #endif +#endif /* !Z_FREETYPE */ @@ -357,7 +454,7 @@ index d9a20ae1b..14f0f1a85 100644 /* common defaults */ #ifndef OS_CODE -@@ -226,9 +230,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +@@ -227,9 +233,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/lib/freetype/src/gzip/rules.mk b/lib/freetype/src/gzip/rules.mk index 10c8b41c7..6feb6f51c 100644 --- a/lib/freetype/src/gzip/rules.mk +++ b/lib/freetype/src/gzip/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2022 by +# Copyright (C) 2002-2023 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/lib/freetype/src/gzip/zlib.h b/lib/freetype/src/gzip/zlib.h index d760140c2..3f2f76e3c 100644 --- a/lib/freetype/src/gzip/zlib.h +++ b/lib/freetype/src/gzip/zlib.h @@ -1,5 +1,5 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.12, March 11th, 2022 + version 1.2.13, October 13th, 2022 Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.12" -#define ZLIB_VERNUM 0x12c0 +#define ZLIB_VERSION "1.2.13" +#define ZLIB_VERNUM 0x12d0 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 12 +#define ZLIB_VER_REVISION 13 #define ZLIB_VER_SUBREVISION 0 /* @@ -248,6 +248,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); this will be done by deflate(). */ + ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input @@ -277,7 +278,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput + which can be used if desired to determine whether or not there is more output in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to @@ -664,7 +665,7 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up @@ -919,7 +920,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. @@ -1451,12 +1452,12 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf + multiple of size, then the final partial item is nevertheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior is the same as the behavior of fread() implementations in common libraries, but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. + file, resetting and retrying on end-of-file, when size is not 1. */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); @@ -1756,8 +1757,6 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); if (crc != original_crc) error(); */ -#ifndef Z_FREETYPE - ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf, z_size_t len)); /* @@ -1781,6 +1780,8 @@ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2)); crc32_combine_op(). */ +#ifndef Z_FREETYPE + ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op)); /* Give the same result as crc32_combine(), using op in place of len2. op is @@ -1945,8 +1946,10 @@ ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp)); +#endif /* !Z_FREETYPE */ ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +#ifndef Z_FREETYPE ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); #if defined(_WIN32) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, diff --git a/lib/freetype/src/gzip/zutil.c b/lib/freetype/src/gzip/zutil.c index ed4e61f87..596bff323 100644 --- a/lib/freetype/src/gzip/zutil.c +++ b/lib/freetype/src/gzip/zutil.c @@ -3,13 +3,15 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: zutil.c,v 1.11 2022/07/23 19:27:31 matthieu Exp $ */ +/* @(#) $Id: zutil.c,v 1.12 2023/05/21 09:25:32 matthieu Exp $ */ #include "zutil.h" #ifndef Z_SOLO # include "gzguts.h" #endif +#ifndef Z_FREETYPE + z_const char * const z_errmsg[10] = { (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ (z_const char *)"stream end", /* Z_STREAM_END 1 */ @@ -61,9 +63,11 @@ uLong ZEXPORT zlibCompileFlags() #ifdef ZLIB_DEBUG flags += 1 << 8; #endif + /* #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif + */ #ifdef ZLIB_WINAPI flags += 1 << 10; #endif @@ -119,7 +123,7 @@ uLong ZEXPORT zlibCompileFlags() # endif int ZLIB_INTERNAL z_verbose = verbose; -void ZLIB_INTERNAL z_error ( +void ZLIB_INTERNAL z_error( char *m) { fprintf(stderr, "%s\n", m); @@ -136,6 +140,8 @@ const char * ZEXPORT zError( return ERR_MSG(err); } +#endif /* !Z_FREETYPE */ + #if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 /* The older Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. @@ -157,6 +163,8 @@ void ZLIB_INTERNAL zmemcpy( } while (--len != 0); } +#ifndef Z_FREETYPE + int ZLIB_INTERNAL zmemcmp( const Bytef* s1, const Bytef* s2, @@ -179,6 +187,7 @@ void ZLIB_INTERNAL zmemzero( *dest++ = 0; /* ??? to be unrolled */ } while (--len != 0); } +#endif /* !Z_FREETYPE */ #endif #ifndef Z_SOLO @@ -214,7 +223,7 @@ local ptr_table table[MAX_PTR]; * a protected system like OS/2. Use Microsoft C instead. */ -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { voidpf buf; ulg bsize = (ulg)items*size; @@ -240,7 +249,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) return buf; } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { int n; @@ -277,13 +286,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) # define _hfree hfree #endif -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) { (void)opaque; return _halloc((long)items, size); } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { (void)opaque; _hfree(ptr); @@ -302,7 +311,7 @@ extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif -voidpf ZLIB_INTERNAL zcalloc ( +voidpf ZLIB_INTERNAL zcalloc( voidpf opaque, unsigned items, unsigned size) @@ -312,7 +321,7 @@ voidpf ZLIB_INTERNAL zcalloc ( (voidpf)calloc(items, size); } -void ZLIB_INTERNAL zcfree ( +void ZLIB_INTERNAL zcfree( voidpf opaque, voidpf ptr) { diff --git a/lib/freetype/src/gzip/zutil.h b/lib/freetype/src/gzip/zutil.h index 0898ff691..0e3a68483 100644 --- a/lib/freetype/src/gzip/zutil.h +++ b/lib/freetype/src/gzip/zutil.h @@ -51,8 +51,10 @@ typedef unsigned long ulg; # endif #endif +#ifndef Z_FREETYPE extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ +#endif /* !Z_FREETYPE */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] @@ -193,6 +195,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); #endif #endif /* !Z_FREETYPE */ diff --git a/lib/freetype/src/lzw/ftlzw.c b/lib/freetype/src/lzw/ftlzw.c index e12efcaa5..88383792a 100644 --- a/lib/freetype/src/lzw/ftlzw.c +++ b/lib/freetype/src/lzw/ftlzw.c @@ -8,7 +8,7 @@ * be used to parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * Albert Chin-A-Young. * * based on code in `src/gzip/ftgzip.c' diff --git a/lib/freetype/src/lzw/ftzopen.c b/lib/freetype/src/lzw/ftzopen.c index aaa98be21..e680c4de5 100644 --- a/lib/freetype/src/lzw/ftzopen.c +++ b/lib/freetype/src/lzw/ftzopen.c @@ -8,7 +8,7 @@ * be used to parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner. * * This file is part of the FreeType project, and may only be used, @@ -143,7 +143,7 @@ return -1; } - if ( FT_QRENEW_ARRAY( state->stack, old_size, new_size ) ) + if ( FT_QREALLOC( state->stack, old_size, new_size ) ) return -1; /* if relocating to heap */ @@ -315,7 +315,7 @@ state->phase = FT_LZW_PHASE_CODE; } - /* fall-through */ + FALL_THROUGH; case FT_LZW_PHASE_CODE: { @@ -373,7 +373,7 @@ state->phase = FT_LZW_PHASE_STACK; } - /* fall-through */ + FALL_THROUGH; case FT_LZW_PHASE_STACK: { diff --git a/lib/freetype/src/lzw/ftzopen.h b/lib/freetype/src/lzw/ftzopen.h index 86fccfe3b..6c7563643 100644 --- a/lib/freetype/src/lzw/ftzopen.h +++ b/lib/freetype/src/lzw/ftzopen.h @@ -8,7 +8,7 @@ * be used to parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/lzw/rules.mk b/lib/freetype/src/lzw/rules.mk index d3aa1efad..b750216fb 100644 --- a/lib/freetype/src/lzw/rules.mk +++ b/lib/freetype/src/lzw/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2022 by +# Copyright (C) 2004-2023 by # Albert Chin-A-Young. # # based on `src/lzw/rules.mk' diff --git a/lib/freetype/src/otvalid/module.mk b/lib/freetype/src/otvalid/module.mk index 1d08012e4..90138426e 100644 --- a/lib/freetype/src/otvalid/module.mk +++ b/lib/freetype/src/otvalid/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2022 by +# Copyright (C) 2004-2023 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/lib/freetype/src/otvalid/otvalid.c b/lib/freetype/src/otvalid/otvalid.c index f5344ca03..3b1e23a6f 100644 --- a/lib/freetype/src/otvalid/otvalid.c +++ b/lib/freetype/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ * * FreeType validator for OpenType tables (body only). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvalid.h b/lib/freetype/src/otvalid/otvalid.h index 6274858f5..7edadb771 100644 --- a/lib/freetype/src/otvalid/otvalid.h +++ b/lib/freetype/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ * * OpenType table validation (specification only). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvbase.c b/lib/freetype/src/otvalid/otvbase.c index 70de653b1..f449795f8 100644 --- a/lib/freetype/src/otvalid/otvbase.c +++ b/lib/freetype/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ * * OpenType BASE table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvcommn.c b/lib/freetype/src/otvalid/otvcommn.c index b9873ff21..b94d8a065 100644 --- a/lib/freetype/src/otvalid/otvcommn.c +++ b/lib/freetype/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ * * OpenType common tables validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvcommn.h b/lib/freetype/src/otvalid/otvcommn.h index f1e4a6a9a..6702c0008 100644 --- a/lib/freetype/src/otvalid/otvcommn.h +++ b/lib/freetype/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ * * OpenType common tables validation (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otverror.h b/lib/freetype/src/otvalid/otverror.h index 8c75c5829..4c4049ca5 100644 --- a/lib/freetype/src/otvalid/otverror.h +++ b/lib/freetype/src/otvalid/otverror.h @@ -4,7 +4,7 @@ * * OpenType validation module error codes (specification only). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvgdef.c b/lib/freetype/src/otvalid/otvgdef.c index 425335336..d62e8187f 100644 --- a/lib/freetype/src/otvalid/otvgdef.c +++ b/lib/freetype/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ * * OpenType GDEF table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvgpos.c b/lib/freetype/src/otvalid/otvgpos.c index 52e2cd1c2..f6102afbc 100644 --- a/lib/freetype/src/otvalid/otvgpos.c +++ b/lib/freetype/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ * * OpenType GPOS table validation (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvgpos.h b/lib/freetype/src/otvalid/otvgpos.h index 85ef60916..b5d0f5485 100644 --- a/lib/freetype/src/otvalid/otvgpos.h +++ b/lib/freetype/src/otvalid/otvgpos.h @@ -4,7 +4,7 @@ * * OpenType GPOS table validator (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvgsub.c b/lib/freetype/src/otvalid/otvgsub.c index 3b6dcbb7a..5d40d9243 100644 --- a/lib/freetype/src/otvalid/otvgsub.c +++ b/lib/freetype/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ * * OpenType GSUB table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -61,7 +61,8 @@ { FT_Bytes Coverage; FT_Int DeltaGlyphID; - FT_Long idx; + FT_UInt first_cov, last_cov; + FT_UInt first_idx, last_idx; OTV_LIMIT_CHECK( 4 ); @@ -70,12 +71,21 @@ otv_Coverage_validate( Coverage, otvalid, -1 ); - idx = (FT_Long)otv_Coverage_get_first( Coverage ) + DeltaGlyphID; - if ( idx < 0 ) + first_cov = otv_Coverage_get_first( Coverage ); + last_cov = otv_Coverage_get_last( Coverage ); + + /* These additions are modulo 65536. */ + first_idx = (FT_UInt)( (FT_Int)first_cov + DeltaGlyphID ) & 0xFFFFU; + last_idx = (FT_UInt)( (FT_Int)last_cov + DeltaGlyphID ) & 0xFFFFU; + + /* Since the maximum number of glyphs is 2^16 - 1 = 65535, */ + /* the largest possible glyph index is 65534. For this */ + /* reason there can't be a wrap-around region, which would */ + /* imply the use of the invalid glyph index 65535. */ + if ( first_idx > last_idx ) FT_INVALID_DATA; - idx = (FT_Long)otv_Coverage_get_last( Coverage ) + DeltaGlyphID; - if ( (FT_UInt)idx >= otvalid->glyph_count ) + if ( last_idx >= otvalid->glyph_count ) FT_INVALID_DATA; } break; diff --git a/lib/freetype/src/otvalid/otvjstf.c b/lib/freetype/src/otvalid/otvjstf.c index 0934716a5..712039c66 100644 --- a/lib/freetype/src/otvalid/otvjstf.c +++ b/lib/freetype/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ * * OpenType JSTF table validation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvmath.c b/lib/freetype/src/otvalid/otvmath.c index a59557b37..01fd863c9 100644 --- a/lib/freetype/src/otvalid/otvmath.c +++ b/lib/freetype/src/otvalid/otvmath.c @@ -4,7 +4,7 @@ * * OpenType MATH table validation (body). * - * Copyright (C) 2007-2022 by + * Copyright (C) 2007-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by George Williams. diff --git a/lib/freetype/src/otvalid/otvmod.c b/lib/freetype/src/otvalid/otvmod.c index 3fc2dbe50..d6057c5a4 100644 --- a/lib/freetype/src/otvalid/otvmod.c +++ b/lib/freetype/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ * * FreeType's OpenType validation module implementation (body). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/otvmod.h b/lib/freetype/src/otvalid/otvmod.h index 2f0bcd6e4..f0e68dbc0 100644 --- a/lib/freetype/src/otvalid/otvmod.h +++ b/lib/freetype/src/otvalid/otvmod.h @@ -5,7 +5,7 @@ * FreeType's OpenType validation module implementation * (specification). * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/otvalid/rules.mk b/lib/freetype/src/otvalid/rules.mk index 924d2b6be..800cb8733 100644 --- a/lib/freetype/src/otvalid/rules.mk +++ b/lib/freetype/src/otvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2022 by +# Copyright (C) 2004-2023 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/lib/freetype/src/pcf/pcfdrivr.c b/lib/freetype/src/pcf/pcfdrivr.c index 2a40af9e9..bfa6eacca 100644 --- a/lib/freetype/src/pcf/pcfdrivr.c +++ b/lib/freetype/src/pcf/pcfdrivr.c @@ -104,26 +104,19 @@ THE SOFTWARE. pcf_cmap_char_index( FT_CMap pcfcmap, /* PCF_CMap */ FT_UInt32 charcode ) { - PCF_CMap cmap = (PCF_CMap)pcfcmap; - PCF_Enc enc = cmap->enc; - FT_UShort charcodeRow; - FT_UShort charcodeCol; + PCF_Enc enc = ( (PCF_CMap)pcfcmap )->enc; + FT_UInt32 i = ( charcode >> 8 ) - enc->firstRow; + FT_UInt32 j = ( charcode & 0xFF ) - enc->firstCol; + FT_UInt32 h = enc->lastRow - enc->firstRow + 1; + FT_UInt32 w = enc->lastCol - enc->firstCol + 1; - if ( charcode > (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) || - charcode < (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ) ) - return 0; - - charcodeRow = (FT_UShort)( charcode >> 8 ); - charcodeCol = (FT_UShort)( charcode & 0xFF ); - if ( charcodeCol < enc->firstCol || - charcodeCol > enc->lastCol ) + /* wrapped around "negative" values are also rejected */ + if ( i >= h || j >= w ) return 0; - return (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) * - ( enc->lastCol - enc->firstCol + 1 ) + - charcodeCol - enc->firstCol]; + return (FT_UInt)enc->offset[i * w + j]; } @@ -131,42 +124,33 @@ THE SOFTWARE. pcf_cmap_char_next( FT_CMap pcfcmap, /* PCF_CMap */ FT_UInt32 *acharcode ) { - PCF_CMap cmap = (PCF_CMap)pcfcmap; - PCF_Enc enc = cmap->enc; - FT_UInt32 charcode = *acharcode; - FT_UShort charcodeRow; - FT_UShort charcodeCol; - FT_UInt result = 0; + PCF_Enc enc = ( (PCF_CMap)pcfcmap )->enc; + FT_UInt32 charcode = *acharcode + 1; + FT_UInt32 i = ( charcode >> 8 ) - enc->firstRow; + FT_UInt32 j = ( charcode & 0xFF ) - enc->firstCol; + FT_UInt32 h = enc->lastRow - enc->firstRow + 1; + FT_UInt32 w = enc->lastCol - enc->firstCol + 1; - while ( charcode < (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) ) - { - charcode++; + FT_UInt result = 0; - if ( charcode < (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ) ) - charcode = (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ); - charcodeRow = (FT_UShort)( charcode >> 8 ); - charcodeCol = (FT_UShort)( charcode & 0xFF ); + /* adjust wrapped around "negative" values */ + if ( (FT_Int32)i < 0 ) + i = 0; + if ( (FT_Int32)j < 0 ) + j = 0; - if ( charcodeCol < enc->firstCol ) - charcodeCol = enc->firstCol; - else if ( charcodeCol > enc->lastCol ) + for ( ; i < h; i++, j = 0 ) + for ( ; j < w; j++ ) { - charcodeRow++; - charcodeCol = enc->firstCol; + result = (FT_UInt)enc->offset[i * w + j]; + if ( result != 0xFFFFU ) + goto Exit; } - charcode = (FT_UInt32)( charcodeRow * 256 + charcodeCol ); - - result = (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) * - ( enc->lastCol - enc->firstCol + 1 ) + - charcodeCol - enc->firstCol]; - if ( result != 0xFFFFU ) - break; - } - - *acharcode = charcode; + Exit: + *acharcode = ( ( i + enc->firstRow ) << 8 ) | ( j + enc->firstCol ); return result; } diff --git a/lib/freetype/src/pcf/pcfutil.c b/lib/freetype/src/pcf/pcfutil.c index 5d3c00791..957572691 100644 --- a/lib/freetype/src/pcf/pcfutil.c +++ b/lib/freetype/src/pcf/pcfutil.c @@ -57,6 +57,34 @@ in this Software without prior written authorization from The Open Group. } +#if defined( __clang__ ) || \ + ( defined( __GNUC__ ) && \ + ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 8 ) ) ) + +#define BSWAP16( x ) __builtin_bswap16( x ) +#define BSWAP32( x ) __builtin_bswap32( x ) + +#elif defined( _MSC_VER ) && _MSC_VER >= 1300 + +#pragma intrinsic( _byteswap_ushort ) +#pragma intrinsic( _byteswap_ulong ) + +#define BSWAP16( x ) _byteswap_ushort( x ) +#define BSWAP32( x ) _byteswap_ulong( x ) + +#else + +#define BSWAP16( x ) \ + (FT_UInt16)( ( ( ( x ) >> 8 ) & 0xff ) | \ + ( ( ( x ) & 0xff ) << 8 ) ) +#define BSWAP32( x ) \ + (FT_UInt32)( ( ( ( x ) & 0xff000000u ) >> 24 ) | \ + ( ( ( x ) & 0x00ff0000u ) >> 8 ) | \ + ( ( ( x ) & 0x0000ff00u ) << 8 ) | \ + ( ( ( x ) & 0x000000ffu ) << 24 ) ) + +#endif + /* * Invert byte order within each 16-bits of an array. */ @@ -65,15 +93,11 @@ in this Software without prior written authorization from The Open Group. TwoByteSwap( unsigned char* buf, size_t nbytes ) { - for ( ; nbytes >= 2; nbytes -= 2, buf += 2 ) - { - unsigned char c; + FT_UInt16* b = (FT_UInt16*)buf; - c = buf[0]; - buf[0] = buf[1]; - buf[1] = c; - } + for ( ; nbytes >= 2; nbytes -= 2, b++ ) + *b = BSWAP16( *b ); } /* @@ -84,19 +108,11 @@ in this Software without prior written authorization from The Open Group. FourByteSwap( unsigned char* buf, size_t nbytes ) { - for ( ; nbytes >= 4; nbytes -= 4, buf += 4 ) - { - unsigned char c; - + FT_UInt32* b = (FT_UInt32*)buf; - c = buf[0]; - buf[0] = buf[3]; - buf[3] = c; - c = buf[1]; - buf[1] = buf[2]; - buf[2] = c; - } + for ( ; nbytes >= 4; nbytes -= 4, b++ ) + *b = BSWAP32( *b ); } diff --git a/lib/freetype/src/pfr/module.mk b/lib/freetype/src/pfr/module.mk index 570d400b1..388a38ed0 100644 --- a/lib/freetype/src/pfr/module.mk +++ b/lib/freetype/src/pfr/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2022 by +# Copyright (C) 2002-2023 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/lib/freetype/src/pfr/pfr.c b/lib/freetype/src/pfr/pfr.c index 1dd38f939..d3738152d 100644 --- a/lib/freetype/src/pfr/pfr.c +++ b/lib/freetype/src/pfr/pfr.c @@ -4,7 +4,7 @@ * * FreeType PFR driver component. * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrcmap.c b/lib/freetype/src/pfr/pfrcmap.c index 6fa2417dc..312a9ffe1 100644 --- a/lib/freetype/src/pfr/pfrcmap.c +++ b/lib/freetype/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ * * FreeType PFR cmap handling (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -69,17 +69,14 @@ pfr_cmap_char_index( PFR_CMap cmap, FT_UInt32 char_code ) { - FT_UInt min = 0; - FT_UInt max = cmap->num_chars; + FT_UInt min = 0; + FT_UInt max = cmap->num_chars; + FT_UInt mid = min + ( max - min ) / 2; + PFR_Char gchar; while ( min < max ) { - PFR_Char gchar; - FT_UInt mid; - - - mid = min + ( max - min ) / 2; gchar = cmap->chars + mid; if ( gchar->char_code == char_code ) @@ -89,6 +86,11 @@ min = mid + 1; else max = mid; + + /* reasonable prediction in a continuous block */ + mid += char_code - gchar->char_code; + if ( mid >= max || mid < min ) + mid = min + ( max - min ) / 2; } return 0; } @@ -106,13 +108,12 @@ { FT_UInt min = 0; FT_UInt max = cmap->num_chars; - FT_UInt mid; + FT_UInt mid = min + ( max - min ) / 2; PFR_Char gchar; while ( min < max ) { - mid = min + ( ( max - min ) >> 1 ); gchar = cmap->chars + mid; if ( gchar->char_code == char_code ) @@ -132,6 +133,11 @@ min = mid + 1; else max = mid; + + /* reasonable prediction in a continuous block */ + mid += char_code - gchar->char_code; + if ( mid >= max || mid < min ) + mid = min + ( max - min ) / 2; } /* we didn't find it, but we have a pair just above it */ diff --git a/lib/freetype/src/pfr/pfrcmap.h b/lib/freetype/src/pfr/pfrcmap.h index afde164f9..8110f175e 100644 --- a/lib/freetype/src/pfr/pfrcmap.h +++ b/lib/freetype/src/pfr/pfrcmap.h @@ -4,7 +4,7 @@ * * FreeType PFR cmap handling (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrdrivr.c b/lib/freetype/src/pfr/pfrdrivr.c index 2a753c583..78c6c6882 100644 --- a/lib/freetype/src/pfr/pfrdrivr.c +++ b/lib/freetype/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ * * FreeType PFR driver interface (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrdrivr.h b/lib/freetype/src/pfr/pfrdrivr.h index cfd749ab0..da14468d4 100644 --- a/lib/freetype/src/pfr/pfrdrivr.h +++ b/lib/freetype/src/pfr/pfrdrivr.h @@ -4,7 +4,7 @@ * * High-level Type PFR driver interface (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrerror.h b/lib/freetype/src/pfr/pfrerror.h index 98b8f2fd5..5dfb254d6 100644 --- a/lib/freetype/src/pfr/pfrerror.h +++ b/lib/freetype/src/pfr/pfrerror.h @@ -4,7 +4,7 @@ * * PFR error codes (specification only). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrgload.c b/lib/freetype/src/pfr/pfrgload.c index 1b8d6cdec..14f2ec377 100644 --- a/lib/freetype/src/pfr/pfrgload.c +++ b/lib/freetype/src/pfr/pfrgload.c @@ -4,7 +4,7 @@ * * FreeType PFR glyph loader (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -42,8 +42,7 @@ { FT_ZERO( glyph ); - glyph->loader = loader; - glyph->path_begun = 0; + glyph->loader = loader; FT_GlyphLoader_Rewind( loader ); } @@ -409,7 +408,7 @@ break; case 6: /* horizontal to vertical curve */ - FT_TRACE6(( "- hv curve " )); + FT_TRACE6(( "- hv curve" )); args_format = 0xB8E; args_count = 3; break; diff --git a/lib/freetype/src/pfr/pfrgload.h b/lib/freetype/src/pfr/pfrgload.h index af5929691..92a59bc5d 100644 --- a/lib/freetype/src/pfr/pfrgload.h +++ b/lib/freetype/src/pfr/pfrgload.h @@ -4,7 +4,7 @@ * * FreeType PFR glyph loader (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrload.c b/lib/freetype/src/pfr/pfrload.c index 6bf797975..de85ee6aa 100644 --- a/lib/freetype/src/pfr/pfrload.c +++ b/lib/freetype/src/pfr/pfrload.c @@ -4,7 +4,7 @@ * * FreeType PFR loader (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -268,9 +268,7 @@ header->version > 4 || header->header_size < 58 || header->signature2 != 0x0D0A ) /* CR/LF */ - { result = 0; - } return result; } @@ -406,11 +404,9 @@ } if ( flags & PFR_LOG_BOLD ) - { log_font->bold_thickness = ( flags & PFR_LOG_2BYTE_BOLD ) ? PFR_NEXT_SHORT( p ) : PFR_NEXT_BYTE( p ); - } if ( flags & PFR_LOG_EXTRA_ITEMS ) { @@ -604,7 +600,7 @@ if ( FT_QNEW_ARRAY( snaps, count ) ) goto Exit; - phy_font->vertical.stem_snaps = snaps; + phy_font->vertical.stem_snaps = snaps; phy_font->horizontal.stem_snaps = snaps + num_vert; for ( ; count > 0; count--, snaps++ ) @@ -621,7 +617,6 @@ } - /* load kerning pair data */ FT_CALLBACK_DEF( FT_Error ) pfr_extra_item_load_kerning_pairs( FT_Byte* p, @@ -857,8 +852,16 @@ phy_font->bbox.yMax = PFR_NEXT_SHORT( p ); phy_font->flags = flags = PFR_NEXT_BYTE( p ); + if ( !phy_font->outline_resolution || + !phy_font->metrics_resolution ) + { + error = FT_THROW( Invalid_Table ); + FT_ERROR(( "pfr_phy_font_load: invalid resolution\n" )); + goto Fail; + } + /* get the standard advance for non-proportional fonts */ - if ( !(flags & PFR_PHY_PROPORTIONAL) ) + if ( !( flags & PFR_PHY_PROPORTIONAL ) ) { PFR_CHECK( 2 ); phy_font->standard_advance = PFR_NEXT_SHORT( p ); @@ -869,14 +872,13 @@ { error = pfr_extra_items_parse( &p, limit, pfr_phy_font_extra_items, phy_font ); - if ( error ) goto Fail; } /* In certain fonts, the auxiliary bytes contain interesting */ /* information. These are not in the specification but can be */ - /* guessed by looking at the content of a few PFR0 fonts. */ + /* guessed by looking at the content of a few 'PFR0' fonts. */ PFR_CHECK( 3 ); num_aux = PFR_NEXT_ULONG( p ); @@ -975,6 +977,13 @@ phy_font->num_chars = count = PFR_NEXT_USHORT( p ); phy_font->chars_offset = offset + (FT_Offset)( p - stream->cursor ); + if ( !phy_font->num_chars ) + { + error = FT_THROW( Invalid_Table ); + FT_ERROR(( "pfr_phy_font_load: no glyphs\n" )); + goto Fail; + } + Size = 1 + 1 + 2; if ( flags & PFR_PHY_2BYTE_CHARCODE ) Size += 1; diff --git a/lib/freetype/src/pfr/pfrload.h b/lib/freetype/src/pfr/pfrload.h index 5e0f451fa..d7b20a457 100644 --- a/lib/freetype/src/pfr/pfrload.h +++ b/lib/freetype/src/pfr/pfrload.h @@ -4,7 +4,7 @@ * * FreeType PFR loader (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrobjs.c b/lib/freetype/src/pfr/pfrobjs.c index 5a6e3979d..3db8f0a06 100644 --- a/lib/freetype/src/pfr/pfrobjs.c +++ b/lib/freetype/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ * * FreeType PFR object methods (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -130,14 +130,14 @@ if ( error ) goto Exit; - /* now load the physical font descriptor */ + /* load the physical font descriptor */ error = pfr_phy_font_load( &face->phy_font, stream, face->log_font.phys_offset, face->log_font.phys_size ); if ( error ) goto Exit; - /* now set up all root face fields */ + /* set up all root face fields */ { PFR_PhyFont phy_font = &face->phy_font; @@ -160,7 +160,7 @@ if ( nn == phy_font->num_chars ) { if ( phy_font->num_strikes > 0 ) - pfrface->face_flags = 0; /* not scalable */ + pfrface->face_flags &= ~FT_FACE_FLAG_SCALABLE; else { FT_ERROR(( "pfr_face_init: font doesn't contain glyphs\n" )); @@ -170,7 +170,7 @@ } } - if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 ) + if ( !( phy_font->flags & PFR_PHY_PROPORTIONAL ) ) pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; if ( phy_font->flags & PFR_PHY_VERTICAL ) @@ -338,7 +338,7 @@ } /* try to load an embedded bitmap */ - if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 0 ) + if ( !( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) ) { error = pfr_slot_load_bitmap( slot, @@ -486,17 +486,16 @@ kerning->x = 0; kerning->y = 0; - if ( glyph1 > 0 ) - glyph1--; - - if ( glyph2 > 0 ) - glyph2--; + /* PFR indexing skips .notdef, which becomes UINT_MAX */ + glyph1--; + glyph2--; - /* convert glyph indices to character codes */ - if ( glyph1 > phy_font->num_chars || - glyph2 > phy_font->num_chars ) + /* check the array bounds, .notdef is automatically out */ + if ( glyph1 >= phy_font->num_chars || + glyph2 >= phy_font->num_chars ) goto Exit; + /* convert glyph indices to character codes */ code1 = phy_font->chars[glyph1].char_code; code2 = phy_font->chars[glyph2].char_code; pair = PFR_KERN_INDEX( code1, code2 ); diff --git a/lib/freetype/src/pfr/pfrobjs.h b/lib/freetype/src/pfr/pfrobjs.h index 9ffc297d5..fcf8c3812 100644 --- a/lib/freetype/src/pfr/pfrobjs.h +++ b/lib/freetype/src/pfr/pfrobjs.h @@ -4,7 +4,7 @@ * * FreeType PFR object methods (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrsbit.c b/lib/freetype/src/pfr/pfrsbit.c index 8b23fa156..46a988e8e 100644 --- a/lib/freetype/src/pfr/pfrsbit.c +++ b/lib/freetype/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ * * FreeType PFR bitmap loader (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 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_ULong* found_offset, FT_ULong* found_size ) { - FT_UInt min, max, char_len; + FT_UInt min, max, mid, char_len; FT_Bool two = FT_BOOL( *flags & PFR_BITMAP_2BYTE_CHARCODE ); FT_Byte* buff; @@ -349,14 +349,14 @@ min = 0; max = count; + mid = min + ( max - min ) / 2; /* binary search */ while ( min < max ) { - FT_UInt mid, code; + FT_UInt code; - mid = ( min + max ) >> 1; buff = base + mid * char_len; if ( two ) @@ -370,6 +370,11 @@ min = mid + 1; else goto Found_It; + + /* reasonable prediction in a continuous block */ + mid += char_code - code; + if ( mid >= max || mid < min ) + mid = min + ( max - min ) / 2; } Fail: @@ -391,7 +396,7 @@ } - /* load bitmap metrics. `*padvance' must be set to the default value */ + /* load bitmap metrics. `*aadvance' must be set to the default value */ /* before calling this function */ /* */ static FT_Error @@ -575,7 +580,7 @@ /*************************************************************************/ /*************************************************************************/ - FT_LOCAL( FT_Error ) + FT_LOCAL_DEF( FT_Error ) pfr_slot_load_bitmap( PFR_Slot glyph, PFR_Size size, FT_UInt glyph_index, @@ -628,7 +633,7 @@ if ( strike->flags & PFR_BITMAP_3BYTE_OFFSET ) char_len += 1; - /* access data directly in the frame to speed lookups */ + /* access data directly in the frame to speed up lookups */ if ( FT_STREAM_SEEK( phys->bct_offset + strike->bct_offset ) || FT_FRAME_ENTER( char_len * strike->num_bitmaps ) ) goto Exit; @@ -744,8 +749,8 @@ ypos > FT_INT_MAX - (FT_Long)ysize || ypos + (FT_Long)ysize < FT_INT_MIN ) { - FT_TRACE1(( "pfr_slot_load_bitmap:" )); - FT_TRACE1(( "huge bitmap glyph %ldx%ld over FT_GlyphSlot\n", + FT_TRACE1(( "pfr_slot_load_bitmap:" + " huge bitmap glyph %ldx%ld over FT_GlyphSlot\n", xpos, ypos )); error = FT_THROW( Invalid_Pixel_Size ); } diff --git a/lib/freetype/src/pfr/pfrsbit.h b/lib/freetype/src/pfr/pfrsbit.h index b948a3842..3e1dba9ae 100644 --- a/lib/freetype/src/pfr/pfrsbit.h +++ b/lib/freetype/src/pfr/pfrsbit.h @@ -4,7 +4,7 @@ * * FreeType PFR bitmap loader (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/pfrtypes.h b/lib/freetype/src/pfr/pfrtypes.h index d9a0c7895..2f8909f06 100644 --- a/lib/freetype/src/pfr/pfrtypes.h +++ b/lib/freetype/src/pfr/pfrtypes.h @@ -4,7 +4,7 @@ * * FreeType PFR data structures (specification only). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pfr/rules.mk b/lib/freetype/src/pfr/rules.mk index b5dffaaa2..50695fd28 100644 --- a/lib/freetype/src/pfr/rules.mk +++ b/lib/freetype/src/pfr/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2022 by +# Copyright (C) 2002-2023 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/lib/freetype/src/psaux/afmparse.c b/lib/freetype/src/psaux/afmparse.c index bd86129f7..68f95698e 100644 --- a/lib/freetype/src/psaux/afmparse.c +++ b/lib/freetype/src/psaux/afmparse.c @@ -4,7 +4,7 @@ * * AFM parser (body). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -563,7 +563,7 @@ } - FT_LOCAL( void ) + FT_LOCAL_DEF( void ) afm_parser_done( AFM_Parser parser ) { FT_Memory memory = parser->memory; @@ -1061,7 +1061,7 @@ if ( error ) goto Fail; /* we only support kern data, so ... */ - /* fall through */ + FALL_THROUGH; case AFM_TOKEN_ENDFONTMETRICS: return FT_Err_Ok; diff --git a/lib/freetype/src/psaux/afmparse.h b/lib/freetype/src/psaux/afmparse.h index eee49e360..2d3b6e6e1 100644 --- a/lib/freetype/src/psaux/afmparse.h +++ b/lib/freetype/src/psaux/afmparse.h @@ -4,7 +4,7 @@ * * AFM parser (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/cffdecode.c b/lib/freetype/src/psaux/cffdecode.c index 92139c93a..2cd91c96f 100644 --- a/lib/freetype/src/psaux/cffdecode.c +++ b/lib/freetype/src/psaux/cffdecode.c @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (body). * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/cffdecode.h b/lib/freetype/src/psaux/cffdecode.h index a9f676182..e8bb4001c 100644 --- a/lib/freetype/src/psaux/cffdecode.h +++ b/lib/freetype/src/psaux/cffdecode.h @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (specification). * - * Copyright (C) 2017-2022 by + * Copyright (C) 2017-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/module.mk b/lib/freetype/src/psaux/module.mk index e52e98796..c6fb4eb50 100644 --- a/lib/freetype/src/psaux/module.mk +++ b/lib/freetype/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/psaux/psaux.c b/lib/freetype/src/psaux/psaux.c index 2ac794947..5879ed163 100644 --- a/lib/freetype/src/psaux/psaux.c +++ b/lib/freetype/src/psaux/psaux.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript driver component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/psauxerr.h b/lib/freetype/src/psaux/psauxerr.h index 1504b34ee..895ffa48c 100644 --- a/lib/freetype/src/psaux/psauxerr.h +++ b/lib/freetype/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ * * PS auxiliary module error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/psauxmod.c b/lib/freetype/src/psaux/psauxmod.c index 113490abc..45e35aa53 100644 --- a/lib/freetype/src/psaux/psauxmod.c +++ b/lib/freetype/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/psauxmod.h b/lib/freetype/src/psaux/psauxmod.h index 2d508edc2..94dbf4881 100644 --- a/lib/freetype/src/psaux/psauxmod.h +++ b/lib/freetype/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/psconv.c b/lib/freetype/src/psaux/psconv.c index 9b8c0d90c..b9c7138d8 100644 --- a/lib/freetype/src/psaux/psconv.c +++ b/lib/freetype/src/psaux/psconv.c @@ -4,7 +4,7 @@ * * Some convenience conversions (body). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/psconv.h b/lib/freetype/src/psaux/psconv.h index 650d7c93b..b7c3ee00b 100644 --- a/lib/freetype/src/psaux/psconv.h +++ b/lib/freetype/src/psaux/psconv.h @@ -4,7 +4,7 @@ * * Some convenience conversions (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/psfixed.h b/lib/freetype/src/psaux/psfixed.h index 7dff9ef1b..299d07637 100644 --- a/lib/freetype/src/psaux/psfixed.h +++ b/lib/freetype/src/psaux/psfixed.h @@ -2,7 +2,7 @@ * * psfixed.h * - * Adobe's code for Fixed Point Mathematics (specification only). + * Adobe's code for Fixed-Point Mathematics (specification only). * * Copyright 2007-2013 Adobe Systems Incorporated. * @@ -43,10 +43,10 @@ FT_BEGIN_HEADER - /* rasterizer integer and fixed point arithmetic must be 32-bit */ + /* rasterizer integer and fixed-point arithmetic must be 32-bit */ #define CF2_Fixed CF2_F16Dot16 - typedef FT_Int32 CF2_Frac; /* 2.30 fixed point */ + typedef FT_Int32 CF2_Frac; /* 2.30 fixed-point */ #define CF2_FIXED_MAX ( (CF2_Fixed)0x7FFFFFFFL ) diff --git a/lib/freetype/src/psaux/psft.c b/lib/freetype/src/psaux/psft.c index ac72d8259..618864e6e 100644 --- a/lib/freetype/src/psaux/psft.c +++ b/lib/freetype/src/psaux/psft.c @@ -68,11 +68,10 @@ CF2_Fixed maxScale; - FT_ASSERT( unitsPerEm > 0 ); - if ( transform->a <= 0 || transform->d <= 0 ) return FT_THROW( Invalid_Size_Handle ); + FT_ASSERT( unitsPerEm > 0 ); FT_ASSERT( transform->b == 0 && transform->c == 0 ); FT_ASSERT( transform->tx == 0 && transform->ty == 0 ); @@ -297,7 +296,6 @@ cf2_getUnitsPerEm( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->builder.face ); - FT_ASSERT( decoder->builder.face->units_per_EM ); return decoder->builder.face->units_per_EM; } diff --git a/lib/freetype/src/psaux/psglue.h b/lib/freetype/src/psaux/psglue.h index 022aafbfc..63085d71c 100644 --- a/lib/freetype/src/psaux/psglue.h +++ b/lib/freetype/src/psaux/psglue.h @@ -72,7 +72,7 @@ FT_BEGIN_HEADER } CF2_PathOp; - /* a matrix of fixed point values */ + /* a matrix of fixed-point values */ typedef struct CF2_Matrix_ { CF2_F16Dot16 a; diff --git a/lib/freetype/src/psaux/pshints.c b/lib/freetype/src/psaux/pshints.c index ad472c98d..6f44d0adb 100644 --- a/lib/freetype/src/psaux/pshints.c +++ b/lib/freetype/src/psaux/pshints.c @@ -693,8 +693,10 @@ CF2_Fixed midpoint = cf2_hintmap_map( hintmap->initialHintMap, - ADD_INT32( secondHintEdge->csCoord, - firstHintEdge->csCoord ) / 2 ); + ADD_INT32( + firstHintEdge->csCoord, + SUB_INT32 ( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2 ) ); CF2_Fixed halfWidth = FT_MulFix( SUB_INT32( secondHintEdge->csCoord, firstHintEdge->csCoord ) / 2, @@ -1034,10 +1036,10 @@ { FT_TRACE6(( "flags: [p]air [g]host [t]op" " [b]ottom [L]ocked [S]ynthetic\n" )); - FT_TRACE6(( "Initial hintmap" )); + FT_TRACE6(( "Initial hintmap:\n" )); } else - FT_TRACE6(( "Hints:" )); + FT_TRACE6(( "Hints:\n" )); #endif cf2_hintmap_dump( hintmap ); @@ -1054,7 +1056,7 @@ /* adjust positions of hint edges that are not locked to blue zones */ cf2_hintmap_adjustHints( hintmap ); - FT_TRACE6(( "(adjusted)\n" )); + FT_TRACE6(( "Hints adjusted:\n" )); cf2_hintmap_dump( hintmap ); /* save the position of all hints that were used in this hint map; */ diff --git a/lib/freetype/src/psaux/psobjs.c b/lib/freetype/src/psaux/psobjs.c index 371e53802..8da755d0e 100644 --- a/lib/freetype/src/psaux/psobjs.c +++ b/lib/freetype/src/psaux/psobjs.c @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -84,7 +84,6 @@ table->max_elems = count; table->init = 0xDEADBEEFUL; - table->num_elems = 0; table->block = NULL; table->capacity = 0; table->cursor = 0; @@ -235,7 +234,7 @@ FT_Memory memory = table->memory; - if ( (FT_ULong)table->init == 0xDEADBEEFUL ) + if ( table->init == 0xDEADBEEFUL ) { FT_FREE( table->block ); FT_FREE( table->elements ); diff --git a/lib/freetype/src/psaux/psobjs.h b/lib/freetype/src/psaux/psobjs.h index f01d4bd50..d5bce5410 100644 --- a/lib/freetype/src/psaux/psobjs.h +++ b/lib/freetype/src/psaux/psobjs.h @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/psstack.h b/lib/freetype/src/psaux/psstack.h index b9ef9edf1..907b42400 100644 --- a/lib/freetype/src/psaux/psstack.h +++ b/lib/freetype/src/psaux/psstack.h @@ -49,8 +49,8 @@ FT_BEGIN_HEADER { union { - CF2_Fixed r; /* 16.16 fixed point */ - CF2_Frac f; /* 2.30 fixed point (for font matrix) */ + CF2_Fixed r; /* 16.16 fixed-point */ + CF2_Frac f; /* 2.30 fixed-point (for font matrix) */ CF2_Int i; } u; diff --git a/lib/freetype/src/psaux/rules.mk b/lib/freetype/src/psaux/rules.mk index d20ff3e63..d542ab8ee 100644 --- a/lib/freetype/src/psaux/rules.mk +++ b/lib/freetype/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/psaux/t1cmap.c b/lib/freetype/src/psaux/t1cmap.c index f297ce75e..bf0a393b4 100644 --- a/lib/freetype/src/psaux/t1cmap.c +++ b/lib/freetype/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ * * Type 1 character map support (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/t1cmap.h b/lib/freetype/src/psaux/t1cmap.h index 460d91f59..b3702498a 100644 --- a/lib/freetype/src/psaux/t1cmap.h +++ b/lib/freetype/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ * * Type 1 character map support (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/t1decode.c b/lib/freetype/src/psaux/t1decode.c index 1cdf436fa..bfed45b53 100644 --- a/lib/freetype/src/psaux/t1decode.c +++ b/lib/freetype/src/psaux/t1decode.c @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psaux/t1decode.h b/lib/freetype/src/psaux/t1decode.h index d60d61c90..0970def96 100644 --- a/lib/freetype/src/psaux/t1decode.h +++ b/lib/freetype/src/psaux/t1decode.h @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (specification). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/module.mk b/lib/freetype/src/pshinter/module.mk index bdb05c10e..dbc137dca 100644 --- a/lib/freetype/src/pshinter/module.mk +++ b/lib/freetype/src/pshinter/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/pshinter/pshalgo.c b/lib/freetype/src/pshinter/pshalgo.c index dca539766..a7f321291 100644 --- a/lib/freetype/src/pshinter/pshalgo.c +++ b/lib/freetype/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (body). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/lib/freetype/src/pshinter/pshalgo.h b/lib/freetype/src/pshinter/pshalgo.h index ab978bf6d..3f0ba28a6 100644 --- a/lib/freetype/src/pshinter/pshalgo.h +++ b/lib/freetype/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (specification). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/pshglob.c b/lib/freetype/src/pshinter/pshglob.c index 887ea8d9c..d4c5eb32b 100644 --- a/lib/freetype/src/pshinter/pshglob.c +++ b/lib/freetype/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ * PostScript hinter global hinting management (body). * Inspired by the new auto-hinter module. * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/lib/freetype/src/pshinter/pshglob.h b/lib/freetype/src/pshinter/pshglob.h index 47247f969..579eb2148 100644 --- a/lib/freetype/src/pshinter/pshglob.h +++ b/lib/freetype/src/pshinter/pshglob.h @@ -4,7 +4,7 @@ * * PostScript hinter global hinting management. * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/pshinter.c b/lib/freetype/src/pshinter/pshinter.c index 22315685f..54ed41096 100644 --- a/lib/freetype/src/pshinter/pshinter.c +++ b/lib/freetype/src/pshinter/pshinter.c @@ -4,7 +4,7 @@ * * FreeType PostScript Hinting module * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/pshmod.c b/lib/freetype/src/pshinter/pshmod.c index a74a4fe99..a12e48566 100644 --- a/lib/freetype/src/pshinter/pshmod.c +++ b/lib/freetype/src/pshinter/pshmod.c @@ -4,7 +4,7 @@ * * FreeType PostScript hinter module implementation (body). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/pshmod.h b/lib/freetype/src/pshinter/pshmod.h index cdf95b7c2..4bd781a35 100644 --- a/lib/freetype/src/pshinter/pshmod.h +++ b/lib/freetype/src/pshinter/pshmod.h @@ -4,7 +4,7 @@ * * PostScript hinter module interface (specification). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/pshnterr.h b/lib/freetype/src/pshinter/pshnterr.h index 789afb599..97624952d 100644 --- a/lib/freetype/src/pshinter/pshnterr.h +++ b/lib/freetype/src/pshinter/pshnterr.h @@ -4,7 +4,7 @@ * * PS Hinter error codes (specification only). * - * Copyright (C) 2003-2022 by + * Copyright (C) 2003-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/pshrec.c b/lib/freetype/src/pshinter/pshrec.c index 2a5cffbad..58c8cf1b4 100644 --- a/lib/freetype/src/pshinter/pshrec.c +++ b/lib/freetype/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ * * FreeType PostScript hints recorder (body). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -765,7 +765,7 @@ /* destroy hints */ - FT_LOCAL( void ) + FT_LOCAL_DEF( void ) ps_hints_done( PS_Hints hints ) { FT_Memory memory = hints->memory; @@ -779,7 +779,7 @@ } - FT_LOCAL( void ) + FT_LOCAL_DEF( void ) ps_hints_init( PS_Hints hints, FT_Memory memory ) { diff --git a/lib/freetype/src/pshinter/pshrec.h b/lib/freetype/src/pshinter/pshrec.h index a0d37979c..0b2484af1 100644 --- a/lib/freetype/src/pshinter/pshrec.h +++ b/lib/freetype/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ * * Postscript (Type1/Type2) hints recorder (specification). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/pshinter/rules.mk b/lib/freetype/src/pshinter/rules.mk index ee5968048..50058e882 100644 --- a/lib/freetype/src/pshinter/rules.mk +++ b/lib/freetype/src/pshinter/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2001-2022 by +# Copyright (C) 2001-2023 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/lib/freetype/src/psnames/module.mk b/lib/freetype/src/psnames/module.mk index 4bd2ee624..1ee0ef8f7 100644 --- a/lib/freetype/src/psnames/module.mk +++ b/lib/freetype/src/psnames/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/psnames/psmodule.c b/lib/freetype/src/psnames/psmodule.c index e7d51e950..db454e558 100644 --- a/lib/freetype/src/psnames/psmodule.c +++ b/lib/freetype/src/psnames/psmodule.c @@ -4,7 +4,7 @@ * * psnames module implementation (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -412,21 +412,18 @@ ps_unicodes_char_index( PS_Unicodes table, FT_UInt32 unicode ) { - PS_UniMap *min, *max, *mid, *result = NULL; + PS_UniMap *result = NULL; + PS_UniMap *min = table->maps; + PS_UniMap *max = min + table->num_maps; + PS_UniMap *mid = min + ( ( max - min ) >> 1 ); /* Perform a binary search on the table. */ - - min = table->maps; - max = min + table->num_maps - 1; - - while ( min <= max ) + while ( min < max ) { FT_UInt32 base_glyph; - mid = min + ( ( max - min ) >> 1 ); - if ( mid->unicode == unicode ) { result = mid; @@ -438,13 +435,15 @@ if ( base_glyph == unicode ) result = mid; /* remember match but continue search for base glyph */ - if ( min == max ) - break; - if ( base_glyph < unicode ) min = mid + 1; else - max = mid - 1; + max = mid; + + /* reasonable prediction in a continuous block */ + mid += unicode - base_glyph; + if ( mid >= max || mid < min ) + mid = min + ( ( max - min ) >> 1 ); } if ( result ) @@ -465,14 +464,13 @@ { FT_UInt min = 0; FT_UInt max = table->num_maps; - FT_UInt mid; + FT_UInt mid = min + ( ( max - min ) >> 1 ); PS_UniMap* map; FT_UInt32 base_glyph; while ( min < max ) { - mid = min + ( ( max - min ) >> 1 ); map = table->maps + mid; if ( map->unicode == char_code ) @@ -490,6 +488,11 @@ min = mid + 1; else max = mid; + + /* reasonable prediction in a continuous block */ + mid += char_code - base_glyph; + if ( mid >= max || mid < min ) + mid = min + ( max - min ) / 2; } if ( result ) diff --git a/lib/freetype/src/psnames/psmodule.h b/lib/freetype/src/psnames/psmodule.h index ff3eda564..0904700bf 100644 --- a/lib/freetype/src/psnames/psmodule.h +++ b/lib/freetype/src/psnames/psmodule.h @@ -4,7 +4,7 @@ * * High-level psnames module interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psnames/psnamerr.h b/lib/freetype/src/psnames/psnamerr.h index ae5662027..0073f8228 100644 --- a/lib/freetype/src/psnames/psnamerr.h +++ b/lib/freetype/src/psnames/psnamerr.h @@ -4,7 +4,7 @@ * * PS names module error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psnames/psnames.c b/lib/freetype/src/psnames/psnames.c index c844a317f..93ed9332f 100644 --- a/lib/freetype/src/psnames/psnames.c +++ b/lib/freetype/src/psnames/psnames.c @@ -4,7 +4,7 @@ * * FreeType psnames module component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psnames/pstables.h b/lib/freetype/src/psnames/pstables.h index d28d580b9..7f92cce60 100644 --- a/lib/freetype/src/psnames/pstables.h +++ b/lib/freetype/src/psnames/pstables.h @@ -4,7 +4,7 @@ * * PostScript glyph names. * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/psnames/rules.mk b/lib/freetype/src/psnames/rules.mk index 3768e2f1d..8d7c58068 100644 --- a/lib/freetype/src/psnames/rules.mk +++ b/lib/freetype/src/psnames/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/raster/ftmisc.h b/lib/freetype/src/raster/ftmisc.h index 75fb5f843..33dbfd631 100644 --- a/lib/freetype/src/raster/ftmisc.h +++ b/lib/freetype/src/raster/ftmisc.h @@ -5,7 +5,7 @@ * Miscellaneous macros for stand-alone rasterizer (specification * only). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/lib/freetype/src/raster/ftraster.c b/lib/freetype/src/raster/ftraster.c index 68b0e1fdd..67cbfd5d9 100644 --- a/lib/freetype/src/raster/ftraster.c +++ b/lib/freetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -2219,8 +2219,8 @@ /* represent multiples of 1/(1<<12) = 1/4096 */ FT_TRACE7(( " y=%d x=[% .12f;% .12f]", y, - x1 / (double)ras.precision, - x2 / (double)ras.precision )); + (double)x1 / (double)ras.precision, + (double)x2 / (double)ras.precision )); /* Drop-out control */ @@ -2294,8 +2294,8 @@ FT_TRACE7(( " y=%d x=[% .12f;% .12f]", y, - x1 / (double)ras.precision, - x2 / (double)ras.precision )); + (double)x1 / (double)ras.precision, + (double)x2 / (double)ras.precision )); /* Drop-out control */ @@ -2477,8 +2477,8 @@ FT_TRACE7(( " x=%d y=[% .12f;% .12f]", y, - x1 / (double)ras.precision, - x2 / (double)ras.precision )); + (double)x1 / (double)ras.precision, + (double)x2 / (double)ras.precision )); /* We should not need this procedure but the vertical sweep */ /* mishandles horizontal lines through pixel centers. So we */ @@ -2548,8 +2548,8 @@ FT_TRACE7(( " x=%d y=[% .12f;% .12f]", y, - x1 / (double)ras.precision, - x2 / (double)ras.precision )); + (double)x1 / (double)ras.precision, + (double)x2 / (double)ras.precision )); /* During the horizontal sweep, we only take care of drop-outs */ diff --git a/lib/freetype/src/raster/ftraster.h b/lib/freetype/src/raster/ftraster.h index e9ece8cf0..b511b3a99 100644 --- a/lib/freetype/src/raster/ftraster.h +++ b/lib/freetype/src/raster/ftraster.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/lib/freetype/src/raster/ftrend1.c b/lib/freetype/src/raster/ftrend1.c index f319f03d9..0b5d86714 100644 --- a/lib/freetype/src/raster/ftrend1.c +++ b/lib/freetype/src/raster/ftrend1.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/raster/ftrend1.h b/lib/freetype/src/raster/ftrend1.h index 14ec336b1..cec35c852 100644 --- a/lib/freetype/src/raster/ftrend1.h +++ b/lib/freetype/src/raster/ftrend1.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/raster/module.mk b/lib/freetype/src/raster/module.mk index b56a4902b..6ad1aa77b 100644 --- a/lib/freetype/src/raster/module.mk +++ b/lib/freetype/src/raster/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/raster/raster.c b/lib/freetype/src/raster/raster.c index 324cc5661..82f474547 100644 --- a/lib/freetype/src/raster/raster.c +++ b/lib/freetype/src/raster/raster.c @@ -4,7 +4,7 @@ * * FreeType monochrome rasterer module component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/raster/rasterrs.h b/lib/freetype/src/raster/rasterrs.h index 8b1ebf07a..989d8b44b 100644 --- a/lib/freetype/src/raster/rasterrs.h +++ b/lib/freetype/src/raster/rasterrs.h @@ -4,7 +4,7 @@ * * monochrome renderer error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/raster/rules.mk b/lib/freetype/src/raster/rules.mk index 0cf3b4bff..031b85fb9 100644 --- a/lib/freetype/src/raster/rules.mk +++ b/lib/freetype/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/sdf/ftbsdf.c b/lib/freetype/src/sdf/ftbsdf.c index 1328ac498..901d8b740 100644 --- a/lib/freetype/src/sdf/ftbsdf.c +++ b/lib/freetype/src/sdf/ftbsdf.c @@ -4,7 +4,7 @@ * * Signed Distance Field support for bitmap fonts (body only). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. @@ -1116,13 +1116,13 @@ goto Exit; } - spread = FT_INT_16D16( worker->params.spread ); + spread = (FT_16D16)FT_INT_16D16( worker->params.spread ); #if USE_SQUARED_DISTANCES - sp_sq = FT_INT_16D16( worker->params.spread * - worker->params.spread ); + sp_sq = (FT_16D16)FT_INT_16D16( worker->params.spread * + worker->params.spread ); #else - sp_sq = FT_INT_16D16( worker->params.spread ); + sp_sq = (FT_16D16)FT_INT_16D16( worker->params.spread ); #endif for ( j = 0; j < r; j++ ) diff --git a/lib/freetype/src/sdf/ftsdf.c b/lib/freetype/src/sdf/ftsdf.c index ffac8bf46..26a6d00e4 100644 --- a/lib/freetype/src/sdf/ftsdf.c +++ b/lib/freetype/src/sdf/ftsdf.c @@ -4,7 +4,7 @@ * * Signed Distance Field support for outline fonts (body). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. @@ -871,7 +871,7 @@ cbox.yMax = edge.control_b.y; is_set = 1; - /* fall through */ + FALL_THROUGH; case SDF_EDGE_CONIC: if ( is_set ) @@ -899,7 +899,7 @@ is_set = 1; } - /* fall through */ + FALL_THROUGH; case SDF_EDGE_LINE: if ( is_set ) @@ -1293,7 +1293,7 @@ /* Calculate the number of necessary bisections. Each */ /* bisection causes a four-fold reduction of the deviation, */ /* hence we bisect the Bezier curve until the deviation */ - /* becomes less than 1/8th of a pixel. For more details */ + /* becomes less than 1/8 of a pixel. For more details */ /* check file `ftgrays.c`. */ num_splits = 1; while ( dx > ONE_PIXEL / 8 ) @@ -1939,7 +1939,7 @@ /* now factor is 16.16 */ factor = FT_DivFix( factor, sq_line_length ); - /* clamp the factor between 0.0 and 1.0 in fixed point */ + /* clamp the factor between 0.0 and 1.0 in fixed-point */ if ( factor > FT_INT_16D16( 1 ) ) factor = FT_INT_16D16( 1 ); if ( factor < 0 ) @@ -2109,7 +2109,8 @@ FT_Error error = FT_Err_Ok; FT_26D6_Vec aA, bB; /* A, B in the above comment */ - FT_26D6_Vec nearest_point; /* point on curve nearest to `point` */ + FT_26D6_Vec nearest_point = { 0, 0 }; + /* point on curve nearest to `point` */ FT_26D6_Vec direction; /* direction of curve at `nearest_point` */ FT_26D6_Vec p0, p1, p2; /* control points of a conic curve */ @@ -2405,7 +2406,8 @@ FT_Error error = FT_Err_Ok; FT_26D6_Vec aA, bB, cC; /* A, B, C in the above comment */ - FT_26D6_Vec nearest_point; /* point on curve nearest to `point` */ + FT_26D6_Vec nearest_point = { 0, 0 }; + /* point on curve nearest to `point` */ FT_26D6_Vec direction; /* direction of curve at `nearest_point` */ FT_26D6_Vec p0, p1, p2; /* control points of a conic curve */ @@ -3164,7 +3166,7 @@ if ( min_dist.distance > sp_sq ) min_dist.distance = sp_sq; - /* square_root the values and fit in a 6.10 fixed point */ + /* square_root the values and fit in a 6.10 fixed-point */ if ( USE_SQUARED_DISTANCES ) min_dist.distance = square_root( min_dist.distance ); @@ -3256,7 +3258,7 @@ /* and also determine the signs properly. */ SDF_Signed_Distance* dists = NULL; - const FT_16D16 fixed_spread = FT_INT_16D16( spread ); + const FT_16D16 fixed_spread = (FT_16D16)FT_INT_16D16( spread ); if ( !shape || !bitmap ) diff --git a/lib/freetype/src/sdf/ftsdf.h b/lib/freetype/src/sdf/ftsdf.h index 5f6b3f52a..234c075b0 100644 --- a/lib/freetype/src/sdf/ftsdf.h +++ b/lib/freetype/src/sdf/ftsdf.h @@ -4,7 +4,7 @@ * * Signed Distance Field support (specification). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/lib/freetype/src/sdf/ftsdfcommon.c b/lib/freetype/src/sdf/ftsdfcommon.c index 072a36ea6..5052201e2 100644 --- a/lib/freetype/src/sdf/ftsdfcommon.c +++ b/lib/freetype/src/sdf/ftsdfcommon.c @@ -4,7 +4,7 @@ * * Auxiliary data for Signed Distance Field support (body). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. @@ -33,7 +33,7 @@ * * https://github.com/chmike/fpsqrt * - * Use this to compute the square root of a 16.16 fixed point number. + * Use this to compute the square root of a 16.16 fixed-point number. */ FT_LOCAL_DEF( FT_16D16 ) square_root( FT_16D16 val ) @@ -72,8 +72,8 @@ */ /* - * Convert 16.16 fixed point values to the desired output format. - * In this case we reduce 16.16 fixed point values to normalized + * Convert 16.16 fixed-point values to the desired output format. + * In this case we reduce 16.16 fixed-point values to normalized * 8-bit values. * * The `max_value` in the parameter is the maximum value in the diff --git a/lib/freetype/src/sdf/ftsdfcommon.h b/lib/freetype/src/sdf/ftsdfcommon.h index af4490bbc..60ca9773e 100644 --- a/lib/freetype/src/sdf/ftsdfcommon.h +++ b/lib/freetype/src/sdf/ftsdfcommon.h @@ -4,7 +4,7 @@ * * Auxiliary data for Signed Distance Field support (specification). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. @@ -115,8 +115,8 @@ FT_BEGIN_HEADER typedef FT_Vector FT_26D6_Vec; /* with 26.6 fixed-point components */ typedef FT_Vector FT_16D16_Vec; /* with 16.16 fixed-point components */ - typedef FT_Fixed FT_16D16; /* 16.16 fixed-point representation */ - typedef FT_Fixed FT_26D6; /* 26.6 fixed-point representation */ + typedef FT_Int32 FT_16D16; /* 16.16 fixed-point representation */ + typedef FT_Int32 FT_26D6; /* 26.6 fixed-point representation */ typedef FT_Byte FT_SDFFormat; /* format to represent SDF data */ typedef FT_BBox FT_CBox; /* control box of a curve */ diff --git a/lib/freetype/src/sdf/ftsdferrs.h b/lib/freetype/src/sdf/ftsdferrs.h index b28867609..519db0fc2 100644 --- a/lib/freetype/src/sdf/ftsdferrs.h +++ b/lib/freetype/src/sdf/ftsdferrs.h @@ -4,7 +4,7 @@ * * Signed Distance Field error codes (specification only). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/lib/freetype/src/sdf/ftsdfrend.c b/lib/freetype/src/sdf/ftsdfrend.c index b0213a40d..9ac7d6f62 100644 --- a/lib/freetype/src/sdf/ftsdfrend.c +++ b/lib/freetype/src/sdf/ftsdfrend.c @@ -4,7 +4,7 @@ * * Signed Distance Field renderer interface (body). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/lib/freetype/src/sdf/ftsdfrend.h b/lib/freetype/src/sdf/ftsdfrend.h index cdb9c5f02..571ac833d 100644 --- a/lib/freetype/src/sdf/ftsdfrend.h +++ b/lib/freetype/src/sdf/ftsdfrend.h @@ -4,7 +4,7 @@ * * Signed Distance Field renderer interface (specification). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/lib/freetype/src/sdf/module.mk b/lib/freetype/src/sdf/module.mk index 772bc48bf..e896d20e6 100644 --- a/lib/freetype/src/sdf/module.mk +++ b/lib/freetype/src/sdf/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/src/sdf/rules.mk b/lib/freetype/src/sdf/rules.mk index 5239d643f..d7742413c 100644 --- a/lib/freetype/src/sdf/rules.mk +++ b/lib/freetype/src/sdf/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2020-2022 by +# Copyright (C) 2020-2023 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/lib/freetype/src/sdf/sdf.c b/lib/freetype/src/sdf/sdf.c index 297ba9ab0..c159b0812 100644 --- a/lib/freetype/src/sdf/sdf.c +++ b/lib/freetype/src/sdf/sdf.c @@ -4,7 +4,7 @@ * * FreeType Signed Distance Field renderer module component (body only). * - * Copyright (C) 2020-2022 by + * Copyright (C) 2020-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Anuj Verma. diff --git a/lib/freetype/src/sfnt/module.mk b/lib/freetype/src/sfnt/module.mk index dbdde1564..4491a1b22 100644 --- a/lib/freetype/src/sfnt/module.mk +++ b/lib/freetype/src/sfnt/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/sfnt/pngshim.c b/lib/freetype/src/sfnt/pngshim.c index 0ce4bdb6b..423b07b02 100644 --- a/lib/freetype/src/sfnt/pngshim.c +++ b/lib/freetype/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * @@ -239,7 +239,7 @@ *e = FT_THROW( Invalid_Stream_Read ); png_error( png, NULL ); - return; + /* return; (never reached) */ } ft_memcpy( data, stream->cursor, length ); @@ -407,7 +407,8 @@ switch ( color_type ) { default: - /* Shouldn't happen, but fall through. */ + /* Shouldn't happen, but ... */ + FALL_THROUGH; case PNG_COLOR_TYPE_RGB_ALPHA: png_set_read_user_transform_fn( png, premultiply_data ); diff --git a/lib/freetype/src/sfnt/pngshim.h b/lib/freetype/src/sfnt/pngshim.h index 36d749c3c..903bd2bc3 100644 --- a/lib/freetype/src/sfnt/pngshim.h +++ b/lib/freetype/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2023 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * diff --git a/lib/freetype/src/sfnt/rules.mk b/lib/freetype/src/sfnt/rules.mk index ac4b57122..4d2d7e8d8 100644 --- a/lib/freetype/src/sfnt/rules.mk +++ b/lib/freetype/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/sfnt/sfdriver.c b/lib/freetype/src/sfnt/sfdriver.c index cc121e579..762883db5 100644 --- a/lib/freetype/src/sfnt/sfdriver.c +++ b/lib/freetype/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -378,61 +378,61 @@ { case 15: k4 ^= (FT_UInt32)tail[14] << 16; - /* fall through */ + FALL_THROUGH; case 14: k4 ^= (FT_UInt32)tail[13] << 8; - /* fall through */ + FALL_THROUGH; case 13: k4 ^= (FT_UInt32)tail[12]; k4 *= c4; k4 = ROTL32( k4, 18 ); k4 *= c1; h4 ^= k4; - /* fall through */ + FALL_THROUGH; case 12: k3 ^= (FT_UInt32)tail[11] << 24; - /* fall through */ + FALL_THROUGH; case 11: k3 ^= (FT_UInt32)tail[10] << 16; - /* fall through */ + FALL_THROUGH; case 10: k3 ^= (FT_UInt32)tail[9] << 8; - /* fall through */ + FALL_THROUGH; case 9: k3 ^= (FT_UInt32)tail[8]; k3 *= c3; k3 = ROTL32( k3, 17 ); k3 *= c4; h3 ^= k3; - /* fall through */ + FALL_THROUGH; case 8: k2 ^= (FT_UInt32)tail[7] << 24; - /* fall through */ + FALL_THROUGH; case 7: k2 ^= (FT_UInt32)tail[6] << 16; - /* fall through */ + FALL_THROUGH; case 6: k2 ^= (FT_UInt32)tail[5] << 8; - /* fall through */ + FALL_THROUGH; case 5: k2 ^= (FT_UInt32)tail[4]; k2 *= c2; k2 = ROTL32( k2, 16 ); k2 *= c3; h2 ^= k2; - /* fall through */ + FALL_THROUGH; case 4: k1 ^= (FT_UInt32)tail[3] << 24; - /* fall through */ + FALL_THROUGH; case 3: k1 ^= (FT_UInt32)tail[2] << 16; - /* fall through */ + FALL_THROUGH; case 2: k1 ^= (FT_UInt32)tail[1] << 8; - /* fall through */ + FALL_THROUGH; case 1: k1 ^= (FT_UInt32)tail[0]; k1 *= c1; @@ -657,7 +657,7 @@ /* - * Find the shortest decimal representation of a 16.16 fixed point + * Find the shortest decimal representation of a 16.16 fixed-point * number. The function fills `buf' with the result, returning a pointer * to the position after the representation's last byte. */ @@ -733,7 +733,7 @@ an equivalent representation of `fixed'. The above FOR loop always finds the larger of the two values; I - verified this by iterating over all possible fixed point numbers. + verified this by iterating over all possible fixed-point numbers. If the remainder is 17232*10, both values are equally good, and we take the next even number (following IEEE 754's `round to nearest, @@ -741,7 +741,7 @@ If the remainder is smaller than 17232*10, the lower of the two numbers is nearer to the exact result (values 17232 and 34480 were - also found by testing all possible fixed point values). + also found by testing all possible fixed-point values). We use this to find a shorter decimal representation. If not ending with digit zero, we take the representation with less error. diff --git a/lib/freetype/src/sfnt/sfdriver.h b/lib/freetype/src/sfnt/sfdriver.h index 6a2e3e9c7..2445958b6 100644 --- a/lib/freetype/src/sfnt/sfdriver.h +++ b/lib/freetype/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/sferrors.h b/lib/freetype/src/sfnt/sferrors.h index 99ef3f9fc..e7a8eb04b 100644 --- a/lib/freetype/src/sfnt/sferrors.h +++ b/lib/freetype/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ * * SFNT error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/sfnt.c b/lib/freetype/src/sfnt/sfnt.c index 9b3ceaedc..8e4f08a90 100644 --- a/lib/freetype/src/sfnt/sfnt.c +++ b/lib/freetype/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ * * Single object library component. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/sfobjs.c b/lib/freetype/src/sfnt/sfobjs.c index a0da984e7..e018934cc 100644 --- a/lib/freetype/src/sfnt/sfobjs.c +++ b/lib/freetype/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ * * SFNT object management (base). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1107,13 +1107,7 @@ /* Don't bother to load the tables unless somebody asks for them. */ /* No need to do work which will (probably) not be used. */ if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) - { - if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 && - tt_face_lookup_table( face, TTAG_gvar ) != 0 ) - flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; - if ( tt_face_lookup_table( face, TTAG_CFF2 ) != 0 ) - flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; - } + flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; #endif root->face_flags = flags; diff --git a/lib/freetype/src/sfnt/sfobjs.h b/lib/freetype/src/sfnt/sfobjs.h index 1d99bfede..906aebbf9 100644 --- a/lib/freetype/src/sfnt/sfobjs.h +++ b/lib/freetype/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ * * SFNT object management (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/sfwoff.c b/lib/freetype/src/sfnt/sfwoff.c index 0e8ec3fa9..9559bf342 100644 --- a/lib/freetype/src/sfnt/sfwoff.c +++ b/lib/freetype/src/sfnt/sfwoff.c @@ -4,7 +4,7 @@ * * WOFF format management (base). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -162,8 +162,7 @@ } /* Don't trust `totalSfntSize' before thorough checks. */ - if ( FT_QALLOC( sfnt, 12 + woff.num_tables * 16UL ) || - FT_NEW( sfnt_stream ) ) + if ( FT_QALLOC( sfnt, 12 ) || FT_NEW( sfnt_stream ) ) goto Exit; sfnt_header = sfnt; @@ -196,8 +195,8 @@ /* tag value, the tables themselves are not. We thus have to */ /* sort them by offset and check that they don't overlap. */ - if ( FT_NEW_ARRAY( tables, woff.num_tables ) || - FT_NEW_ARRAY( indices, woff.num_tables ) ) + if ( FT_QNEW_ARRAY( tables, woff.num_tables ) || + FT_QNEW_ARRAY( indices, woff.num_tables ) ) goto Exit; FT_TRACE2(( "\n" )); @@ -328,9 +327,7 @@ } /* Now use `totalSfntSize'. */ - if ( FT_REALLOC( sfnt, - 12 + woff.num_tables * 16UL, - woff.totalSfntSize ) ) + if ( FT_QREALLOC( sfnt, 12, woff.totalSfntSize ) ) goto Exit; sfnt_header = sfnt + 12; diff --git a/lib/freetype/src/sfnt/sfwoff.h b/lib/freetype/src/sfnt/sfwoff.h index 5866a1619..d43842273 100644 --- a/lib/freetype/src/sfnt/sfwoff.h +++ b/lib/freetype/src/sfnt/sfwoff.h @@ -4,7 +4,7 @@ * * WOFFF format management (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/sfwoff2.c b/lib/freetype/src/sfnt/sfwoff2.c index b2855b8e7..7a01977f8 100644 --- a/lib/freetype/src/sfnt/sfwoff2.c +++ b/lib/freetype/src/sfnt/sfwoff2.c @@ -4,7 +4,7 @@ * * WOFF2 format management (base). * - * Copyright (C) 2019-2022 by + * Copyright (C) 2019-2023 by * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -229,9 +229,9 @@ { FT_TRACE6(( "Reallocating %lu to %lu.\n", *dst_size, (*offset + size) )); - if ( FT_REALLOC( dst, - (FT_ULong)( *dst_size ), - (FT_ULong)( *offset + size ) ) ) + if ( FT_QREALLOC( dst, + (FT_ULong)( *dst_size ), + (FT_ULong)( *offset + size ) ) ) goto Exit; *dst_size = *offset + size; @@ -784,7 +784,7 @@ goto Fail; loca_buf_size = loca_values_size * offset_size; - if ( FT_QNEW_ARRAY( loca_buf, loca_buf_size ) ) + if ( FT_QALLOC( loca_buf, loca_buf_size ) ) goto Fail; dst = loca_buf; @@ -863,7 +863,7 @@ WOFF2_Point points = NULL; - if ( FT_NEW_ARRAY( substreams, num_substreams ) ) + if ( FT_QNEW_ARRAY( substreams, num_substreams ) ) goto Fail; if ( FT_STREAM_SKIP( 2 ) ) @@ -926,7 +926,7 @@ offset += overlap_bitmap_length; } - if ( FT_NEW_ARRAY( loca_values, num_glyphs + 1 ) ) + if ( FT_QNEW_ARRAY( loca_values, num_glyphs + 1 ) ) goto Fail; points_size = 0; @@ -938,10 +938,10 @@ substreams[BBOX_STREAM].offset += bbox_bitmap_length; glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF; - if ( FT_NEW_ARRAY( glyph_buf, glyph_buf_size ) ) + if ( FT_QALLOC( glyph_buf, glyph_buf_size ) ) goto Fail; - if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) ) + if ( FT_QNEW_ARRAY( info->x_mins, num_glyphs ) ) goto Fail; for ( i = 0; i < num_glyphs; ++i ) @@ -999,7 +999,7 @@ size_needed = 12 + composite_size + instruction_size; if ( glyph_buf_size < size_needed ) { - if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) ) + if ( FT_QREALLOC( glyph_buf, glyph_buf_size, size_needed ) ) goto Fail; glyph_buf_size = size_needed; } @@ -1075,7 +1075,7 @@ have_overlap = TRUE; } - if ( FT_NEW_ARRAY( n_points_arr, n_contours ) ) + if ( FT_QNEW_ARRAY( n_points_arr, n_contours ) ) goto Fail; if ( FT_STREAM_SEEK( substreams[N_POINTS_STREAM].offset ) ) @@ -1112,7 +1112,7 @@ /* Create array to store point information. */ points_size = total_n_points; - if ( FT_NEW_ARRAY( points, points_size ) ) + if ( FT_QNEW_ARRAY( points, points_size ) ) goto Fail; if ( triplet_decode( flags_buf, @@ -1141,7 +1141,7 @@ instruction_size; if ( glyph_buf_size < size_needed ) { - if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) ) + if ( FT_QREALLOC( glyph_buf, glyph_buf_size, size_needed ) ) goto Fail; glyph_buf_size = size_needed; } @@ -1226,8 +1226,7 @@ *glyf_checksum += compute_ULong_sum( glyph_buf, glyph_size ); /* Store x_mins, may be required to reconstruct `hmtx'. */ - if ( n_contours > 0 ) - info->x_mins[i] = (FT_Short)x_min; + info->x_mins[i] = (FT_Short)x_min; } info->glyf_table->dst_length = dest_offset - info->glyf_table->dst_offset; @@ -1344,7 +1343,7 @@ offset_size = index_format ? 4 : 2; /* Create `x_mins' array. */ - if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) ) + if ( FT_QNEW_ARRAY( info->x_mins, num_glyphs ) ) return error; loca_offset = info->loca_table->src_offset; @@ -1432,8 +1431,8 @@ if ( num_hmetrics < 1 ) goto Fail; - if ( FT_NEW_ARRAY( advance_widths, num_hmetrics ) || - FT_NEW_ARRAY( lsbs, num_glyphs ) ) + if ( FT_QNEW_ARRAY( advance_widths, num_hmetrics ) || + FT_QNEW_ARRAY( lsbs, num_glyphs ) ) goto Fail; /* Read `advanceWidth' stream. Always present. */ @@ -1484,7 +1483,7 @@ /* Build the hmtx table. */ hmtx_table_size = 2 * num_hmetrics + 2 * num_glyphs; - if ( FT_NEW_ARRAY( hmtx_table, hmtx_table_size ) ) + if ( FT_QALLOC( hmtx_table, hmtx_table_size ) ) goto Fail; dst = hmtx_table; @@ -1541,10 +1540,10 @@ { /* Memory management of `transformed_buf' is handled by the caller. */ - FT_Error error = FT_Err_Ok; - FT_Stream stream = NULL; - FT_Byte* buf_cursor = NULL; - FT_Byte* table_entry = NULL; + FT_Error error = FT_Err_Ok; + FT_Stream stream = NULL; + FT_Byte* buf_cursor = NULL; + FT_Byte table_entry[16]; /* We are reallocating memory for `sfnt', so its pointer may change. */ FT_Byte* sfnt = *sfnt_bytes; @@ -1585,10 +1584,6 @@ } } - /* Create buffer for table entries. */ - if ( FT_NEW_ARRAY( table_entry, 16 ) ) - goto Fail; - /* Create a stream for the uncompressed buffer. */ if ( FT_NEW( stream ) ) goto Fail; @@ -1751,7 +1746,6 @@ /* Set pointer of sfnt stream to its correct value. */ *sfnt_bytes = sfnt; - FT_FREE( table_entry ); FT_Stream_Close( stream ); FT_FREE( stream ); @@ -1764,7 +1758,6 @@ /* Set pointer of sfnt stream to its correct value. */ *sfnt_bytes = sfnt; - FT_FREE( table_entry ); FT_Stream_Close( stream ); FT_FREE( stream ); @@ -1877,8 +1870,8 @@ woff2.ttc_fonts = NULL; /* Read table directory. */ - if ( FT_NEW_ARRAY( tables, woff2.num_tables ) || - FT_NEW_ARRAY( indices, woff2.num_tables ) ) + if ( FT_QNEW_ARRAY( tables, woff2.num_tables ) || + FT_QNEW_ARRAY( indices, woff2.num_tables ) ) goto Exit; FT_TRACE2(( "\n" )); @@ -1949,10 +1942,11 @@ goto Exit; } + table->flags = flags; table->src_offset = src_offset; table->src_length = table->TransformLength; src_offset += table->TransformLength; - table->flags = flags; + table->dst_offset = 0; FT_TRACE2(( " %c%c%c%c %08d %08d %08ld %08ld %08ld\n", (FT_Char)( table->Tag >> 24 ), @@ -2010,6 +2004,7 @@ FT_TRACE4(( "Number of fonts in TTC: %d\n", woff2.num_fonts )); + /* pre-zero pointers within in case of failure */ if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) ) goto Exit; @@ -2023,7 +2018,7 @@ if ( FT_READ_ULONG( ttc_font->flavor ) ) goto Exit; - if ( FT_NEW_ARRAY( ttc_font->table_indices, ttc_font->num_tables ) ) + if ( FT_QNEW_ARRAY( ttc_font->table_indices, ttc_font->num_tables ) ) goto Exit; FT_TRACE5(( "Number of tables in font %d: %d\n", @@ -2302,9 +2297,9 @@ { FT_TRACE5(( "Trimming sfnt stream from %lu to %lu.\n", sfnt_size, woff2.actual_sfnt_size )); - if ( FT_REALLOC( sfnt, - (FT_ULong)( sfnt_size ), - (FT_ULong)( woff2.actual_sfnt_size ) ) ) + if ( FT_QREALLOC( sfnt, + (FT_ULong)( sfnt_size ), + (FT_ULong)( woff2.actual_sfnt_size ) ) ) goto Exit; } diff --git a/lib/freetype/src/sfnt/sfwoff2.h b/lib/freetype/src/sfnt/sfwoff2.h index e84982ed9..4901286ee 100644 --- a/lib/freetype/src/sfnt/sfwoff2.h +++ b/lib/freetype/src/sfnt/sfwoff2.h @@ -4,7 +4,7 @@ * * WOFFF2 format management (specification). * - * Copyright (C) 2019-2022 by + * Copyright (C) 2019-2023 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/lib/freetype/src/sfnt/ttbdf.c b/lib/freetype/src/sfnt/ttbdf.c index 4d2faf238..118f475e7 100644 --- a/lib/freetype/src/sfnt/ttbdf.c +++ b/lib/freetype/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (body). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttbdf.h b/lib/freetype/src/sfnt/ttbdf.h index b7b11c9be..595aeb76c 100644 --- a/lib/freetype/src/sfnt/ttbdf.h +++ b/lib/freetype/src/sfnt/ttbdf.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (specification). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttcmap.c b/lib/freetype/src/sfnt/ttcmap.c index bfeabacb7..820cd08e6 100644 --- a/lib/freetype/src/sfnt/ttcmap.c +++ b/lib/freetype/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -3879,13 +3879,14 @@ } - FT_LOCAL( FT_Error ) + FT_LOCAL_DEF( FT_Error ) tt_get_cmap_info( FT_CharMap charmap, TT_CMapInfo *cmap_info ) { FT_CMap cmap = (FT_CMap)charmap; TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz; + if ( clazz->get_cmap_info ) return clazz->get_cmap_info( charmap, cmap_info ); else diff --git a/lib/freetype/src/sfnt/ttcmap.h b/lib/freetype/src/sfnt/ttcmap.h index b10860b34..ff52917ed 100644 --- a/lib/freetype/src/sfnt/ttcmap.h +++ b/lib/freetype/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttcmapc.h b/lib/freetype/src/sfnt/ttcmapc.h index 6822a9cd6..0af48c247 100644 --- a/lib/freetype/src/sfnt/ttcmapc.h +++ b/lib/freetype/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ * * TT CMAP classes definitions (specification only). * - * Copyright (C) 2009-2022 by + * Copyright (C) 2009-2023 by * Oran Agra and Mickey Gabel. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttcolr.c b/lib/freetype/src/sfnt/ttcolr.c index d54231fd6..5d98dcab8 100644 --- a/lib/freetype/src/sfnt/ttcolr.c +++ b/lib/freetype/src/sfnt/ttcolr.c @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (body). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2023 by * David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. @@ -34,6 +34,9 @@ #include <freetype/ftcolor.h> #include <freetype/config/integer-types.h> +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include <freetype/internal/services/svmm.h> +#endif #ifdef TT_CONFIG_OPTION_COLOR_LAYERS @@ -46,17 +49,42 @@ #define LAYER_V1_LIST_PAINT_OFFSET_SIZE 4U #define LAYER_V1_LIST_NUM_LAYERS_SIZE 4U #define COLOR_STOP_SIZE 6U +#define VAR_IDX_BASE_SIZE 4U #define LAYER_SIZE 4U -#define COLR_HEADER_SIZE 14U +/* https://docs.microsoft.com/en-us/typography/opentype/spec/colr#colr-header */ +/* 3 * uint16 + 2 * Offset32 */ +#define COLRV0_HEADER_SIZE 14U +/* COLRV0_HEADER_SIZE + 5 * Offset32 */ +#define COLRV1_HEADER_SIZE 34U + + +#define ENSURE_READ_BYTES( byte_size ) \ + if ( p < colr->paints_start_v1 || \ + p > (FT_Byte*)colr->table + colr->table_size - byte_size ) \ + return 0 typedef enum FT_PaintFormat_Internal_ { - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER = 18, - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM = 20, - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER = 22, - FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER = 26, - FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER = 30 + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID = 3, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT = 5, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT = 7, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT = 9, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM = 13, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE = 15, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE = 17, + FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER = 18, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER = 19, + FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM = 20, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM = 21, + FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER = 22, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER = 23, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE = 25, + FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER = 26, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER = 27, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW = 29, + FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER = 30, + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER = 31, } FT_PaintFormat_Internal; @@ -104,6 +132,12 @@ */ FT_Byte* paints_start_v1; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* Item Variation Store for variable 'COLR' v1. */ + GX_ItemVarStoreRec var_store; + GX_DeltaSetIdxMapRec delta_set_idx_map; +#endif + /* The memory that backs up the `COLR' table. */ void* table; FT_ULong table_size; @@ -139,6 +173,9 @@ FT_ULong base_glyphs_offset_v1, num_base_glyphs_v1; FT_ULong layer_offset_v1, num_layers_v1, clip_list_offset; FT_ULong table_size; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_ULong colr_offset_in_stream; +#endif /* `COLR' always needs `CPAL' */ @@ -149,8 +186,12 @@ if ( error ) goto NoColr; - if ( table_size < COLR_HEADER_SIZE ) - goto InvalidTable; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + colr_offset_in_stream = FT_STREAM_POS(); +#endif + + if ( table_size < COLRV0_HEADER_SIZE ) + goto NoColr; if ( FT_FRAME_EXTRACT( table_size, table ) ) goto NoColr; @@ -183,9 +224,12 @@ if ( colr->version == 1 ) { + if ( table_size < COLRV1_HEADER_SIZE ) + goto InvalidTable; + base_glyphs_offset_v1 = FT_NEXT_ULONG( p ); - if ( base_glyphs_offset_v1 >= table_size ) + if ( base_glyphs_offset_v1 + 4 >= table_size ) goto InvalidTable; p1 = (FT_Byte*)( table + base_glyphs_offset_v1 ); @@ -205,6 +249,9 @@ if ( layer_offset_v1 ) { + if ( layer_offset_v1 + 4 >= table_size ) + goto InvalidTable; + p1 = (FT_Byte*)( table + layer_offset_v1 ); num_layers_v1 = FT_PEEK_ULONG( p1 ); @@ -239,6 +286,65 @@ colr->clip_list = (FT_Byte*)( table + clip_list_offset ); else colr->clip_list = 0; + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + colr->var_store.dataCount = 0; + colr->var_store.varData = NULL; + colr->var_store.axisCount = 0; + colr->var_store.regionCount = 0; + colr->var_store.varRegionList = 0; + + colr->delta_set_idx_map.mapCount = 0; + colr->delta_set_idx_map.outerIndex = NULL; + colr->delta_set_idx_map.innerIndex = NULL; + + if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) + { + FT_ULong var_idx_map_offset, var_store_offset; + + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + var_idx_map_offset = FT_NEXT_ULONG( p ); + + if ( var_idx_map_offset >= table_size ) + goto InvalidTable; + + var_store_offset = FT_NEXT_ULONG( p ); + if ( var_store_offset >= table_size ) + goto InvalidTable; + + if ( var_store_offset ) + { + /* If variation info has not been initialized yet, try doing so, */ + /* otherwise loading the variation store will fail as it */ + /* requires access to `blend` for checking the number of axes. */ + if ( !face->blend ) + if ( mm->get_mm_var( FT_FACE( face ), NULL ) ) + goto InvalidTable; + + /* Try loading `VarIdxMap` and `VarStore`. */ + error = mm->load_item_var_store( + FT_FACE( face ), + colr_offset_in_stream + var_store_offset, + &colr->var_store ); + if ( error != FT_Err_Ok ) + goto InvalidTable; + } + + if ( colr->var_store.axisCount && var_idx_map_offset ) + { + error = mm->load_delta_set_idx_map( + FT_FACE( face ), + colr_offset_in_stream + var_idx_map_offset, + &colr->delta_set_idx_map, + &colr->var_store, + table_size ); + if ( error != FT_Err_Ok ) + goto InvalidTable; + } + } +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ } colr->base_glyphs = (FT_Byte*)( table + base_glyph_offset ); @@ -251,6 +357,18 @@ return FT_Err_Ok; InvalidTable: +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + mm->done_delta_set_idx_map( FT_FACE( face ), + &colr->delta_set_idx_map ); + mm->done_item_var_store( FT_FACE( face ), + &colr->var_store ); + } +#endif + error = FT_THROW( Invalid_Table ); NoColr: @@ -272,6 +390,17 @@ if ( colr ) { +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + mm->done_delta_set_idx_map( FT_FACE( face ), + &colr->delta_set_idx_map ); + mm->done_item_var_store( FT_FACE( face ), + &colr->var_store ); + } +#endif FT_FRAME_RELEASE( colr->table ); FT_FREE( colr ); } @@ -354,7 +483,9 @@ iterator->p = colr->layers + offset; } - if ( iterator->layer >= iterator->num_layers ) + if ( iterator->layer >= iterator->num_layers || + iterator->p < colr->layers || + iterator->p >= ( (FT_Byte*)colr->table + colr->table_size ) ) return 0; *aglyph_index = FT_NEXT_USHORT( iterator->p ); @@ -372,13 +503,17 @@ static FT_Bool - read_color_line( FT_Byte* color_line_p, - FT_ColorLine *colorline ) + read_color_line( Colr* colr, + FT_Byte* color_line_p, + FT_ColorLine* colorline, + FT_Bool read_variable ) { FT_Byte* p = color_line_p; FT_PaintExtend paint_extend; + ENSURE_READ_BYTES( 3 ); + paint_extend = (FT_PaintExtend)FT_NEXT_BYTE( p ); if ( paint_extend > FT_COLR_PAINT_EXTEND_REFLECT ) return 0; @@ -388,6 +523,7 @@ colorline->color_stop_iterator.num_color_stops = FT_NEXT_USHORT( p ); colorline->color_stop_iterator.p = p; colorline->color_stop_iterator.current_color_stop = 0; + colorline->color_stop_iterator.read_variable = read_variable; return 1; } @@ -413,6 +549,10 @@ if ( !child_table_pointer ) return 0; + if ( *p < colr->paints_start_v1 || + *p > (FT_Byte*)colr->table + colr->table_size - 1 - 3 ) + return 0; + paint_offset = FT_NEXT_UOFF3( *p ); if ( !paint_offset ) return 0; @@ -428,20 +568,85 @@ } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + static FT_Bool - read_paint( Colr* colr, + get_deltas_for_var_index_base ( TT_Face face, + Colr* colr, + FT_ULong var_index_base, + FT_UInt num_deltas, + FT_ItemVarDelta* deltas ) + { + FT_UInt outer_index = 0; + FT_UInt inner_index = 0; + FT_ULong loop_var_index = var_index_base; + + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + FT_UInt i = 0; + + + if ( var_index_base == 0xFFFFFFFF ) + { + for ( i = 0; i < num_deltas; ++i ) + deltas[i] = 0; + return 1; + } + + for ( i = 0; i < num_deltas; ++i ) + { + loop_var_index = var_index_base + i; + + if ( colr->delta_set_idx_map.innerIndex ) + { + if ( loop_var_index >= colr->delta_set_idx_map.mapCount ) + loop_var_index = colr->delta_set_idx_map.mapCount - 1; + + outer_index = colr->delta_set_idx_map.outerIndex[loop_var_index]; + inner_index = colr->delta_set_idx_map.innerIndex[loop_var_index]; + } + else + { + outer_index = 0; + inner_index = loop_var_index; + } + + deltas[i] = mm->get_item_delta( FT_FACE( face ), &colr->var_store, + outer_index, inner_index ); + } + + return 1; + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + + static FT_Bool + read_paint( TT_Face face, + Colr* colr, FT_Byte* p, FT_COLR_Paint* apaint ) { - FT_Byte* paint_base = p; - FT_Byte* child_table_p = NULL; + FT_Byte* paint_base = p; + FT_Byte* child_table_p = NULL; + FT_Bool do_read_var = FALSE; + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_ULong var_index_base = 0; + /* Longest varIndexBase offset is 5 in the spec. */ + FT_ItemVarDelta item_deltas[6] = { 0, 0, 0, 0, 0, 0 }; +#else + FT_UNUSED( face ); +#endif if ( !p || !colr || !colr->table ) return 0; - if ( p < colr->paints_start_v1 || - p >= ( (FT_Byte*)colr->table + colr->table_size ) ) + /* The last byte of the 'COLR' table is at 'size-1'; subtract 1 of */ + /* that to account for the expected format byte we are going to read. */ + if ( p < colr->paints_start_v1 || + p > (FT_Byte*)colr->table + colr->table_size - 2 ) return 0; apaint->format = (FT_PaintFormat)FT_NEXT_BYTE( p ); @@ -475,16 +680,37 @@ return 1; } - else if ( apaint->format == FT_COLR_PAINTFORMAT_SOLID ) + else if ( apaint->format == FT_COLR_PAINTFORMAT_SOLID || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID ) { + ENSURE_READ_BYTES( 4 ); apaint->u.solid.color.palette_index = FT_NEXT_USHORT( p ); apaint->u.solid.color.alpha = FT_NEXT_SHORT( p ); +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG( p ); + + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 1, + item_deltas ) ) + return 0; + + apaint->u.solid.color.alpha += item_deltas[0]; + } +#endif + + apaint->format = FT_COLR_PAINTFORMAT_SOLID; + return 1; } else if ( apaint->format == FT_COLR_PAINTFORMAT_COLR_GLYPH ) { + ENSURE_READ_BYTES(2); apaint->u.colr_glyph.glyphID = FT_NEXT_USHORT( p ); return 1; @@ -500,16 +726,23 @@ if ( !get_child_table_pointer( colr, paint_base, &p, &child_table_p ) ) return 0; - if ( apaint->format == FT_COLR_PAINTFORMAT_LINEAR_GRADIENT ) + if ( apaint->format == FT_COLR_PAINTFORMAT_LINEAR_GRADIENT || + ( do_read_var = + ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT ) ) ) { - if ( !read_color_line( child_table_p, - &apaint->u.linear_gradient.colorline ) ) + if ( !read_color_line( colr, + child_table_p, + &apaint->u.linear_gradient.colorline, + do_read_var ) ) return 0; /* - * In order to support variations expose these as FT_Fixed 16.16 values so - * that we can support fractional values after interpolation. + * In order to support variations expose these as FT_Fixed 16.16 + * values so that we can support fractional values after + * interpolation. */ + ENSURE_READ_BYTES( 12 ); apaint->u.linear_gradient.p0.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.linear_gradient.p0.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.linear_gradient.p1.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); @@ -517,23 +750,52 @@ apaint->u.linear_gradient.p2.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.linear_gradient.p2.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( do_read_var ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG ( p ); + + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 6, + item_deltas ) ) + return 0; + + apaint->u.linear_gradient.p0.x += INT_TO_FIXED( item_deltas[0] ); + apaint->u.linear_gradient.p0.y += INT_TO_FIXED( item_deltas[1] ); + apaint->u.linear_gradient.p1.x += INT_TO_FIXED( item_deltas[2] ); + apaint->u.linear_gradient.p1.y += INT_TO_FIXED( item_deltas[3] ); + apaint->u.linear_gradient.p2.x += INT_TO_FIXED( item_deltas[4] ); + apaint->u.linear_gradient.p2.y += INT_TO_FIXED( item_deltas[5] ); + } +#endif + + apaint->format = FT_COLR_PAINTFORMAT_LINEAR_GRADIENT; + return 1; } - else if ( apaint->format == FT_COLR_PAINTFORMAT_RADIAL_GRADIENT ) + else if ( apaint->format == FT_COLR_PAINTFORMAT_RADIAL_GRADIENT || + ( do_read_var = + ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT ) ) ) { FT_Pos tmp; - if ( !read_color_line( child_table_p, - &apaint->u.radial_gradient.colorline ) ) + if ( !read_color_line( colr, + child_table_p, + &apaint->u.radial_gradient.colorline, + do_read_var ) ) return 0; + /* In the OpenType specification, `r0` and `r1` are defined as */ /* `UFWORD`. Since FreeType doesn't have a corresponding 16.16 */ /* format we convert to `FWORD` and replace negative values with */ /* (32bit) `FT_INT_MAX`. */ + ENSURE_READ_BYTES( 12 ); + apaint->u.radial_gradient.c0.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.radial_gradient.c0.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); @@ -546,15 +808,47 @@ tmp = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.radial_gradient.r1 = tmp < 0 ? FT_INT_MAX : tmp; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( do_read_var ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG ( p ); + + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 6, + item_deltas ) ) + return 0; + + apaint->u.radial_gradient.c0.x += INT_TO_FIXED( item_deltas[0] ); + apaint->u.radial_gradient.c0.y += INT_TO_FIXED( item_deltas[1] ); + + // TODO: Anything to be done about UFWORD deltas here? + apaint->u.radial_gradient.r0 += INT_TO_FIXED( item_deltas[2] ); + + apaint->u.radial_gradient.c1.x += INT_TO_FIXED( item_deltas[3] ); + apaint->u.radial_gradient.c1.y += INT_TO_FIXED( item_deltas[4] ); + + apaint->u.radial_gradient.r1 += INT_TO_FIXED( item_deltas[5] ); + } +#endif + + apaint->format = FT_COLR_PAINTFORMAT_RADIAL_GRADIENT; + return 1; } - else if ( apaint->format == FT_COLR_PAINTFORMAT_SWEEP_GRADIENT ) + else if ( apaint->format == FT_COLR_PAINTFORMAT_SWEEP_GRADIENT || + ( do_read_var = + ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT ) ) ) { - if ( !read_color_line( child_table_p, - &apaint->u.sweep_gradient.colorline ) ) + if ( !read_color_line( colr, + child_table_p, + &apaint->u.sweep_gradient.colorline, + do_read_var) ) return 0; + ENSURE_READ_BYTES( 8 ); + apaint->u.sweep_gradient.center.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.sweep_gradient.center.y = @@ -565,11 +859,34 @@ apaint->u.sweep_gradient.end_angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) ); +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( do_read_var ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG ( p ); + + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4, + item_deltas ) ) + return 0; + + // TODO: Handle overflow? + apaint->u.sweep_gradient.center.x += INT_TO_FIXED( item_deltas[0] ); + apaint->u.sweep_gradient.center.y += INT_TO_FIXED( item_deltas[1] ); + + apaint->u.sweep_gradient.start_angle += + F2DOT14_TO_FIXED( item_deltas[2] ); + apaint->u.sweep_gradient.end_angle += + F2DOT14_TO_FIXED( item_deltas[3] ); + } +#endif + apaint->format = FT_COLR_PAINTFORMAT_SWEEP_GRADIENT; + return 1; } if ( apaint->format == FT_COLR_PAINTFORMAT_GLYPH ) { + ENSURE_READ_BYTES( 2 ); apaint->u.glyph.paint.p = child_table_p; apaint->u.glyph.paint.insert_root_transform = 0; apaint->u.glyph.glyphID = FT_NEXT_USHORT( p ); @@ -577,7 +894,9 @@ return 1; } - else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSFORM ) + else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSFORM || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM ) { apaint->u.transform.paint.p = child_table_p; apaint->u.transform.paint.insert_root_transform = 0; @@ -591,6 +910,7 @@ * The following matrix coefficients are encoded as * OpenType 16.16 fixed-point values. */ + ENSURE_READ_BYTES( 24 ); apaint->u.transform.affine.xx = FT_NEXT_LONG( p ); apaint->u.transform.affine.yx = FT_NEXT_LONG( p ); apaint->u.transform.affine.xy = FT_NEXT_LONG( p ); @@ -598,51 +918,101 @@ apaint->u.transform.affine.dx = FT_NEXT_LONG( p ); apaint->u.transform.affine.dy = FT_NEXT_LONG( p ); +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG( p ); + + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 6, + item_deltas ) ) + return 0; + + apaint->u.transform.affine.xx += (FT_Fixed)item_deltas[0]; + apaint->u.transform.affine.yx += (FT_Fixed)item_deltas[1]; + apaint->u.transform.affine.xy += (FT_Fixed)item_deltas[2]; + apaint->u.transform.affine.yy += (FT_Fixed)item_deltas[3]; + apaint->u.transform.affine.dx += (FT_Fixed)item_deltas[4]; + apaint->u.transform.affine.dy += (FT_Fixed)item_deltas[5]; + } +#endif + + apaint->format = FT_COLR_PAINTFORMAT_TRANSFORM; + return 1; } - else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSLATE ) + else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSLATE || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE ) { apaint->u.translate.paint.p = child_table_p; apaint->u.translate.paint.insert_root_transform = 0; + ENSURE_READ_BYTES( 4 ); apaint->u.translate.dx = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.translate.dy = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG( p ); + + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 2, + item_deltas ) ) + return 0; + + apaint->u.translate.dx += INT_TO_FIXED( item_deltas[0] ); + apaint->u.translate.dy += INT_TO_FIXED( item_deltas[1] ); + } +#endif + + apaint->format = FT_COLR_PAINTFORMAT_TRANSLATE; + return 1; } - else if ( apaint->format == - FT_COLR_PAINTFORMAT_SCALE || - (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER || - (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM || - (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER ) + else if ( apaint->format >= FT_COLR_PAINTFORMAT_SCALE && + (FT_PaintFormat_Internal)apaint->format <= + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) { apaint->u.scale.paint.p = child_table_p; apaint->u.scale.paint.insert_root_transform = 0; /* All scale paints get at least one scale value. */ + ENSURE_READ_BYTES( 2 ); apaint->u.scale.scale_x = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) ); /* Non-uniform ones read an extra y value. */ - if ( apaint->format == - FT_COLR_PAINTFORMAT_SCALE || + if ( apaint->format == FT_COLR_PAINTFORMAT_SCALE || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER || (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER ) + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER ) + { + ENSURE_READ_BYTES( 2 ); apaint->u.scale.scale_y = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) ); + } else apaint->u.scale.scale_y = apaint->u.scale.scale_x; /* Scale paints that have a center read center coordinates, */ /* otherwise the center is (0,0). */ if ( (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER || + FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER || (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER ) + FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) { + ENSURE_READ_BYTES( 4 ); apaint->u.scale.center_x = INT_TO_FIXED( FT_NEXT_SHORT ( p ) ); apaint->u.scale.center_y = INT_TO_FIXED( FT_NEXT_SHORT ( p ) ); } @@ -652,6 +1022,71 @@ apaint->u.scale.center_y = 0; } + /* Base values set, now handle variations. */ + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG( p ); + + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE ) + { + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 2, + item_deltas ) ) + return 0; + + apaint->u.scale.scale_x += F2DOT14_TO_FIXED( item_deltas[0] ); + apaint->u.scale.scale_y += F2DOT14_TO_FIXED( item_deltas[1] ); + } + + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER ) + { + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4, + item_deltas ) ) + return 0; + + apaint->u.scale.scale_x += F2DOT14_TO_FIXED( item_deltas[0] ); + apaint->u.scale.scale_y += F2DOT14_TO_FIXED( item_deltas[1] ); + apaint->u.scale.center_x += INT_TO_FIXED( item_deltas[2] ); + apaint->u.scale.center_y += INT_TO_FIXED( item_deltas[3] ); + } + + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM ) + { + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 1, + item_deltas ) ) + return 0; + + apaint->u.scale.scale_x += F2DOT14_TO_FIXED( item_deltas[0] ); + apaint->u.scale.scale_y += F2DOT14_TO_FIXED( item_deltas[0] ); + } + + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) + { + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 3, + item_deltas ) ) + return 0; + + apaint->u.scale.scale_x += F2DOT14_TO_FIXED( item_deltas[0] ); + apaint->u.scale.scale_y += F2DOT14_TO_FIXED( item_deltas[0] ); + apaint->u.scale.center_x += INT_TO_FIXED( item_deltas[1] ); + apaint->u.scale.center_y += INT_TO_FIXED( item_deltas[2] ); + } + } +#endif + /* FT 'COLR' v1 API output format always returns fully defined */ /* structs; we thus set the format to the public API value. */ apaint->format = FT_COLR_PAINTFORMAT_SCALE; @@ -659,18 +1094,26 @@ return 1; } - else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE || + else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER || (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER ) + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) { apaint->u.rotate.paint.p = child_table_p; apaint->u.rotate.paint.insert_root_transform = 0; + ENSURE_READ_BYTES( 2 ); apaint->u.rotate.angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) ); if ( (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER ) + FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) { + ENSURE_READ_BYTES( 4 ); apaint->u.rotate.center_x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.rotate.center_y = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); } @@ -680,24 +1123,69 @@ apaint->u.rotate.center_y = 0; } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) + { + FT_UInt num_deltas = 0; + + + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG( p ); + + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) + num_deltas = 3; + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE ) + num_deltas = 1; + + if ( num_deltas > 0 ) + { + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, + num_deltas, item_deltas ) ) + return 0; + + apaint->u.rotate.angle += F2DOT14_TO_FIXED( item_deltas[0] ); + + if ( num_deltas == 3 ) + { + apaint->u.rotate.center_x += INT_TO_FIXED( item_deltas[1] ); + apaint->u.rotate.center_y += INT_TO_FIXED( item_deltas[2] ); + } + } + } +#endif + apaint->format = FT_COLR_PAINTFORMAT_ROTATE; + return 1; } - else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW || + else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER || (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER ) + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) { apaint->u.skew.paint.p = child_table_p; apaint->u.skew.paint.insert_root_transform = 0; + ENSURE_READ_BYTES( 4 ); apaint->u.skew.x_skew_angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.skew.y_skew_angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) ); if ( (FT_PaintFormat_Internal)apaint->format == - FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER ) + FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) { + ENSURE_READ_BYTES( 4 ); apaint->u.skew.center_x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.skew.center_y = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); } @@ -707,6 +1195,42 @@ apaint->u.skew.center_y = 0; } + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW || + (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) + { + ENSURE_READ_BYTES( 4 ); + var_index_base = FT_NEXT_ULONG( p ); + + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW ) + { + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 2, + item_deltas ) ) + return 0; + + apaint->u.skew.x_skew_angle += F2DOT14_TO_FIXED( item_deltas[0] ); + apaint->u.skew.y_skew_angle += F2DOT14_TO_FIXED( item_deltas[1] ); + } + + if ( (FT_PaintFormat_Internal)apaint->format == + FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) + { + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4, + item_deltas ) ) + return 0; + + apaint->u.skew.x_skew_angle += F2DOT14_TO_FIXED( item_deltas[0] ); + apaint->u.skew.y_skew_angle += F2DOT14_TO_FIXED( item_deltas[1] ); + apaint->u.skew.center_x += INT_TO_FIXED( item_deltas[2] ); + apaint->u.skew.center_y += INT_TO_FIXED( item_deltas[3] ); + } + } +#endif + apaint->format = FT_COLR_PAINTFORMAT_SKEW; return 1; @@ -720,6 +1244,7 @@ apaint->u.composite.source_paint.p = child_table_p; apaint->u.composite.source_paint.insert_root_transform = 0; + ENSURE_READ_BYTES( 1 ); composite_mode = FT_NEXT_BYTE( p ); if ( composite_mode >= FT_COLR_COMPOSITE_MAX ) return 0; @@ -871,7 +1396,7 @@ clip_list_format = FT_NEXT_BYTE ( p ); /* Format byte used here to be able to upgrade ClipList for >16bit */ - /* glyph ids; for now we can expect it to be 0. */ + /* glyph ids; for now we can expect it to be 1. */ if ( !( clip_list_format == 1 ) ) return 0; @@ -899,7 +1424,7 @@ format = FT_NEXT_BYTE( p1 ); - if ( format > 1 ) + if ( format > 2 ) return 0; /* Check whether we can extract four `FWORD`. */ @@ -913,11 +1438,40 @@ font_clip_box.xMin = FT_MulFix( FT_NEXT_SHORT( p1 ), face->root.size->metrics.x_scale ); font_clip_box.yMin = FT_MulFix( FT_NEXT_SHORT( p1 ), - face->root.size->metrics.x_scale ); + face->root.size->metrics.y_scale ); font_clip_box.xMax = FT_MulFix( FT_NEXT_SHORT( p1 ), face->root.size->metrics.x_scale ); font_clip_box.yMax = FT_MulFix( FT_NEXT_SHORT( p1 ), - face->root.size->metrics.x_scale ); + face->root.size->metrics.y_scale ); + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( format == 2 ) + { + FT_ULong var_index_base = 0; + /* varIndexBase offset for clipbox is 3 at most. */ + FT_ItemVarDelta item_deltas[4] = { 0, 0, 0, 0 }; + + + /* Check whether we can extract a 32-bit varIndexBase now. */ + if ( p1 > limit - 4 ) + return 0; + + var_index_base = FT_NEXT_ULONG( p1 ); + + if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4, + item_deltas ) ) + return 0; + + font_clip_box.xMin += + FT_MulFix( item_deltas[0], face->root.size->metrics.x_scale ); + font_clip_box.yMin += + FT_MulFix( item_deltas[1], face->root.size->metrics.y_scale ); + font_clip_box.xMax += + FT_MulFix( item_deltas[2], face->root.size->metrics.x_scale ); + font_clip_box.yMax += + FT_MulFix( item_deltas[3], face->root.size->metrics.y_scale ); + } +#endif /* Make 4 corner points (xMin, yMin), (xMax, yMax) and transform */ /* them. If we we would only transform two corner points and */ @@ -986,13 +1540,6 @@ p = iterator->p; /* - * First ensure that p is within COLRv1. - */ - if ( p < colr->layers_v1 || - p >= ( (FT_Byte*)colr->table + colr->table_size ) ) - return 0; - - /* * Do a cursor sanity check of the iterator. Counting backwards from * where it stands, we need to end up at a position after the beginning * of the `LayerV1List` table and not after the end of the @@ -1008,6 +1555,14 @@ colr->num_layers_v1 * LAYER_V1_LIST_PAINT_OFFSET_SIZE ) ) return 0; + /* + * Before reading, ensure that `p` is within 'COLR' v1 and we can read a + * 4-byte ULONG. + */ + if ( p < colr->layers_v1 || + p > (FT_Byte*)colr->table + colr->table_size - 4 ) + return 0; + paint_offset = FT_NEXT_ULONG( p ); opaque_paint->insert_root_transform = @@ -1037,29 +1592,67 @@ Colr* colr = (Colr*)face->colr; FT_Byte* p; + FT_ULong var_index_base; + FT_Byte* last_entry_p = NULL; + FT_UInt entry_size = COLOR_STOP_SIZE; - if ( !colr || !colr->table ) + if ( !colr || !colr->table || !iterator ) return 0; if ( iterator->current_color_stop >= iterator->num_color_stops ) return 0; - if ( iterator->p + - ( ( iterator->num_color_stops - iterator->current_color_stop ) * - COLOR_STOP_SIZE ) > - ( (FT_Byte *)colr->table + colr->table_size ) ) + if ( iterator->read_variable ) + entry_size += VAR_IDX_BASE_SIZE; + + /* Calculate the start pointer for the last to-be-read (Var)ColorStop */ + /* and check whether we can read a full (Var)ColorStop at that */ + /* position by comparing it to the position that is the size of one */ + /* (Var)ColorStop before the end of the 'COLR' table. */ + last_entry_p = + iterator->p + ( iterator->num_color_stops - 1 - + iterator->current_color_stop ) * entry_size; + if ( iterator->p < colr->paints_start_v1 || + last_entry_p > (FT_Byte*)colr->table + + colr->table_size - entry_size ) return 0; /* Iterator points at first `ColorStop` of `ColorLine`. */ p = iterator->p; - color_stop->stop_offset = FT_NEXT_SHORT( p ); + color_stop->stop_offset = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) ); color_stop->color.palette_index = FT_NEXT_USHORT( p ); color_stop->color.alpha = FT_NEXT_SHORT( p ); + if ( iterator->read_variable ) + { + /* Pointer p needs to be advanced independently of whether we intend */ + /* to take variable deltas into account or not. Otherwise iteration */ + /* would fail due to wrong offsets. */ + var_index_base = FT_NEXT_ULONG( p ); + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + { + FT_Int item_deltas[2]; + + + if ( !get_deltas_for_var_index_base( face, colr, + var_index_base, + 2, + item_deltas ) ) + return 0; + + color_stop->stop_offset += F2DOT14_TO_FIXED( item_deltas[0] ); + color_stop->color.alpha += item_deltas[1]; + } +#else + FT_UNUSED( var_index_base ); +#endif + } + iterator->p = p; iterator->current_color_stop++; @@ -1139,7 +1732,7 @@ return 1; } - return read_paint( colr, opaque_paint.p, paint ); + return read_paint( face, colr, opaque_paint.p, paint ); } diff --git a/lib/freetype/src/sfnt/ttcolr.h b/lib/freetype/src/sfnt/ttcolr.h index 4200cb297..20c85f035 100644 --- a/lib/freetype/src/sfnt/ttcolr.h +++ b/lib/freetype/src/sfnt/ttcolr.h @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (specification). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/lib/freetype/src/sfnt/ttcpal.c b/lib/freetype/src/sfnt/ttcpal.c index 9ae535cbd..4279bc0bd 100644 --- a/lib/freetype/src/sfnt/ttcpal.c +++ b/lib/freetype/src/sfnt/ttcpal.c @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (body). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/lib/freetype/src/sfnt/ttcpal.h b/lib/freetype/src/sfnt/ttcpal.h index 4717d224f..8e9913f0c 100644 --- a/lib/freetype/src/sfnt/ttcpal.h +++ b/lib/freetype/src/sfnt/ttcpal.h @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (specification). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/lib/freetype/src/sfnt/ttkern.c b/lib/freetype/src/sfnt/ttkern.c index ca1c50940..a47d08bd6 100644 --- a/lib/freetype/src/sfnt/ttkern.c +++ b/lib/freetype/src/sfnt/ttkern.c @@ -5,7 +5,7 @@ * Load the basic TrueType kerning table. This doesn't handle * kerning data within the GPOS table at the moment. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttkern.h b/lib/freetype/src/sfnt/ttkern.h index f06355831..960c7da49 100644 --- a/lib/freetype/src/sfnt/ttkern.h +++ b/lib/freetype/src/sfnt/ttkern.h @@ -5,7 +5,7 @@ * Load the basic TrueType kerning table. This doesn't handle * kerning data within the GPOS table at the moment. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttload.c b/lib/freetype/src/sfnt/ttload.c index c83bd197f..14f625c82 100644 --- a/lib/freetype/src/sfnt/ttload.c +++ b/lib/freetype/src/sfnt/ttload.c @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -206,7 +206,7 @@ if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) ) { FT_TRACE2(( "check_table_dir:" - " can read only %d table%s in font (instead of %d)\n", + " can read only %hu table%s in font (instead of %hu)\n", nn, nn == 1 ? "" : "s", sfnt->num_tables )); sfnt->num_tables = nn; break; @@ -216,7 +216,7 @@ if ( table.Offset > stream->size ) { - FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn )); + FT_TRACE2(( "check_table_dir: table entry %hu invalid\n", nn )); continue; } else if ( table.Length > stream->size - table.Offset ) @@ -231,7 +231,7 @@ valid_entries++; else { - FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn )); + FT_TRACE2(( "check_table_dir: table entry %hu invalid\n", nn )); continue; } } @@ -380,7 +380,7 @@ /* load the table directory */ - FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables )); + FT_TRACE2(( "-- Number of tables: %10hu\n", sfnt.num_tables )); FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag )); if ( sfnt.format_tag != TTAG_OTTO ) @@ -671,8 +671,8 @@ if ( FT_STREAM_READ_FIELDS( header_fields, header ) ) goto Exit; - FT_TRACE3(( "Units per EM: %4u\n", header->Units_Per_EM )); - FT_TRACE3(( "IndexToLoc: %4d\n", header->Index_To_Loc_Format )); + FT_TRACE3(( "Units per EM: %4hu\n", header->Units_Per_EM )); + FT_TRACE3(( "IndexToLoc: %4hd\n", header->Index_To_Loc_Format )); Exit: return error; @@ -802,7 +802,7 @@ } } - FT_TRACE3(( "numGlyphs: %u\n", maxProfile->numGlyphs )); + FT_TRACE3(( "numGlyphs: %hu\n", maxProfile->numGlyphs )); Exit: return error; @@ -1265,11 +1265,11 @@ } } - FT_TRACE3(( "sTypoAscender: %4d\n", os2->sTypoAscender )); - FT_TRACE3(( "sTypoDescender: %4d\n", os2->sTypoDescender )); - FT_TRACE3(( "usWinAscent: %4u\n", os2->usWinAscent )); - FT_TRACE3(( "usWinDescent: %4u\n", os2->usWinDescent )); - FT_TRACE3(( "fsSelection: 0x%2x\n", os2->fsSelection )); + FT_TRACE3(( "sTypoAscender: %4hd\n", os2->sTypoAscender )); + FT_TRACE3(( "sTypoDescender: %4hd\n", os2->sTypoDescender )); + FT_TRACE3(( "usWinAscent: %4hu\n", os2->usWinAscent )); + FT_TRACE3(( "usWinDescent: %4hu\n", os2->usWinDescent )); + FT_TRACE3(( "fsSelection: 0x%2hx\n", os2->fsSelection )); Exit: return error; @@ -1468,7 +1468,7 @@ gasp_ranges[j].maxPPEM = FT_GET_USHORT(); gasp_ranges[j].gaspFlag = FT_GET_USHORT(); - FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n", + FT_TRACE3(( "gaspRange %hu: rangeMaxPPEM %5hu, rangeGaspBehavior 0x%hx\n", j, gasp_ranges[j].maxPPEM, gasp_ranges[j].gaspFlag )); diff --git a/lib/freetype/src/sfnt/ttload.h b/lib/freetype/src/sfnt/ttload.h index 5368971c3..1499dd573 100644 --- a/lib/freetype/src/sfnt/ttload.h +++ b/lib/freetype/src/sfnt/ttload.h @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttmtx.c b/lib/freetype/src/sfnt/ttmtx.c index 88377327c..5e53e6dd4 100644 --- a/lib/freetype/src/sfnt/ttmtx.c +++ b/lib/freetype/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (body). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 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 ) + if ( var && face->blend ) { FT_Face f = FT_FACE( face ); FT_Int a = (FT_Int)*aadvance; diff --git a/lib/freetype/src/sfnt/ttmtx.h b/lib/freetype/src/sfnt/ttmtx.h index 1e45b949a..56d2b6276 100644 --- a/lib/freetype/src/sfnt/ttmtx.h +++ b/lib/freetype/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttpost.c b/lib/freetype/src/sfnt/ttpost.c index 1a885a15c..0e17c6f34 100644 --- a/lib/freetype/src/sfnt/ttpost.c +++ b/lib/freetype/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -58,7 +58,7 @@ #define MAC_NAME( x ) (FT_String*)psnames->macintosh_name( (FT_UInt)(x) ) -#else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ +#else /* !FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ /* Otherwise, we ignore the `psnames' module, and provide our own */ @@ -152,7 +152,7 @@ }; -#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ +#endif /* !FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ static FT_Error diff --git a/lib/freetype/src/sfnt/ttpost.h b/lib/freetype/src/sfnt/ttpost.h index bf9342a9f..528f1c5f2 100644 --- a/lib/freetype/src/sfnt/ttpost.h +++ b/lib/freetype/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttsbit.c b/lib/freetype/src/sfnt/ttsbit.c index bf73d04e5..3c0695513 100644 --- a/lib/freetype/src/sfnt/ttsbit.c +++ b/lib/freetype/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (body). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Copyright 2013 by Google, Inc. @@ -385,11 +385,9 @@ /* set the scale values (in 16.16 units) so advances */ /* from the hmtx and vmtx table are scaled correctly */ - metrics->x_scale = FT_MulDiv( metrics->x_ppem, - 64 * 0x10000, + metrics->x_scale = FT_DivFix( metrics->x_ppem * 64, face->header.Units_Per_EM ); - metrics->y_scale = FT_MulDiv( metrics->y_ppem, - 64 * 0x10000, + metrics->y_scale = FT_DivFix( metrics->y_ppem * 64, face->header.Units_Per_EM ); return FT_Err_Ok; @@ -399,9 +397,9 @@ { FT_Stream stream = face->root.stream; FT_UInt offset; - FT_UShort upem, ppem, resolution; + FT_UShort ppem, resolution; TT_HoriHeader *hori; - FT_Pos ppem_; /* to reduce casts */ + FT_Fixed scale; FT_Error error; FT_Byte* p; @@ -424,32 +422,23 @@ FT_FRAME_EXIT(); - upem = face->header.Units_Per_EM; - hori = &face->horizontal; - metrics->x_ppem = ppem; metrics->y_ppem = ppem; - ppem_ = (FT_Pos)ppem; + scale = FT_DivFix( ppem * 64, face->header.Units_Per_EM ); + hori = &face->horizontal; - metrics->ascender = - FT_MulDiv( hori->Ascender, ppem_ * 64, upem ); - metrics->descender = - FT_MulDiv( hori->Descender, ppem_ * 64, upem ); - metrics->height = - FT_MulDiv( hori->Ascender - hori->Descender + hori->Line_Gap, - ppem_ * 64, upem ); - metrics->max_advance = - FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem ); + metrics->ascender = FT_MulFix( hori->Ascender, scale ); + metrics->descender = FT_MulFix( hori->Descender, scale ); + metrics->height = + FT_MulFix( hori->Ascender - hori->Descender + hori->Line_Gap, + scale ); + metrics->max_advance = FT_MulFix( hori->advance_Width_Max, scale ); /* set the scale values (in 16.16 units) so advances */ /* from the hmtx and vmtx table are scaled correctly */ - metrics->x_scale = FT_MulDiv( metrics->x_ppem, - 64 * 0x10000, - face->header.Units_Per_EM ); - metrics->y_scale = FT_MulDiv( metrics->y_ppem, - 64 * 0x10000, - face->header.Units_Per_EM ); + metrics->x_scale = scale; + metrics->y_scale = scale; return error; } @@ -1204,7 +1193,7 @@ goto Fail; p += 1; /* skip padding */ - /* fall-through */ + FALL_THROUGH; case 9: loader = tt_sbit_decoder_load_compound; @@ -1604,7 +1593,7 @@ return error; } - FT_LOCAL( FT_Error ) + FT_LOCAL_DEF( FT_Error ) tt_face_load_sbit_image( TT_Face face, FT_ULong strike_index, FT_UInt glyph_index, diff --git a/lib/freetype/src/sfnt/ttsbit.h b/lib/freetype/src/sfnt/ttsbit.h index c967bffba..07e2db461 100644 --- a/lib/freetype/src/sfnt/ttsbit.h +++ b/lib/freetype/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/sfnt/ttsvg.c b/lib/freetype/src/sfnt/ttsvg.c index 69277da57..c1bbb66b8 100644 --- a/lib/freetype/src/sfnt/ttsvg.c +++ b/lib/freetype/src/sfnt/ttsvg.c @@ -4,7 +4,7 @@ * * OpenType SVG Color (specification). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 by * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. * * This file is part of the FreeType project, and may only be used, @@ -114,7 +114,7 @@ FT_TRACE3(( "version: %d\n", svg->version )); FT_TRACE3(( "number of entries: %d\n", svg->num_entries )); - if ( offsetToSVGDocumentList + + if ( offsetToSVGDocumentList + 2U + svg->num_entries * SVG_DOCUMENT_RECORD_SIZE > table_size ) goto InvalidTable; @@ -196,7 +196,7 @@ static FT_Error - find_doc( FT_Byte* stream, + find_doc( FT_Byte* document_records, FT_UShort num_entries, FT_UInt glyph_index, FT_ULong *doc_offset, @@ -207,7 +207,7 @@ FT_Error error; Svg_doc start_doc; - Svg_doc mid_doc; + Svg_doc mid_doc = { 0, 0, 0, 0 }; /* pacify compiler */ Svg_doc end_doc; FT_Bool found = FALSE; @@ -225,8 +225,8 @@ return error; } - start_doc = extract_svg_doc( stream + start_index * 12 ); - end_doc = extract_svg_doc( stream + end_index * 12 ); + start_doc = extract_svg_doc( document_records + start_index * 12 ); + end_doc = extract_svg_doc( document_records + end_index * 12 ); if ( ( compare_svg_doc( start_doc, glyph_index ) == -1 ) || ( compare_svg_doc( end_doc, glyph_index ) == 1 ) ) @@ -238,18 +238,18 @@ while ( start_index <= end_index ) { i = ( start_index + end_index ) / 2; - mid_doc = extract_svg_doc( stream + i * 12 ); + mid_doc = extract_svg_doc( document_records + i * 12 ); comp_res = compare_svg_doc( mid_doc, glyph_index ); if ( comp_res == 1 ) { start_index = i + 1; - start_doc = extract_svg_doc( stream + start_index * 4 ); + start_doc = extract_svg_doc( document_records + start_index * 4 ); } else if ( comp_res == -1 ) { end_index = i - 1; - end_doc = extract_svg_doc( stream + end_index * 4 ); + end_doc = extract_svg_doc( document_records + end_index * 4 ); } else { @@ -283,38 +283,48 @@ tt_face_load_svg_doc( FT_GlyphSlot glyph, FT_UInt glyph_index ) { - FT_Byte* doc_list; /* pointer to the SVG doc list */ - FT_UShort num_entries; /* total number of entries in doc list */ - FT_ULong doc_offset; - FT_ULong doc_length; - - FT_UShort start_glyph_id; - FT_UShort end_glyph_id; - FT_Error error = FT_Err_Ok; TT_Face face = (TT_Face)glyph->face; FT_Memory memory = face->root.memory; Svg* svg = (Svg*)face->svg; + FT_Byte* doc_list; + FT_ULong doc_limit; + + FT_Byte* doc; + FT_ULong doc_offset; + FT_ULong doc_length; + FT_UShort doc_start_glyph_id; + FT_UShort doc_end_glyph_id; + FT_SVG_Document svg_document = (FT_SVG_Document)glyph->other; FT_ASSERT( !( svg == NULL ) ); - doc_list = svg->svg_doc_list; - num_entries = FT_NEXT_USHORT( doc_list ); + doc_list = svg->svg_doc_list; - error = find_doc( doc_list, num_entries, glyph_index, - &doc_offset, &doc_length, - &start_glyph_id, &end_glyph_id ); + error = find_doc( doc_list + 2, svg->num_entries, glyph_index, + &doc_offset, &doc_length, + &doc_start_glyph_id, &doc_end_glyph_id ); if ( error != FT_Err_Ok ) goto Exit; - doc_list = svg->svg_doc_list; /* reset, so we can use it again */ - doc_list = (FT_Byte*)( doc_list + doc_offset ); + doc_limit = svg->table_size - + (FT_ULong)( doc_list - (FT_Byte*)svg->table ); + if ( doc_offset > doc_limit || + doc_length > doc_limit - doc_offset ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + doc = doc_list + doc_offset; - if ( ( doc_list[0] == 0x1F ) && ( doc_list[1] == 0x8B ) - && ( doc_list[2] == 0x08 ) ) + if ( doc_length > 6 && + doc[0] == 0x1F && + doc[1] == 0x8B && + doc[2] == 0x08 ) { #ifdef FT_CONFIG_OPTION_USE_ZLIB @@ -331,10 +341,10 @@ * little-endian format. */ FT_TRACE4(( "SVG document is GZIP compressed\n" )); - uncomp_size = (FT_ULong)doc_list[doc_length - 1] << 24 | - (FT_ULong)doc_list[doc_length - 2] << 16 | - (FT_ULong)doc_list[doc_length - 3] << 8 | - (FT_ULong)doc_list[doc_length - 4]; + uncomp_size = (FT_ULong)doc[doc_length - 1] << 24 | + (FT_ULong)doc[doc_length - 2] << 16 | + (FT_ULong)doc[doc_length - 3] << 8 | + (FT_ULong)doc[doc_length - 4]; if ( FT_QALLOC( uncomp_buffer, uncomp_size ) ) goto Exit; @@ -342,7 +352,7 @@ error = FT_Gzip_Uncompress( memory, uncomp_buffer, &uncomp_size, - doc_list, + doc, doc_length ); if ( error ) { @@ -353,7 +363,7 @@ glyph->internal->flags |= FT_GLYPH_OWN_GZIP_SVG; - doc_list = uncomp_buffer; + doc = uncomp_buffer; doc_length = uncomp_size; #else /* !FT_CONFIG_OPTION_USE_ZLIB */ @@ -364,14 +374,14 @@ #endif /* !FT_CONFIG_OPTION_USE_ZLIB */ } - svg_document->svg_document = doc_list; + svg_document->svg_document = doc; svg_document->svg_document_length = doc_length; svg_document->metrics = glyph->face->size->metrics; svg_document->units_per_EM = glyph->face->units_per_EM; - svg_document->start_glyph_id = start_glyph_id; - svg_document->end_glyph_id = end_glyph_id; + svg_document->start_glyph_id = doc_start_glyph_id; + svg_document->end_glyph_id = doc_end_glyph_id; svg_document->transform.xx = 0x10000; svg_document->transform.xy = 0; @@ -381,10 +391,10 @@ svg_document->delta.x = 0; svg_document->delta.y = 0; - FT_TRACE5(( "start_glyph_id: %d\n", start_glyph_id )); - FT_TRACE5(( "end_glyph_id: %d\n", end_glyph_id )); + FT_TRACE5(( "start_glyph_id: %d\n", doc_start_glyph_id )); + FT_TRACE5(( "end_glyph_id: %d\n", doc_end_glyph_id )); FT_TRACE5(( "svg_document:\n" )); - FT_TRACE5(( " %.*s\n", (FT_UInt)doc_length, doc_list )); + FT_TRACE5(( " %.*s\n", (FT_UInt)doc_length, doc )); glyph->other = svg_document; diff --git a/lib/freetype/src/sfnt/ttsvg.h b/lib/freetype/src/sfnt/ttsvg.h index 7c234fd52..3f32321de 100644 --- a/lib/freetype/src/sfnt/ttsvg.h +++ b/lib/freetype/src/sfnt/ttsvg.h @@ -4,7 +4,7 @@ * * OpenType SVG Color (specification). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 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/lib/freetype/src/sfnt/woff2tags.c b/lib/freetype/src/sfnt/woff2tags.c index 7d79fef39..7a0a351f0 100644 --- a/lib/freetype/src/sfnt/woff2tags.c +++ b/lib/freetype/src/sfnt/woff2tags.c @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (base). * - * Copyright (C) 2019-2022 by + * Copyright (C) 2019-2023 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/lib/freetype/src/sfnt/woff2tags.h b/lib/freetype/src/sfnt/woff2tags.h index 05df85aba..1201848e5 100644 --- a/lib/freetype/src/sfnt/woff2tags.h +++ b/lib/freetype/src/sfnt/woff2tags.h @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (specification). * - * Copyright (C) 2019-2022 by + * Copyright (C) 2019-2023 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/lib/freetype/src/smooth/ftgrays.c b/lib/freetype/src/smooth/ftgrays.c index 622035aa7..d9f20eef1 100644 --- a/lib/freetype/src/smooth/ftgrays.c +++ b/lib/freetype/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ * * A new `perfect' anti-aliasing renderer (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -418,21 +418,21 @@ typedef ptrdiff_t FT_PtrDist; /* It is faster to write small spans byte-by-byte than calling */ /* `memset'. This is mainly due to the cost of the function call. */ -#define FT_GRAY_SET( d, s, count ) \ - FT_BEGIN_STMNT \ - unsigned char* q = d; \ - switch ( count ) \ - { \ - case 7: *q++ = (unsigned char)s; /* fall through */ \ - case 6: *q++ = (unsigned char)s; /* fall through */ \ - case 5: *q++ = (unsigned char)s; /* fall through */ \ - case 4: *q++ = (unsigned char)s; /* fall through */ \ - case 3: *q++ = (unsigned char)s; /* fall through */ \ - case 2: *q++ = (unsigned char)s; /* fall through */ \ - case 1: *q = (unsigned char)s; /* fall through */ \ - case 0: break; \ - default: FT_MEM_SET( d, s, count ); \ - } \ +#define FT_GRAY_SET( d, s, count ) \ + FT_BEGIN_STMNT \ + unsigned char* q = d; \ + switch ( count ) \ + { \ + case 7: *q++ = (unsigned char)s; FALL_THROUGH; \ + case 6: *q++ = (unsigned char)s; FALL_THROUGH; \ + case 5: *q++ = (unsigned char)s; FALL_THROUGH; \ + case 4: *q++ = (unsigned char)s; FALL_THROUGH; \ + case 3: *q++ = (unsigned char)s; FALL_THROUGH; \ + case 2: *q++ = (unsigned char)s; FALL_THROUGH; \ + case 1: *q = (unsigned char)s; FALL_THROUGH; \ + case 0: break; \ + default: FT_MEM_SET( d, s, count ); \ + } \ FT_END_STMNT @@ -1909,10 +1909,10 @@ typedef ptrdiff_t FT_PtrDist; static int - gray_convert_glyph_inner( RAS_ARG, + gray_convert_glyph_inner( RAS_ARG_ int continued ) { - int error; + volatile int error; if ( ft_setjmp( ras.jump_buffer ) == 0 ) @@ -2004,7 +2004,7 @@ typedef ptrdiff_t FT_PtrDist; ras.max_ey = band[0]; ras.count_ey = width; - error = gray_convert_glyph_inner( RAS_VAR, continued ); + error = gray_convert_glyph_inner( RAS_VAR_ continued ); continued = 1; if ( !error ) diff --git a/lib/freetype/src/smooth/ftgrays.h b/lib/freetype/src/smooth/ftgrays.h index 13bf2baaa..a5001bf40 100644 --- a/lib/freetype/src/smooth/ftgrays.h +++ b/lib/freetype/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ * * FreeType smooth renderer declaration * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/smooth/ftsmerrs.h b/lib/freetype/src/smooth/ftsmerrs.h index 7bc607798..f4ac93dc4 100644 --- a/lib/freetype/src/smooth/ftsmerrs.h +++ b/lib/freetype/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ * * smooth renderer error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/smooth/ftsmooth.c b/lib/freetype/src/smooth/ftsmooth.c index df227c375..cdbc78c3e 100644 --- a/lib/freetype/src/smooth/ftsmooth.c +++ b/lib/freetype/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (body). * - * Copyright (C) 2000-2022 by + * Copyright (C) 2000-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/smooth/ftsmooth.h b/lib/freetype/src/smooth/ftsmooth.h index 87f09faea..f8bdc9938 100644 --- a/lib/freetype/src/smooth/ftsmooth.h +++ b/lib/freetype/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/smooth/module.mk b/lib/freetype/src/smooth/module.mk index 762355132..82ab2fa59 100644 --- a/lib/freetype/src/smooth/module.mk +++ b/lib/freetype/src/smooth/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/smooth/rules.mk b/lib/freetype/src/smooth/rules.mk index d5109313f..5d89c7540 100644 --- a/lib/freetype/src/smooth/rules.mk +++ b/lib/freetype/src/smooth/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/smooth/smooth.c b/lib/freetype/src/smooth/smooth.c index f341e8f25..9a0b824c2 100644 --- a/lib/freetype/src/smooth/smooth.c +++ b/lib/freetype/src/smooth/smooth.c @@ -4,7 +4,7 @@ * * FreeType anti-aliasing rasterer module component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/svg/ftsvg.c b/lib/freetype/src/svg/ftsvg.c index 55c50718f..7edb1a338 100644 --- a/lib/freetype/src/svg/ftsvg.c +++ b/lib/freetype/src/svg/ftsvg.c @@ -4,7 +4,7 @@ * * The FreeType SVG renderer interface (body). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 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/lib/freetype/src/svg/ftsvg.h b/lib/freetype/src/svg/ftsvg.h index 73514b8cf..9c496caa1 100644 --- a/lib/freetype/src/svg/ftsvg.h +++ b/lib/freetype/src/svg/ftsvg.h @@ -4,7 +4,7 @@ * * The FreeType SVG renderer interface (specification). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 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/lib/freetype/src/svg/module.mk b/lib/freetype/src/svg/module.mk index 30c352574..00beca60f 100644 --- a/lib/freetype/src/svg/module.mk +++ b/lib/freetype/src/svg/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2022 by +# Copyright (C) 2022-2023 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/lib/freetype/src/svg/rules.mk b/lib/freetype/src/svg/rules.mk index 9c53128c4..4f4409755 100644 --- a/lib/freetype/src/svg/rules.mk +++ b/lib/freetype/src/svg/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2022 by +# Copyright (C) 2022-2023 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/lib/freetype/src/svg/svg.c b/lib/freetype/src/svg/svg.c index b7e62a418..373c28ed9 100644 --- a/lib/freetype/src/svg/svg.c +++ b/lib/freetype/src/svg/svg.c @@ -4,7 +4,7 @@ * * FreeType SVG renderer module component (body only). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 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/lib/freetype/src/svg/svgtypes.h b/lib/freetype/src/svg/svgtypes.h index 34fce47a3..1d608032c 100644 --- a/lib/freetype/src/svg/svgtypes.h +++ b/lib/freetype/src/svg/svgtypes.h @@ -4,7 +4,7 @@ * * The FreeType SVG renderer internal types (specification). * - * Copyright (C) 2022 by + * Copyright (C) 2022-2023 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/lib/freetype/src/tools/afblue.pl b/lib/freetype/src/tools/afblue.pl index f4f3845e7..1098e30ab 100644 --- a/lib/freetype/src/tools/afblue.pl +++ b/lib/freetype/src/tools/afblue.pl @@ -5,7 +5,7 @@ # # Process a blue zone character data file. # -# Copyright (C) 2013-2022 by +# Copyright (C) 2013-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/tools/chktrcmp.py b/lib/freetype/src/tools/chktrcmp.py index 244a24a6c..d072a8786 100644 --- a/lib/freetype/src/tools/chktrcmp.py +++ b/lib/freetype/src/tools/chktrcmp.py @@ -1,114 +1,119 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Check trace components in FreeType 2 source. # Author: suzuki toshiya, 2009, 2013, 2020 # # This code is explicitly into the public domain. - import sys import os import re -SRC_FILE_LIST = [] -USED_COMPONENT = {} +SRC_FILE_LIST = [] +USED_COMPONENT = {} KNOWN_COMPONENT = {} -SRC_FILE_DIRS = [ "src" ] -TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ] +SRC_FILE_DIRS = ["src"] +TRACE_DEF_FILES = ["include/freetype/internal/fttrace.h"] + + +def usage(): + print("Usage: %s [option]" % sys.argv[0]) + print("Search used-but-defined and defined-but-not-used trace_XXX macros") + print("") + print(" --help:") + print(" Show this help") + print("") + print(" --src-dirs=dir1:dir2:...") + print(" Specify the directories of C source files to be checked") + print(" Default is %s" % ":".join(SRC_FILE_DIRS)) + print("") + print(" --def-files=file1:file2:...") + print(" Specify the header files including FT_TRACE_DEF()") + print(" Default is %s" % ":".join(TRACE_DEF_FILES)) + print("") # -------------------------------------------------------------- # Parse command line options # - -for i in range( 1, len( sys.argv ) ): - if sys.argv[i].startswith( "--help" ): - print "Usage: %s [option]" % sys.argv[0] - print "Search used-but-defined and defined-but-not-used trace_XXX macros" - print "" - print " --help:" - print " Show this help" - print "" - print " --src-dirs=dir1:dir2:..." - print " Specify the directories of C source files to be checked" - print " Default is %s" % ":".join( SRC_FILE_DIRS ) - print "" - print " --def-files=file1:file2:..." - print " Specify the header files including FT_TRACE_DEF()" - print " Default is %s" % ":".join( TRACE_DEF_FILES ) - print "" - exit(0) - if sys.argv[i].startswith( "--src-dirs=" ): - SRC_FILE_DIRS = sys.argv[i].replace( "--src-dirs=", "", 1 ).split( ":" ) - elif sys.argv[i].startswith( "--def-files=" ): - TRACE_DEF_FILES = sys.argv[i].replace( "--def-files=", "", 1 ).split( ":" ) - +for i in range(1, len(sys.argv)): + if sys.argv[i].startswith("--help"): + usage() + exit(0) + if sys.argv[i].startswith("--src-dirs="): + SRC_FILE_DIRS = sys.argv[i].replace("--src-dirs=", "", 1).split(":") + elif sys.argv[i].startswith("--def-files="): + TRACE_DEF_FILES = sys.argv[i].replace("--def-files=", "", 1).split(":") # -------------------------------------------------------------- # Scan C source and header files using trace macros. # -c_pathname_pat = re.compile( '^.*\.[ch]$', re.IGNORECASE ) -trace_use_pat = re.compile( '^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+' ) +c_pathname_pat = re.compile('^.*\.[ch]$', re.IGNORECASE) +trace_use_pat = re.compile('^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+') for d in SRC_FILE_DIRS: - for ( p, dlst, flst ) in os.walk( d ): - for f in flst: - if c_pathname_pat.match( f ) != None: - src_pathname = os.path.join( p, f ) - - line_num = 0 - for src_line in open( src_pathname, 'r' ): - line_num = line_num + 1 - src_line = src_line.strip() - if trace_use_pat.match( src_line ) != None: - component_name = trace_use_pat.sub( '', src_line ) - if component_name in USED_COMPONENT: - USED_COMPONENT[component_name].append( "%s:%d" % ( src_pathname, line_num ) ) - else: - USED_COMPONENT[component_name] = [ "%s:%d" % ( src_pathname, line_num ) ] - + for (p, dlst, flst) in os.walk(d): + for f in flst: + if c_pathname_pat.match(f) is not None: + src_pathname = os.path.join(p, f) + + line_num = 0 + for src_line in open(src_pathname, 'r'): + line_num = line_num + 1 + src_line = src_line.strip() + if trace_use_pat.match(src_line) is not None: + component_name = trace_use_pat.sub('', src_line) + if component_name in USED_COMPONENT: + USED_COMPONENT[component_name]\ + .append("%s:%d" % (src_pathname, line_num)) + else: + USED_COMPONENT[component_name] =\ + ["%s:%d" % (src_pathname, line_num)] # -------------------------------------------------------------- # Scan header file(s) defining trace macros. # -trace_def_pat_opn = re.compile( '^.*FT_TRACE_DEF[ \t]*\([ \t]*' ) -trace_def_pat_cls = re.compile( '[ \t\)].*$' ) +trace_def_pat_opn = re.compile('^.*FT_TRACE_DEF[ \t]*\([ \t]*') +trace_def_pat_cls = re.compile('[ \t\)].*$') for f in TRACE_DEF_FILES: - line_num = 0 - for hdr_line in open( f, 'r' ): - line_num = line_num + 1 - hdr_line = hdr_line.strip() - if trace_def_pat_opn.match( hdr_line ) != None: - component_name = trace_def_pat_opn.sub( '', hdr_line ) - component_name = trace_def_pat_cls.sub( '', component_name ) - if component_name in KNOWN_COMPONENT: - print "trace component %s is defined twice, see %s and fttrace.h:%d" % \ - ( component_name, KNOWN_COMPONENT[component_name], line_num ) - else: - KNOWN_COMPONENT[component_name] = "%s:%d" % \ - ( os.path.basename( f ), line_num ) - + line_num = 0 + for hdr_line in open(f, 'r'): + line_num = line_num + 1 + hdr_line = hdr_line.strip() + if trace_def_pat_opn.match(hdr_line) is not None: + component_name = trace_def_pat_opn.sub('', hdr_line) + component_name = trace_def_pat_cls.sub('', component_name) + if component_name in KNOWN_COMPONENT: + print("trace component %s is defined twice," + " see %s and fttrace.h:%d" % + (component_name, KNOWN_COMPONENT[component_name], + line_num)) + else: + KNOWN_COMPONENT[component_name] =\ + "%s:%d" % (os.path.basename(f), line_num) # -------------------------------------------------------------- # Compare the used and defined trace macros. # -print "# Trace component used in the implementations but not defined in fttrace.h." -cmpnt = USED_COMPONENT.keys() +print("# Trace component used in the implementations but not defined in " + "fttrace.h.") +cmpnt = list(USED_COMPONENT.keys()) cmpnt.sort() for c in cmpnt: - if c not in KNOWN_COMPONENT: - print "Trace component %s (used in %s) is not defined." % ( c, ", ".join( USED_COMPONENT[c] ) ) + if c not in KNOWN_COMPONENT: + print("Trace component %s (used in %s) is not defined." % + (c, ", ".join(USED_COMPONENT[c]))) -print "# Trace component is defined but not used in the implementations." -cmpnt = KNOWN_COMPONENT.keys() +print("# Trace component is defined but not used in the implementations.") +cmpnt = list(KNOWN_COMPONENT.keys()) cmpnt.sort() for c in cmpnt: - if c not in USED_COMPONENT: - if c != "any": - print "Trace component %s (defined in %s) is not used." % ( c, KNOWN_COMPONENT[c] ) - + if c not in USED_COMPONENT: + if c != "any": + print("Trace component %s (defined in %s) is not used." % + (c, KNOWN_COMPONENT[c])) diff --git a/lib/freetype/src/tools/cordic.py b/lib/freetype/src/tools/cordic.py index 6742c90df..651142988 100644 --- a/lib/freetype/src/tools/cordic.py +++ b/lib/freetype/src/tools/cordic.py @@ -1,33 +1,32 @@ +#!/usr/bin/env python3 + # compute arctangent table for CORDIC computations in fttrigon.c -import sys, math +import math -#units = 64*65536.0 # don't change !! -units = 180 * 2**16 -scale = units/math.pi +# units = 64*65536.0 # don't change !! +units = 180 * 2 ** 16 +scale = units / math.pi shrink = 1.0 -comma = "" +angles2 = [] -print "" -print "table of arctan( 1/2^n ) for PI = " + repr(units/65536.0) + " units" +print("") +print("table of arctan( 1/2^n ) for PI = " + repr(units / 65536.0) + " units") -for n in range(1,32): +for n in range(1, 32): - x = 0.5**n # tangent value + x = 0.5 ** n # tangent value - angle = math.atan(x) # arctangent - angle2 = round(angle*scale) # arctangent in FT_Angle units + angle = math.atan(x) # arctangent + angle2 = round(angle * scale) # arctangent in FT_Angle units if angle2 <= 0: break - sys.stdout.write( comma + repr( int(angle2) ) ) - comma = ", " - - shrink /= math.sqrt( 1 + x*x ) - -print -print "shrink factor = " + repr( shrink ) -print "shrink factor 2 = " + repr( int( shrink * (2**32) ) ) -print "expansion factor = " + repr( 1/shrink ) -print "" + angles2.append(repr(int(angle2))) + shrink /= math.sqrt(1 + x * x) +print(", ".join(angles2)) +print("shrink factor = " + repr(shrink)) +print("shrink factor 2 = " + repr(int(shrink * (2 ** 32)))) +print("expansion factor = " + repr(1 / shrink)) +print("") diff --git a/lib/freetype/src/tools/glnames.py b/lib/freetype/src/tools/glnames.py index ad7786d29..41509dbc2 100644 --- a/lib/freetype/src/tools/glnames.py +++ b/lib/freetype/src/tools/glnames.py @@ -1,12 +1,9 @@ -#!/usr/bin/env python -# +#!/usr/bin/env python3 # # FreeType 2 glyph name builder # - - -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -16,8 +13,7 @@ # fully. -"""\ - +""" usage: %s <output-file> This python script generates the glyph names tables defined in the @@ -26,9 +22,9 @@ usage: %s <output-file> Its single argument is the name of the header file to be created. """ - -import sys, string, struct, re, os.path - +import os.path +import struct +import sys # This table lists the glyphs according to the Macintosh specification. # It is used by the TrueType Postscript names table. @@ -39,379 +35,371 @@ import sys, string, struct, re, os.path # # for the official list. # -mac_standard_names = \ -[ - # 0 - ".notdef", ".null", "nonmarkingreturn", "space", "exclam", - "quotedbl", "numbersign", "dollar", "percent", "ampersand", - - # 10 - "quotesingle", "parenleft", "parenright", "asterisk", "plus", - "comma", "hyphen", "period", "slash", "zero", - - # 20 - "one", "two", "three", "four", "five", - "six", "seven", "eight", "nine", "colon", - - # 30 - "semicolon", "less", "equal", "greater", "question", - "at", "A", "B", "C", "D", - - # 40 - "E", "F", "G", "H", "I", - "J", "K", "L", "M", "N", - - # 50 - "O", "P", "Q", "R", "S", - "T", "U", "V", "W", "X", - - # 60 - "Y", "Z", "bracketleft", "backslash", "bracketright", - "asciicircum", "underscore", "grave", "a", "b", - - # 70 - "c", "d", "e", "f", "g", - "h", "i", "j", "k", "l", - - # 80 - "m", "n", "o", "p", "q", - "r", "s", "t", "u", "v", - - # 90 - "w", "x", "y", "z", "braceleft", - "bar", "braceright", "asciitilde", "Adieresis", "Aring", - - # 100 - "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", - "aacute", "agrave", "acircumflex", "adieresis", "atilde", - - # 110 - "aring", "ccedilla", "eacute", "egrave", "ecircumflex", - "edieresis", "iacute", "igrave", "icircumflex", "idieresis", - - # 120 - "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", - "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", - - # 130 - "dagger", "degree", "cent", "sterling", "section", - "bullet", "paragraph", "germandbls", "registered", "copyright", - - # 140 - "trademark", "acute", "dieresis", "notequal", "AE", - "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", - - # 150 - "yen", "mu", "partialdiff", "summation", "product", - "pi", "integral", "ordfeminine", "ordmasculine", "Omega", - - # 160 - "ae", "oslash", "questiondown", "exclamdown", "logicalnot", - "radical", "florin", "approxequal", "Delta", "guillemotleft", - - # 170 - "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", - "Otilde", "OE", "oe", "endash", "emdash", - - # 180 - "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", - "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", - - # 190 - "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", - "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", +mac_standard_names = [ + # 0 + ".notdef", ".null", "nonmarkingreturn", "space", "exclam", + "quotedbl", "numbersign", "dollar", "percent", "ampersand", + + # 10 + "quotesingle", "parenleft", "parenright", "asterisk", "plus", + "comma", "hyphen", "period", "slash", "zero", + + # 20 + "one", "two", "three", "four", "five", + "six", "seven", "eight", "nine", "colon", + + # 30 + "semicolon", "less", "equal", "greater", "question", + "at", "A", "B", "C", "D", + + # 40 + "E", "F", "G", "H", "I", + "J", "K", "L", "M", "N", + + # 50 + "O", "P", "Q", "R", "S", + "T", "U", "V", "W", "X", + + # 60 + "Y", "Z", "bracketleft", "backslash", "bracketright", + "asciicircum", "underscore", "grave", "a", "b", + + # 70 + "c", "d", "e", "f", "g", + "h", "i", "j", "k", "l", + + # 80 + "m", "n", "o", "p", "q", + "r", "s", "t", "u", "v", + + # 90 + "w", "x", "y", "z", "braceleft", + "bar", "braceright", "asciitilde", "Adieresis", "Aring", + + # 100 + "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", + "aacute", "agrave", "acircumflex", "adieresis", "atilde", + + # 110 + "aring", "ccedilla", "eacute", "egrave", "ecircumflex", + "edieresis", "iacute", "igrave", "icircumflex", "idieresis", + + # 120 + "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", + "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", + + # 130 + "dagger", "degree", "cent", "sterling", "section", + "bullet", "paragraph", "germandbls", "registered", "copyright", + + # 140 + "trademark", "acute", "dieresis", "notequal", "AE", + "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", + + # 150 + "yen", "mu", "partialdiff", "summation", "product", + "pi", "integral", "ordfeminine", "ordmasculine", "Omega", + + # 160 + "ae", "oslash", "questiondown", "exclamdown", "logicalnot", + "radical", "florin", "approxequal", "Delta", "guillemotleft", + + # 170 + "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", + "Otilde", "OE", "oe", "endash", "emdash", + + # 180 + "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", + "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", + + # 190 + "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", + "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", - # 200 - "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", - "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", + # 200 + "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", + "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", - # 210 - "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", - "dotlessi", "circumflex", "tilde", "macron", "breve", + # 210 + "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", + "dotlessi", "circumflex", "tilde", "macron", "breve", - # 220 - "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", - "caron", "Lslash", "lslash", "Scaron", "scaron", + # 220 + "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", + "caron", "Lslash", "lslash", "Scaron", "scaron", - # 230 - "Zcaron", "zcaron", "brokenbar", "Eth", "eth", - "Yacute", "yacute", "Thorn", "thorn", "minus", + # 230 + "Zcaron", "zcaron", "brokenbar", "Eth", "eth", + "Yacute", "yacute", "Thorn", "thorn", "minus", - # 240 - "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", - "onequarter", "threequarters", "franc", "Gbreve", "gbreve", + # 240 + "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", + "onequarter", "threequarters", "franc", "Gbreve", "gbreve", - # 250 - "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", - "Ccaron", "ccaron", "dcroat" + # 250 + "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", + "Ccaron", "ccaron", "dcroat" ] - # The list of standard `SID' glyph names. For the official list, # see Annex A of document at # -# https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf . +# https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf # -sid_standard_names = \ -[ - # 0 - ".notdef", "space", "exclam", "quotedbl", "numbersign", - "dollar", "percent", "ampersand", "quoteright", "parenleft", - - # 10 - "parenright", "asterisk", "plus", "comma", "hyphen", - "period", "slash", "zero", "one", "two", - - # 20 - "three", "four", "five", "six", "seven", - "eight", "nine", "colon", "semicolon", "less", - - # 30 - "equal", "greater", "question", "at", "A", - "B", "C", "D", "E", "F", - - # 40 - "G", "H", "I", "J", "K", - "L", "M", "N", "O", "P", - - # 50 - "Q", "R", "S", "T", "U", - "V", "W", "X", "Y", "Z", - - # 60 - "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", - "quoteleft", "a", "b", "c", "d", - - # 70 - "e", "f", "g", "h", "i", - "j", "k", "l", "m", "n", - - # 80 - "o", "p", "q", "r", "s", - "t", "u", "v", "w", "x", - - # 90 - "y", "z", "braceleft", "bar", "braceright", - "asciitilde", "exclamdown", "cent", "sterling", "fraction", - - # 100 - "yen", "florin", "section", "currency", "quotesingle", - "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", - - # 110 - "fl", "endash", "dagger", "daggerdbl", "periodcentered", - "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", - - # 120 - "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", - "acute", "circumflex", "tilde", "macron", "breve", - - # 130 - "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", - "ogonek", "caron", "emdash", "AE", "ordfeminine", - - # 140 - "Lslash", "Oslash", "OE", "ordmasculine", "ae", - "dotlessi", "lslash", "oslash", "oe", "germandbls", - - # 150 - "onesuperior", "logicalnot", "mu", "trademark", "Eth", - "onehalf", "plusminus", "Thorn", "onequarter", "divide", - - # 160 - "brokenbar", "degree", "thorn", "threequarters", "twosuperior", - "registered", "minus", "eth", "multiply", "threesuperior", - - # 170 - "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", - "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", - - # 180 - "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", - "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", - - # 190 - "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", - "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", - - # 200 - "aacute", "acircumflex", "adieresis", "agrave", "aring", - "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", - - # 210 - "egrave", "iacute", "icircumflex", "idieresis", "igrave", - "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", - - # 220 - "otilde", "scaron", "uacute", "ucircumflex", "udieresis", - "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", - - # 230 - "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", +sid_standard_names = [ + # 0 + ".notdef", "space", "exclam", "quotedbl", "numbersign", + "dollar", "percent", "ampersand", "quoteright", "parenleft", + + # 10 + "parenright", "asterisk", "plus", "comma", "hyphen", + "period", "slash", "zero", "one", "two", + + # 20 + "three", "four", "five", "six", "seven", + "eight", "nine", "colon", "semicolon", "less", + + # 30 + "equal", "greater", "question", "at", "A", + "B", "C", "D", "E", "F", + + # 40 + "G", "H", "I", "J", "K", + "L", "M", "N", "O", "P", + + # 50 + "Q", "R", "S", "T", "U", + "V", "W", "X", "Y", "Z", + + # 60 + "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", + "quoteleft", "a", "b", "c", "d", + + # 70 + "e", "f", "g", "h", "i", + "j", "k", "l", "m", "n", + + # 80 + "o", "p", "q", "r", "s", + "t", "u", "v", "w", "x", + + # 90 + "y", "z", "braceleft", "bar", "braceright", + "asciitilde", "exclamdown", "cent", "sterling", "fraction", + + # 100 + "yen", "florin", "section", "currency", "quotesingle", + "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", + + # 110 + "fl", "endash", "dagger", "daggerdbl", "periodcentered", + "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", + + # 120 + "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", + "acute", "circumflex", "tilde", "macron", "breve", + + # 130 + "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", + "ogonek", "caron", "emdash", "AE", "ordfeminine", + + # 140 + "Lslash", "Oslash", "OE", "ordmasculine", "ae", + "dotlessi", "lslash", "oslash", "oe", "germandbls", + + # 150 + "onesuperior", "logicalnot", "mu", "trademark", "Eth", + "onehalf", "plusminus", "Thorn", "onequarter", "divide", + + # 160 + "brokenbar", "degree", "thorn", "threequarters", "twosuperior", + "registered", "minus", "eth", "multiply", "threesuperior", + + # 170 + "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", + "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", + + # 180 + "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", + "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", + + # 190 + "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", + "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", + + # 200 + "aacute", "acircumflex", "adieresis", "agrave", "aring", + "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", + + # 210 + "egrave", "iacute", "icircumflex", "idieresis", "igrave", + "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", + + # 220 + "otilde", "scaron", "uacute", "ucircumflex", "udieresis", + "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", + + # 230 + "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", - "parenleftsuperior", "parenrightsuperior", "twodotenleader", + "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", - # 240 - "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", + # 240 + "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", - "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", + "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", - # 250 - "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", + # 250 + "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", - "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", + "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", - # 260 - "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", - "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", + # 260 + "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", + "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", - # 270 - "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", + # 270 + "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", - "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", + "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", - # 280 - "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", - "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", + # 280 + "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", + "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", - # 290 - "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", - "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", + # 290 + "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", + "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", - # 300 - "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", - "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", + # 300 + "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", + "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", - # 310 - "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", - "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", + # 310 + "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", + "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", - # 320 - "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", - "twothirds", "zerosuperior", "foursuperior", "fivesuperior", + # 320 + "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", + "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", - # 330 - "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", + # 330 + "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", - "twoinferior", "threeinferior", "fourinferior", "fiveinferior", + "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", - # 340 - "seveninferior", "eightinferior", "nineinferior", "centinferior", + # 340 + "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", - "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", + "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", - # 350 - "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", - "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", + # 350 + "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", + "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", - # 360 - "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", + # 360 + "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", - "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", + "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", - # 370 - "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", + # 370 + "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", - "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", + "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", - # 380 - "001.001", "001.002", "001.003", "Black", "Bold", - "Book", "Light", "Medium", "Regular", "Roman", + # 380 + "001.001", "001.002", "001.003", "Black", "Bold", + "Book", "Light", "Medium", "Regular", "Roman", - # 390 - "Semibold" + # 390 + "Semibold" ] - # This table maps character codes of the Adobe Standard Type 1 # encoding to glyph indices in the sid_standard_names table. # -t1_standard_encoding = \ -[ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 0, 111, 112, 113, - 114, 0, 115, 116, 117, 118, 119, 120, 121, 122, - 0, 123, 0, 124, 125, 126, 127, 128, 129, 130, - - 131, 0, 132, 133, 0, 134, 135, 136, 137, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 138, 0, 139, 0, 0, - 0, 0, 140, 141, 142, 143, 0, 0, 0, 0, - 0, 144, 0, 0, 0, 145, 0, 0, 146, 147, - - 148, 149, 0, 0, 0, 0 +t1_standard_encoding = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 0, 111, 112, 113, + 114, 0, 115, 116, 117, 118, 119, 120, 121, 122, + 0, 123, 0, 124, 125, 126, 127, 128, 129, 130, + + 131, 0, 132, 133, 0, 134, 135, 136, 137, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 138, 0, 139, 0, 0, + 0, 0, 140, 141, 142, 143, 0, 0, 0, 0, + 0, 144, 0, 0, 0, 145, 0, 0, 146, 147, + + 148, 149, 0, 0, 0, 0 ] - # This table maps character codes of the Adobe Expert Type 1 # encoding to glyph indices in the sid_standard_names table. # -t1_expert_encoding = \ -[ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 229, 230, 0, 231, 232, 233, 234, - 235, 236, 237, 238, 13, 14, 15, 99, 239, 240, - - 241, 242, 243, 244, 245, 246, 247, 248, 27, 28, - 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, - 0, 0, 0, 258, 0, 0, 259, 260, 261, 262, - 0, 0, 263, 264, 265, 0, 266, 109, 110, 267, - 268, 269, 0, 270, 271, 272, 273, 274, 275, 276, - - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 304, 305, 306, 0, 0, 307, 308, 309, 310, - 311, 0, 312, 0, 0, 313, 0, 0, 314, 315, - 0, 0, 316, 317, 318, 0, 0, 0, 158, 155, - 163, 319, 320, 321, 322, 323, 324, 325, 0, 0, - - 326, 150, 164, 169, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, - - 373, 374, 375, 376, 377, 378 +t1_expert_encoding = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 237, 238, 13, 14, 15, 99, 239, 240, + + 241, 242, 243, 244, 245, 246, 247, 248, 27, 28, + 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, + 0, 0, 0, 258, 0, 0, 259, 260, 261, 262, + 0, 0, 263, 264, 265, 0, 266, 109, 110, 267, + 268, 269, 0, 270, 271, 272, 273, 274, 275, 276, + + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 304, 305, 306, 0, 0, 307, 308, 309, 310, + 311, 0, 312, 0, 0, 313, 0, 0, 314, 315, + 0, 0, 316, 317, 318, 0, 0, 0, 158, 155, + 163, 319, 320, 321, 322, 323, 324, 325, 0, 0, + + 326, 150, 164, 169, 327, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, + + 373, 374, 375, 376, 377, 378 ] - # This data has been taken literally from the files `glyphlist.txt' # and `zapfdingbats.txt' version 2.0, Sept 2002. It is available from # @@ -4906,81 +4894,81 @@ a9;2720 # string table management # class StringTable: - def __init__( self, name_list, master_table_name ): - self.names = name_list - self.master_table = master_table_name - self.indices = {} - index = 0 - - for name in name_list: - self.indices[name] = index - index += len( name ) + 1 - - self.total = index - - def dump( self, file ): - write = file.write - write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) - write( "#ifdef __cplusplus\n" ) - write( ' extern "C"\n' ) - write( "#else\n" ) - write( " extern\n" ) - write( "#endif\n" ) - write( "#endif\n" ) - write( " const char " + self.master_table + - "[" + repr( self.total ) + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) - write( " =\n" ) - write( " {\n" ) - - line = "" - for name in self.names: - line += " '" - line += string.join( ( re.findall( ".", name ) ), "','" ) - line += "', 0,\n" - - write( line ) - write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) - write( " ;\n\n\n" ) - - def dump_sublist( self, file, table_name, macro_name, sublist ): - write = file.write - write( "#define " + macro_name + " " + repr( len( sublist ) ) + "\n\n" ) - - write( " /* Values are offsets into the `" + - self.master_table + "' table */\n\n" ) - write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) - write( "#ifdef __cplusplus\n" ) - write( ' extern "C"\n' ) - write( "#else\n" ) - write( " extern\n" ) - write( "#endif\n" ) - write( "#endif\n" ) - write( " const short " + table_name + - "[" + macro_name + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) - write( " =\n" ) - write( " {\n" ) - - line = " " - comma = "" - col = 0 - - for name in sublist: - line += comma - line += "%4d" % self.indices[name] - col += 1 - comma = "," - if col == 14: - col = 0 - comma = ",\n " - - write( line ) - write( "\n" ) - write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) - write( " ;\n\n\n" ) + def __init__(self, name_list, master_table_name): + self.names = name_list + self.master_table = master_table_name + self.indices = {} + index = 0 + + for name in name_list: + self.indices[name] = index + index += len(name) + 1 + + self.total = index + + def dump(self, file): + write = file.write + write("#ifndef DEFINE_PS_TABLES_DATA\n") + write("#ifdef __cplusplus\n") + write(' extern "C"\n') + write("#else\n") + write(" extern\n") + write("#endif\n") + write("#endif\n") + write(" const char " + self.master_table + + "[" + repr(self.total) + "]\n") + write("#ifdef DEFINE_PS_TABLES_DATA\n") + write(" =\n") + write(" {\n") + + line = "" + for name in self.names: + line += " '" + line += "','".join(list(name)) + line += "', 0,\n" + + write(line) + write(" }\n") + write("#endif /* DEFINE_PS_TABLES_DATA */\n") + write(" ;\n\n\n") + + def dump_sublist(self, file, table_name, macro_name, sublist): + write = file.write + write("#define " + macro_name + " " + repr(len(sublist)) + "\n\n") + + write(" /* Values are offsets into the `" + + self.master_table + "' table */\n\n") + write("#ifndef DEFINE_PS_TABLES_DATA\n") + write("#ifdef __cplusplus\n") + write(' extern "C"\n') + write("#else\n") + write(" extern\n") + write("#endif\n") + write("#endif\n") + write(" const short " + table_name + + "[" + macro_name + "]\n") + write("#ifdef DEFINE_PS_TABLES_DATA\n") + write(" =\n") + write(" {\n") + + line = " " + comma = "" + col = 0 + + for name in sublist: + line += comma + line += "%4d" % self.indices[name] + col += 1 + comma = "," + if col == 14: + col = 0 + comma = ",\n " + + write(line) + write("\n") + write(" }\n") + write("#endif /* DEFINE_PS_TABLES_DATA */\n") + write(" ;\n\n\n") # We now store the Adobe Glyph List in compressed form. The list is put @@ -5059,307 +5047,312 @@ class StringTable: # The root node has first letter = 0, and no value. # class StringNode: - def __init__( self, letter, value ): - self.letter = letter - self.value = value - self.children = {} - - def __cmp__( self, other ): - return ord( self.letter[0] ) - ord( other.letter[0] ) - - def add( self, word, value ): - if len( word ) == 0: - self.value = value - return - - letter = word[0] - word = word[1:] + def __init__(self, letter, value): + self.letter = letter + self.value = value + self.children = {} + + def __cmp__(self, other): + return ord(self.letter[0]) - ord(other.letter[0]) + + def __lt__(self, other): + return self.letter[0] < other.letter[0] + + def add(self, word, value): + if len(word) == 0: + self.value = value + return + + letter = word[0] + word = word[1:] - if self.children.has_key( letter ): - child = self.children[letter] - else: - child = StringNode( letter, 0 ) - self.children[letter] = child + if letter in self.children: + child = self.children[letter] + else: + child = StringNode(letter, 0) + self.children[letter] = child - child.add( word, value ) + child.add(word, value) - def optimize( self ): - # optimize all children first - children = self.children.values() - self.children = {} + def optimize(self): + # optimize all children first + children = list(self.children.values()) + self.children = {} - for child in children: - self.children[child.letter[0]] = child.optimize() + for child in children: + self.children[child.letter[0]] = child.optimize() - # don't optimize if there's a value, - # if we don't have any child or if we - # have more than one child - if ( self.value != 0 ) or ( not children ) or len( children ) > 1: - return self + # don't optimize if there's a value, + # if we don't have any child or if we + # have more than one child + if (self.value != 0) or (not children) or len(children) > 1: + return self - child = children[0] + child = children[0] - self.letter += child.letter - self.value = child.value - self.children = child.children + self.letter += child.letter + self.value = child.value + self.children = child.children - return self + return self - def dump_debug( self, write, margin ): - # this is used during debugging - line = margin + "+-" - if len( self.letter ) == 0: - line += "<NOLETTER>" - else: - line += self.letter + def dump_debug(self, write, margin): + # this is used during debugging + line = margin + "+-" + if len(self.letter) == 0: + line += "<NOLETTER>" + else: + line += self.letter - if self.value: - line += " => " + repr( self.value ) + if self.value: + line += " => " + repr(self.value) - write( line + "\n" ) + write(line + "\n") - if self.children: - margin += "| " - for child in self.children.values(): - child.dump_debug( write, margin ) + if self.children: + margin += "| " + for child in self.children.values(): + child.dump_debug(write, margin) - def locate( self, index ): - self.index = index - if len( self.letter ) > 0: - index += len( self.letter ) + 1 - else: - index += 2 + def locate(self, index): + self.index = index + if len(self.letter) > 0: + index += len(self.letter) + 1 + else: + index += 2 - if self.value != 0: - index += 2 + if self.value != 0: + index += 2 - children = self.children.values() - children.sort() + children = list(self.children.values()) + children.sort() - index += 2 * len( children ) - for child in children: - index = child.locate( index ) + index += 2 * len(children) + for child in children: + index = child.locate(index) - return index + return index - def store( self, storage ): - # write the letters - l = len( self.letter ) - if l == 0: - storage += struct.pack( "B", 0 ) - else: - for n in range( l ): - val = ord( self.letter[n] ) - if n < l - 1: - val += 128 - storage += struct.pack( "B", val ) + def store(self, storage): + # write the letters + length = len(self.letter) + if length == 0: + storage += struct.pack("B", 0) + else: + for n in range(length): + val = ord(self.letter[n]) + if n < length - 1: + val += 128 + storage += struct.pack("B", val) - # write the count - children = self.children.values() - children.sort() + # write the count + children = list(self.children.values()) + children.sort() - count = len( children ) + count = len(children) - if self.value != 0: - storage += struct.pack( "!BH", count + 128, self.value ) - else: - storage += struct.pack( "B", count ) + if self.value != 0: + storage += struct.pack("!BH", count + 128, self.value) + else: + storage += struct.pack("B", count) - for child in children: - storage += struct.pack( "!H", child.index ) + for child in children: + storage += struct.pack("!H", child.index) - for child in children: - storage = child.store( storage ) + for child in children: + storage = child.store(storage) - return storage + return storage def adobe_glyph_values(): - """return the list of glyph names and their unicode values""" - - lines = string.split( adobe_glyph_list, '\n' ) - glyphs = [] - values = [] - - for line in lines: - if line: - fields = string.split( line, ';' ) -# print fields[1] + ' - ' + fields[0] - subfields = string.split( fields[1], ' ' ) - if len( subfields ) == 1: - glyphs.append( fields[0] ) - values.append( fields[1] ) - - return glyphs, values - - -def filter_glyph_names( alist, filter ): - """filter `alist' by taking _out_ all glyph names that are in `filter'""" - - count = 0 - extras = [] - - for name in alist: - try: - filtered_index = filter.index( name ) - except: - extras.append( name ) - - return extras - - -def dump_encoding( file, encoding_name, encoding_list ): - """dump a given encoding""" - - write = file.write - write( " /* the following are indices into the SID name table */\n" ) - write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) - write( "#ifdef __cplusplus\n" ) - write( ' extern "C"\n' ) - write( "#else\n" ) - write( " extern\n" ) - write( "#endif\n" ) - write( "#endif\n" ) - write( " const unsigned short " + encoding_name + - "[" + repr( len( encoding_list ) ) + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) - write( " =\n" ) - write( " {\n" ) - - line = " " - comma = "" - col = 0 - for value in encoding_list: - line += comma - line += "%3d" % value - comma = "," - col += 1 - if col == 16: - col = 0 - comma = ",\n " - - write( line ) - write( "\n" ) - write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) - write( " ;\n\n\n" ) - - -def dump_array( the_array, write, array_name ): - """dumps a given encoding""" - - write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) - write( "#ifdef __cplusplus\n" ) - write( ' extern "C"\n' ) - write( "#else\n" ) - write( " extern\n" ) - write( "#endif\n" ) - write( "#endif\n" ) - write( " const unsigned char " + array_name + - "[" + repr( len( the_array ) ) + "L]\n" ) - write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) - write( " =\n" ) - write( " {\n" ) - - line = "" - comma = " " - col = 0 - - for value in the_array: - line += comma - line += "%3d" % ord( value ) - comma = "," - col += 1 - - if col == 16: - col = 0 - comma = ",\n " - - if len( line ) > 1024: - write( line ) - line = "" - - write( line ) - write( "\n" ) - write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) - write( " ;\n\n\n" ) + """return the list of glyph names and their unicode values""" + + lines = adobe_glyph_list.split("\n") + glyphs = [] + values = [] + + for line in lines: + if line: + fields = line.split(';') + # print fields[1] + ' - ' + fields[0] + subfields = fields[1].split(' ') + if len(subfields) == 1: + glyphs.append(fields[0]) + values.append(fields[1]) + + return glyphs, values + + +def filter_glyph_names(alist, filter): + """filter `alist' by taking _out_ all glyph names that are in `filter'""" + + count = 0 + extras = [] + + for name in alist: + try: + filtered_index = filter.index(name) + except: + extras.append(name) + + return extras + + +def dump_encoding(file, encoding_name, encoding_list): + """dump a given encoding""" + + write = file.write + write(" /* the following are indices into the SID name table */\n") + write("#ifndef DEFINE_PS_TABLES_DATA\n") + write("#ifdef __cplusplus\n") + write(' extern "C"\n') + write("#else\n") + write(" extern\n") + write("#endif\n") + write("#endif\n") + write(" const unsigned short " + encoding_name + + "[" + repr(len(encoding_list)) + "]\n") + write("#ifdef DEFINE_PS_TABLES_DATA\n") + write(" =\n") + write(" {\n") + + line = " " + comma = "" + col = 0 + for value in encoding_list: + line += comma + line += "%3d" % value + comma = "," + col += 1 + if col == 16: + col = 0 + comma = ",\n " + + write(line) + write("\n") + write(" }\n") + write("#endif /* DEFINE_PS_TABLES_DATA */\n") + write(" ;\n\n\n") + + +def dump_array(the_array, write, array_name): + """dumps a given encoding""" + + write("#ifndef DEFINE_PS_TABLES_DATA\n") + write("#ifdef __cplusplus\n") + write(' extern "C"\n') + write("#else\n") + write(" extern\n") + write("#endif\n") + write("#endif\n") + write(" const unsigned char " + array_name + + "[" + repr(len(the_array)) + "L]\n") + write("#ifdef DEFINE_PS_TABLES_DATA\n") + write(" =\n") + write(" {\n") + + line = "" + comma = " " + col = 0 + + for value in the_array: + line += comma + line += "%3d" % value + comma = "," + col += 1 + + if col == 16: + col = 0 + comma = ",\n " + + if len(line) > 1024: + write(line) + line = "" + + write(line) + write("\n") + write(" }\n") + write("#endif /* DEFINE_PS_TABLES_DATA */\n") + write(" ;\n\n\n") def main(): - """main program body""" - - if len( sys.argv ) != 2: - print __doc__ % sys.argv[0] - sys.exit( 1 ) - - file = open( sys.argv[1], "wb" ) - write = file.write - - count_sid = len( sid_standard_names ) - - # `mac_extras' contains the list of glyph names in the Macintosh standard - # encoding which are not in the SID Standard Names. - # - mac_extras = filter_glyph_names( mac_standard_names, sid_standard_names ) - - # `base_list' contains the names of our final glyph names table. - # It consists of the `mac_extras' glyph names, followed by the SID - # standard names. - # - mac_extras_count = len( mac_extras ) - base_list = mac_extras + sid_standard_names - - write( "/****************************************************************************\n" ) - write( " *\n" ) - - write( " * %-71s\n" % os.path.basename( sys.argv[1] ) ) - - write( " *\n" ) - write( " * PostScript glyph names.\n" ) - write( " *\n" ) - write( " * Copyright 2005-2019 by\n" ) - write( " * David Turner, Robert Wilhelm, and Werner Lemberg.\n" ) - write( " *\n" ) - write( " * This file is part of the FreeType project, and may only be used,\n" ) - write( " * modified, and distributed under the terms of the FreeType project\n" ) - write( " * license, LICENSE.TXT. By continuing to use, modify, or distribute\n" ) - write( " * this file you indicate that you have read the license and\n" ) - write( " * understand and accept it fully.\n" ) - write( " *\n" ) - write( " */\n" ) - write( "\n" ) - write( "\n" ) - write( " /* This file has been generated automatically -- do not edit! */\n" ) - write( "\n" ) - write( "\n" ) - - # dump final glyph list (mac extras + sid standard names) - # - st = StringTable( base_list, "ft_standard_glyph_names" ) - - st.dump( file ) - st.dump_sublist( file, "ft_mac_names", - "FT_NUM_MAC_NAMES", mac_standard_names ) - st.dump_sublist( file, "ft_sid_names", - "FT_NUM_SID_NAMES", sid_standard_names ) - - dump_encoding( file, "t1_standard_encoding", t1_standard_encoding ) - dump_encoding( file, "t1_expert_encoding", t1_expert_encoding ) - - # dump the AGL in its compressed form - # - agl_glyphs, agl_values = adobe_glyph_values() - dict = StringNode( "", 0 ) - - for g in range( len( agl_glyphs ) ): - dict.add( agl_glyphs[g], eval( "0x" + agl_values[g] ) ) - - dict = dict.optimize() - dict_len = dict.locate( 0 ) - dict_array = dict.store( "" ) - - write( """\ + """main program body""" + + if len(sys.argv) != 2: + print(__doc__ % sys.argv[0]) + sys.exit(1) + + file = open(sys.argv[1], "w") + write = file.write + + count_sid = len(sid_standard_names) + + # `mac_extras' contains the list of glyph names in the Macintosh standard + # encoding which are not in the SID Standard Names. + # + mac_extras = filter_glyph_names(mac_standard_names, sid_standard_names) + + # `base_list' contains the names of our final glyph names table. + # It consists of the `mac_extras' glyph names, followed by the SID + # standard names. + # + mac_extras_count = len(mac_extras) + base_list = mac_extras + sid_standard_names + + write("/*\n") + write(" *\n") + write(" * %-71s\n" % os.path.basename(sys.argv[1])) + write(" *\n") + write(" * PostScript glyph names.\n") + write(" *\n") + write(" * Copyright 2005-2022 by\n") + write(" * David Turner, Robert Wilhelm, and Werner Lemberg.\n") + write(" *\n") + write(" * This file is part of the FreeType project, and may only be " + "used,\n") + write(" * modified, and distributed under the terms of the FreeType " + "project\n") + write(" * license, LICENSE.TXT. By continuing to use, modify, or " + "distribute\n") + write(" * this file you indicate that you have read the license and\n") + write(" * understand and accept it fully.\n") + write(" *\n") + write(" */\n") + write("\n") + write("\n") + write(" /* This file has been generated automatically -- do not edit! */" + "\n") + write("\n") + write("\n") + + # dump final glyph list (mac extras + sid standard names) + # + st = StringTable(base_list, "ft_standard_glyph_names") + + st.dump(file) + st.dump_sublist(file, "ft_mac_names", + "FT_NUM_MAC_NAMES", mac_standard_names) + st.dump_sublist(file, "ft_sid_names", + "FT_NUM_SID_NAMES", sid_standard_names) + + dump_encoding(file, "t1_standard_encoding", t1_standard_encoding) + dump_encoding(file, "t1_expert_encoding", t1_expert_encoding) + + # dump the AGL in its compressed form + # + agl_glyphs, agl_values = adobe_glyph_values() + dictionary = StringNode("", 0) + + for g in range(len(agl_glyphs)): + dictionary.add(agl_glyphs[g], eval("0x" + agl_values[g])) + + dictionary = dictionary.optimize() + dict_len = dictionary.locate(0) + dict_array = dictionary.store(b"") + + write("""\ /* * This table is a compressed version of the Adobe Glyph List (AGL), * optimized for efficient searching. It has been generated by the @@ -5371,13 +5364,13 @@ def main(): #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST -""" ) +""") - dump_array( dict_array, write, "ft_adobe_glyph_list" ) + dump_array(dict_array, write, "ft_adobe_glyph_list") - # write the lookup routine now - # - write( """\ + # write the lookup routine now + # + write("""\ #ifdef DEFINE_PS_TABLES /* * This function searches the compressed table efficiently. @@ -5477,64 +5470,64 @@ def main(): #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ -""" ) +""") - if 0: # generate unit test, or don't - # - # now write the unit test to check that everything works OK - # - write( "#ifdef TEST\n\n" ) + if 0: # generate unit test, or don't + # + # now write the unit test to check that everything works OK + # + write("#ifdef TEST\n\n") - write( "static const char* const the_names[] = {\n" ) - for name in agl_glyphs: - write( ' "' + name + '",\n' ) - write( " 0\n};\n" ) + write("static const char* const the_names[] = {\n") + for name in agl_glyphs: + write(' "' + name + '",\n') + write(" 0\n};\n") - write( "static const unsigned long the_values[] = {\n" ) - for val in agl_values: - write( ' 0x' + val + ',\n' ) - write( " 0\n};\n" ) + write("static const unsigned long the_values[] = {\n") + for val in agl_values: + write(' 0x' + val + ',\n') + write(" 0\n};\n") - write( """ + write(""" #include <stdlib.h> #include <stdio.h> +#include <string.h> - int - main( void ) - { - int result = 0; - const char* const* names = the_names; - const unsigned long* values = the_values; +int +main( void ) +{ +int result = 0; +const char* const* names = the_names; +const unsigned long* values = the_values; - for ( ; *names; names++, values++ ) - { - const char* name = *names; - unsigned long reference = *values; - unsigned long value; +for ( ; *names; names++, values++ ) +{ + const char* name = *names; + unsigned long reference = *values; + unsigned long value; - value = ft_get_adobe_glyph_index( name, name + strlen( name ) ); - if ( value != reference ) - { - result = 1; - fprintf( stderr, "name '%s' => %04x instead of %04x\\n", - name, value, reference ); - } - } - - return result; + value = ft_get_adobe_glyph_index( name, name + strlen( name ) ); + if ( value != reference ) + { + result = 1; + fprintf( stderr, "name '%s' => %04x instead of %04x\\n", + name, value, reference ); } -""" ) +} - write( "#endif /* TEST */\n" ) +return result; +} +""") - write("\n/* END */\n") + write("#endif /* TEST */\n") + + write("\n/* END */\n") # Now run the main routine # main() - # END diff --git a/lib/freetype/src/tools/no-copyright b/lib/freetype/src/tools/no-copyright index 1eaa63096..e171b76f3 100644 --- a/lib/freetype/src/tools/no-copyright +++ b/lib/freetype/src/tools/no-copyright @@ -1,9 +1,9 @@ # Files that don't get a copyright, or which are taken from elsewhere. # -# All lines in this file are patterns, including the comment lines; this -# means that e.g. `FTL.TXT' matches all files that have this string in -# the file name (including the path relative to the current directory, -# always starting with `./'). +# All lines in this file are patterns (relative to the top-level directory), +# including the comment lines; this means that e.g. `FTL.TXT' matches all +# files that have this string in the file name (including the path relative +# to the current directory, always starting with `./'). # # Don't put empty lines into this file! # @@ -42,6 +42,7 @@ src/pcf/README src/pcf/rules.mk # src/gzip/adler32.c +src/gzip/ftzconf.c src/gzip/infblock.c src/gzip/infblock.h src/gzip/infcodes.c diff --git a/lib/freetype/src/tools/update-copyright b/lib/freetype/src/tools/update-copyright index 4a8bf9b0e..674823ceb 100644 --- a/lib/freetype/src/tools/update-copyright +++ b/lib/freetype/src/tools/update-copyright @@ -4,10 +4,10 @@ # taking care of exceptions stored in file `no-copyright'. topdir=`git rev-parse --show-toplevel` -toolsdir=$topdir/src/tools +toolsdir=`dirname $0` git ls-files --full-name $topdir \ -| sed 's|^|../../|' \ +| sed "s|^|$topdir/|" \ | grep -vFf $toolsdir/no-copyright \ | xargs $toolsdir/update-copyright-year diff --git a/lib/freetype/src/tools/update-copyright-year b/lib/freetype/src/tools/update-copyright-year index f699db76e..b0b60fb88 100644 --- a/lib/freetype/src/tools/update-copyright-year +++ b/lib/freetype/src/tools/update-copyright-year @@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}' & eval 'exec perl -wS -i "$0" $argv:q' if 0; -# Copyright (C) 2015-2022 by +# Copyright (C) 2015-2023 by # Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/lib/freetype/src/truetype/module.mk b/lib/freetype/src/truetype/module.mk index f6e1c91a5..5d44ac1f4 100644 --- a/lib/freetype/src/truetype/module.mk +++ b/lib/freetype/src/truetype/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/truetype/rules.mk b/lib/freetype/src/truetype/rules.mk index d0d2404b8..23f6f006d 100644 --- a/lib/freetype/src/truetype/rules.mk +++ b/lib/freetype/src/truetype/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/truetype/truetype.c b/lib/freetype/src/truetype/truetype.c index 41c844acb..c5faa9627 100644 --- a/lib/freetype/src/truetype/truetype.c +++ b/lib/freetype/src/truetype/truetype.c @@ -4,7 +4,7 @@ * * FreeType TrueType driver component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/ttdriver.c b/lib/freetype/src/truetype/ttdriver.c index 245d97cb5..4bea63ef8 100644 --- a/lib/freetype/src/truetype/ttdriver.c +++ b/lib/freetype/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ * * TrueType font driver implementation (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -507,19 +507,34 @@ FT_DEFINE_SERVICE_MULTIMASTERSREC( tt_service_gx_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ - (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ - (FT_Set_Var_Design_Func) TT_Set_Var_Design, /* set_var_design */ - (FT_Get_Var_Design_Func) TT_Get_Var_Design, /* get_var_design */ - (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */ - (FT_Set_MM_WeightVector_Func)NULL, /* set_mm_weightvector */ - (FT_Get_MM_WeightVector_Func)NULL, /* get_mm_weightvector */ - - (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) tt_done_blend /* done_blend */ + (FT_Get_MM_Func) NULL, /* get_mm */ + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ + (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ + (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ + (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */ + (FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */ + (FT_Set_MM_WeightVector_Func) + NULL, /* set_mm_weightvector */ + (FT_Get_MM_WeightVector_Func) + NULL, /* get_mm_weightvector */ + (FT_Var_Load_Delta_Set_Idx_Map_Func) + tt_var_load_delta_set_index_mapping, + /* load_delta_set_idx_map */ + (FT_Var_Load_Item_Var_Store_Func) + tt_var_load_item_variation_store, + /* load_item_variation_store */ + (FT_Var_Get_Item_Delta_Func) + tt_var_get_item_delta, /* get_item_delta */ + (FT_Var_Done_Item_Var_Store_Func) + tt_var_done_item_variation_store, + /* done_item_variation_store */ + (FT_Var_Done_Delta_Set_Idx_Map_Func) + tt_var_done_delta_set_index_map, + /* done_delta_set_index_map */ + (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ + (FT_Done_Blend_Func) tt_done_blend /* done_blend */ ) FT_DEFINE_SERVICE_METRICSVARIATIONSREC( diff --git a/lib/freetype/src/truetype/ttdriver.h b/lib/freetype/src/truetype/ttdriver.h index c477c0b1d..757a66f42 100644 --- a/lib/freetype/src/truetype/ttdriver.h +++ b/lib/freetype/src/truetype/ttdriver.h @@ -4,7 +4,7 @@ * * High-level TrueType driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/tterrors.h b/lib/freetype/src/truetype/tterrors.h index 2c95ea17b..008ee9985 100644 --- a/lib/freetype/src/truetype/tterrors.h +++ b/lib/freetype/src/truetype/tterrors.h @@ -4,7 +4,7 @@ * * TrueType error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/ttgload.c b/lib/freetype/src/truetype/ttgload.c index 2ca63d65a..d33bdad64 100644 --- a/lib/freetype/src/truetype/ttgload.c +++ b/lib/freetype/src/truetype/ttgload.c @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -737,19 +737,19 @@ if ( subglyph->flags & WE_HAVE_A_SCALE ) FT_TRACE7(( " scaling: %f\n", - subglyph->transform.xx / 65536.0 )); + (double)subglyph->transform.xx / 65536 )); else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE ) FT_TRACE7(( " scaling: x=%f, y=%f\n", - subglyph->transform.xx / 65536.0, - subglyph->transform.yy / 65536.0 )); + (double)subglyph->transform.xx / 65536, + (double)subglyph->transform.yy / 65536 )); else if ( subglyph->flags & WE_HAVE_A_2X2 ) { FT_TRACE7(( " scaling: xx=%f, yx=%f\n", - subglyph->transform.xx / 65536.0, - subglyph->transform.yx / 65536.0 )); + (double)subglyph->transform.xx / 65536, + (double)subglyph->transform.yx / 65536 )); FT_TRACE7(( " xy=%f, yy=%f\n", - subglyph->transform.xy / 65536.0, - subglyph->transform.yy / 65536.0 )); + (double)subglyph->transform.xy / 65536, + (double)subglyph->transform.yy / 65536 )); } subglyph++; @@ -801,7 +801,7 @@ FT_UInt start_point, FT_UInt start_contour ) { - zone->n_points = (FT_UShort)load->outline.n_points - + zone->n_points = (FT_UShort)load->outline.n_points + 4 - (FT_UShort)start_point; zone->n_contours = load->outline.n_contours - (FT_Short)start_contour; @@ -970,11 +970,6 @@ outline->points[n_points + 2] = loader->pp3; outline->points[n_points + 3] = loader->pp4; - outline->tags[n_points ] = 0; - outline->tags[n_points + 1] = 0; - outline->tags[n_points + 2] = 0; - outline->tags[n_points + 3] = 0; - n_points += 4; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT @@ -985,24 +980,9 @@ goto Exit; /* Deltas apply to the unscaled data. */ - error = TT_Vary_Apply_Glyph_Deltas( loader->face, - loader->glyph_index, + error = TT_Vary_Apply_Glyph_Deltas( loader, outline, - unrounded, - (FT_UInt)n_points ); - - /* recalculate linear horizontal and vertical advances */ - /* if we don't have HVAR and VVAR, respectively */ - - /* XXX: change all FreeType modules to store `linear' and `vadvance' */ - /* in 26.6 format before the `base' module scales them to 16.16 */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - loader->linear = FT_PIX_ROUND( unrounded[n_points - 3].x - - unrounded[n_points - 4].x ) / 64; - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - loader->vadvance = FT_PIX_ROUND( unrounded[n_points - 1].x - - unrounded[n_points - 2].x ) / 64; - + unrounded ); if ( error ) goto Exit; } @@ -1014,7 +994,7 @@ tt_prepare_zone( &loader->zone, &gloader->current, 0, 0 ); FT_ARRAY_COPY( loader->zone.orus, loader->zone.cur, - loader->zone.n_points + 4 ); + loader->zone.n_points ); } { @@ -1156,11 +1136,7 @@ } if ( IS_HINTED( loader->load_flags ) ) - { - loader->zone.n_points += 4; - error = TT_Hint_Glyph( loader, 0 ); - } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT Exit: @@ -1373,11 +1349,6 @@ outline->points[outline->n_points + 2] = loader->pp3; outline->points[outline->n_points + 3] = loader->pp4; - outline->tags[outline->n_points ] = 0; - outline->tags[outline->n_points + 1] = 0; - outline->tags[outline->n_points + 2] = 0; - outline->tags[outline->n_points + 3] = 0; - #ifdef TT_USE_BYTECODE_INTERPRETER { @@ -1436,11 +1407,9 @@ /* Some points are likely touched during execution of */ /* instructions on components. So let's untouch them. */ - for ( i = 0; i < loader->zone.n_points; i++ ) + for ( i = 0; i < loader->zone.n_points - 4U; i++ ) loader->zone.tags[i] &= ~FT_CURVE_TAG_TOUCH_BOTH; - loader->zone.n_points += 4; - return TT_Hint_Glyph( loader, 1 ); } @@ -1761,57 +1730,29 @@ /* a small outline structure with four elements for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ FT_Vector points[4]; - char tags[4] = { 1, 1, 1, 1 }; - short contours[4] = { 0, 1, 2, 3 }; FT_Outline outline; /* unrounded values */ FT_Vector unrounded[4] = { {0, 0}, {0, 0}, {0, 0}, {0, 0} }; - points[0].x = loader->pp1.x; - points[0].y = loader->pp1.y; - points[1].x = loader->pp2.x; - points[1].y = loader->pp2.y; - - points[2].x = loader->pp3.x; - points[2].y = loader->pp3.y; - points[3].x = loader->pp4.x; - points[3].y = loader->pp4.y; + points[0] = loader->pp1; + points[1] = loader->pp2; + points[2] = loader->pp3; + points[3] = loader->pp4; - outline.n_points = 4; - outline.n_contours = 4; + outline.n_points = 0; + outline.n_contours = 0; outline.points = points; - outline.tags = tags; - outline.contours = contours; + outline.tags = NULL; + outline.contours = NULL; /* this must be done before scaling */ - error = TT_Vary_Apply_Glyph_Deltas( loader->face, - glyph_index, + error = TT_Vary_Apply_Glyph_Deltas( loader, &outline, - unrounded, - (FT_UInt)outline.n_points ); + unrounded ); if ( error ) goto Exit; - - loader->pp1.x = points[0].x; - loader->pp1.y = points[0].y; - loader->pp2.x = points[1].x; - loader->pp2.y = points[1].y; - - loader->pp3.x = points[2].x; - loader->pp3.y = points[2].y; - loader->pp4.x = points[3].x; - loader->pp4.y = points[3].y; - - /* recalculate linear horizontal and vertical advances */ - /* if we don't have HVAR and VVAR, respectively */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - loader->linear = FT_PIX_ROUND( unrounded[1].x - - unrounded[0].x ) / 64; - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - loader->vadvance = FT_PIX_ROUND( unrounded[3].x - - unrounded[2].x ) / 64; } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ @@ -1959,17 +1900,16 @@ /* construct an outline structure for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ - outline.n_points = (short)( gloader->current.num_subglyphs + 4 ); - outline.n_contours = outline.n_points; + outline.n_contours = outline.n_points = limit; outline.points = NULL; outline.tags = NULL; outline.contours = NULL; - if ( FT_NEW_ARRAY( points, outline.n_points ) || - FT_NEW_ARRAY( tags, outline.n_points ) || - FT_NEW_ARRAY( contours, outline.n_points ) || - FT_NEW_ARRAY( unrounded, outline.n_points ) ) + if ( FT_NEW_ARRAY( points, limit + 4 ) || + FT_NEW_ARRAY( tags, limit + 4 ) || + FT_NEW_ARRAY( contours, limit + 4 ) || + FT_NEW_ARRAY( unrounded, limit + 4 ) ) goto Exit1; subglyph = gloader->current.subglyphs; @@ -1985,28 +1925,10 @@ contours[i] = i; } - points[i].x = loader->pp1.x; - points[i].y = loader->pp1.y; - tags[i] = 1; - contours[i] = i; - - i++; - points[i].x = loader->pp2.x; - points[i].y = loader->pp2.y; - tags[i] = 1; - contours[i] = i; - - i++; - points[i].x = loader->pp3.x; - points[i].y = loader->pp3.y; - tags[i] = 1; - contours[i] = i; - - i++; - points[i].x = loader->pp4.x; - points[i].y = loader->pp4.y; - tags[i] = 1; - contours[i] = i; + points[i++] = loader->pp1; + points[i++] = loader->pp2; + points[i++] = loader->pp3; + points[i ] = loader->pp4; outline.points = points; outline.tags = tags; @@ -2014,12 +1936,9 @@ /* this call provides additional offsets */ /* for each component's translation */ - if ( FT_SET_ERROR( TT_Vary_Apply_Glyph_Deltas( - face, - glyph_index, - &outline, - unrounded, - (FT_UInt)outline.n_points ) ) ) + if ( FT_SET_ERROR( TT_Vary_Apply_Glyph_Deltas( loader, + &outline, + unrounded ) ) ) goto Exit1; subglyph = gloader->current.subglyphs; @@ -2033,27 +1952,6 @@ } } - loader->pp1.x = points[i + 0].x; - loader->pp1.y = points[i + 0].y; - loader->pp2.x = points[i + 1].x; - loader->pp2.y = points[i + 1].y; - - loader->pp3.x = points[i + 2].x; - loader->pp3.y = points[i + 2].y; - loader->pp4.x = points[i + 3].x; - loader->pp4.y = points[i + 3].y; - - /* recalculate linear horizontal and vertical advances */ - /* if we don't have HVAR and VVAR, respectively */ - if ( !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - loader->linear = - FT_PIX_ROUND( unrounded[outline.n_points - 3].x - - unrounded[outline.n_points - 4].x ) / 64; - if ( !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - loader->vadvance = - FT_PIX_ROUND( unrounded[outline.n_points - 1].x - - unrounded[outline.n_points - 2].x ) / 64; - Exit1: FT_FREE( outline.points ); FT_FREE( outline.tags ); @@ -2229,12 +2127,11 @@ compute_glyph_metrics( TT_Loader loader, FT_UInt glyph_index ) { - TT_Face face = loader->face; - + TT_Face face = loader->face; + TT_Size size = loader->size; + TT_GlyphSlot glyph = loader->glyph; FT_BBox bbox; FT_Fixed y_scale; - TT_GlyphSlot glyph = loader->glyph; - TT_Size size = loader->size; y_scale = 0x10000L; @@ -2372,17 +2269,13 @@ FT_UInt glyph_index, FT_Int32 load_flags ) { - TT_Face face; - SFNT_Service sfnt; - FT_Stream stream; + 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; - face = (TT_Face)glyph->face; - sfnt = (SFNT_Service)face->sfnt; - stream = face->root.stream; - error = sfnt->load_sbit_image( face, size->strike_index, glyph_index, @@ -2433,22 +2326,19 @@ FT_Int32 load_flags, FT_Bool glyf_table_only ) { - TT_Face face; - FT_Stream stream; + 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 ); #if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \ defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( (TT_Face)glyph->face ); + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( glyph->face ); #endif #endif - face = (TT_Face)glyph->face; - stream = face->root.stream; - FT_ZERO( loader ); #ifdef TT_USE_BYTECODE_INTERPRETER @@ -2816,6 +2706,7 @@ FT_UInt glyph_index, FT_Int32 load_flags ) { + TT_Face face = (TT_Face)glyph->face; FT_Error error; TT_LoaderRec loader; @@ -2840,8 +2731,6 @@ /* if we have a bitmap-only font, return an empty glyph */ if ( !FT_IS_SCALABLE( glyph->face ) ) { - TT_Face face = (TT_Face)glyph->face; - FT_Short left_bearing = 0; FT_Short top_bearing = 0; @@ -2900,9 +2789,6 @@ if ( FT_IS_SCALABLE( glyph->face ) || FT_HAS_SBIX( glyph->face ) ) { - TT_Face face = (TT_Face)glyph->face; - - /* 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 ); @@ -2971,23 +2857,23 @@ #ifdef FT_CONFIG_OPTION_SVG /* check for OT-SVG */ - if ( ( load_flags & FT_LOAD_COLOR ) && ( (TT_Face)glyph->face )->svg ) + if ( ( load_flags & FT_LOAD_COLOR ) && face->svg ) { - SFNT_Service sfnt; - - FT_Short leftBearing; - FT_Short topBearing; - FT_UShort advanceX; - FT_UShort advanceY; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_TRACE3(( "Trying to load SVG glyph\n" )); - sfnt = (SFNT_Service)( (TT_Face)glyph->face )->sfnt; error = sfnt->load_svg_doc( glyph, glyph_index ); if ( !error ) { - TT_Face face = (TT_Face)glyph->face; + FT_Fixed x_scale = size->root.metrics.x_scale; + FT_Fixed y_scale = size->root.metrics.y_scale; + + FT_Short leftBearing; + FT_Short topBearing; + FT_UShort advanceX; + FT_UShort advanceY; FT_TRACE3(( "Successfully loaded SVG glyph\n" )); @@ -3005,15 +2891,11 @@ &topBearing, &advanceY ); - advanceX = (FT_UShort)FT_MulDiv( advanceX, - glyph->face->size->metrics.x_ppem, - glyph->face->units_per_EM ); - advanceY = (FT_UShort)FT_MulDiv( advanceY, - glyph->face->size->metrics.y_ppem, - glyph->face->units_per_EM ); + glyph->linearHoriAdvance = advanceX; + glyph->linearVertAdvance = advanceY; - glyph->metrics.horiAdvance = advanceX << 6; - glyph->metrics.vertAdvance = advanceY << 6; + glyph->metrics.horiAdvance = FT_MulFix( advanceX, x_scale ); + glyph->metrics.vertAdvance = FT_MulFix( advanceY, y_scale ); return error; } diff --git a/lib/freetype/src/truetype/ttgload.h b/lib/freetype/src/truetype/ttgload.h index 3195351f7..f18637dce 100644 --- a/lib/freetype/src/truetype/ttgload.h +++ b/lib/freetype/src/truetype/ttgload.h @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/ttgxvar.c b/lib/freetype/src/truetype/ttgxvar.c index 6a0edef29..af76d298d 100644 --- a/lib/freetype/src/truetype/ttgxvar.c +++ b/lib/freetype/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. * * This file is part of the FreeType project, and may only be used, @@ -42,6 +42,7 @@ #include <ft2build.h> #include <freetype/internal/ftdebug.h> #include FT_CONFIG_CONFIG_H +#include <freetype/internal/ftcalc.h> #include <freetype/internal/ftstream.h> #include <freetype/internal/sfnt.h> #include <freetype/tttags.h> @@ -353,15 +354,24 @@ static void ft_var_load_avar( TT_Face face ) { - FT_Stream stream = FT_FACE_STREAM( face ); - FT_Memory memory = stream->memory; + FT_Error error; + FT_Stream stream = FT_FACE_STREAM( face ); + FT_Memory memory = stream->memory; + FT_Int i, j; + GX_Blend blend = face->blend; GX_AVarSegment segment; - FT_Error error; - FT_Long version; - FT_Long axisCount; - FT_Int i, j; - FT_ULong table_len; + GX_AVarTable table; + + FT_Long version; + FT_Long axisCount; + FT_ULong table_len; + +#ifndef TT_CONFIG_OPTION_NO_BORING_EXPANSION + FT_ULong table_offset; + FT_ULong store_offset; + FT_ULong axisMap_offset; +#endif FT_TRACE2(( "AVAR " )); @@ -374,13 +384,21 @@ return; } +#ifndef TT_CONFIG_OPTION_NO_BORING_EXPANSION + table_offset = FT_STREAM_POS(); +#endif + if ( FT_FRAME_ENTER( table_len ) ) return; version = FT_GET_LONG(); axisCount = FT_GET_LONG(); - if ( version != 0x00010000L ) + if ( version != 0x00010000L +#ifndef TT_CONFIG_OPTION_NO_BORING_EXPANSION + && version != 0x00020000L +#endif + ) { FT_TRACE2(( "bad table version\n" )); goto Exit; @@ -396,10 +414,14 @@ goto Exit; } - if ( FT_QNEW_ARRAY( blend->avar_segment, axisCount ) ) + if ( FT_NEW( blend->avar_table ) ) goto Exit; + table = blend->avar_table; - segment = &blend->avar_segment[0]; + if ( FT_QNEW_ARRAY( table->avar_segment, axisCount ) ) + goto Exit; + + segment = &table->avar_segment[0]; for ( i = 0; i < axisCount; i++, segment++ ) { FT_TRACE5(( " axis %d:\n", i )); @@ -412,9 +434,9 @@ /* it right now since loading the `avar' table is optional. */ for ( j = i - 1; j >= 0; j-- ) - FT_FREE( blend->avar_segment[j].correspondence ); + FT_FREE( table->avar_segment[j].correspondence ); - FT_FREE( blend->avar_segment ); + FT_FREE( table->avar_segment ); goto Exit; } @@ -426,20 +448,51 @@ FT_fdot14ToFixed( FT_GET_SHORT() ); FT_TRACE5(( " mapping %.5f to %.5f\n", - segment->correspondence[j].fromCoord / 65536.0, - segment->correspondence[j].toCoord / 65536.0 )); + (double)segment->correspondence[j].fromCoord / 65536, + (double)segment->correspondence[j].toCoord / 65536 )); } FT_TRACE5(( "\n" )); } +#ifndef TT_CONFIG_OPTION_NO_BORING_EXPANSION + if ( version < 0x00020000L ) + goto Exit; + + axisMap_offset = FT_GET_ULONG(); + store_offset = FT_GET_ULONG(); + + if ( store_offset ) + { + error = tt_var_load_item_variation_store( + face, + table_offset + store_offset, + &table->itemStore ); + if ( error ) + goto Exit; + } + + if ( axisMap_offset ) + { + error = tt_var_load_delta_set_index_mapping( + face, + table_offset + axisMap_offset, + &table->axisMap, + &table->itemStore, + table_len ); + if ( error ) + goto Exit; + } +#endif + + Exit: FT_FRAME_EXIT(); } - static FT_Error - ft_var_load_item_variation_store( TT_Face face, + FT_LOCAL_DEF( FT_Error ) + tt_var_load_item_variation_store( TT_Face face, FT_ULong offset, GX_ItemVarStore itemStore ) { @@ -449,13 +502,15 @@ FT_Error error; FT_UShort format; FT_ULong region_offset; - FT_UInt i, j, k; - FT_UInt wordDeltaCount; - FT_Bool long_words; - GX_Blend blend = face->blend; - GX_ItemVarData varData; + FT_UInt data_count; + FT_UShort axis_count; + FT_UInt region_count; + + FT_UInt i, j, k; + FT_Bool long_words; + GX_Blend blend = face->blend; FT_ULong* dataOffsetArray = NULL; @@ -465,31 +520,31 @@ if ( format != 1 ) { - FT_TRACE2(( "ft_var_load_item_variation_store: bad store format %d\n", + FT_TRACE2(( "tt_var_load_item_variation_store: bad store format %d\n", format )); error = FT_THROW( Invalid_Table ); goto Exit; } /* read top level fields */ - if ( FT_READ_ULONG( region_offset ) || - FT_READ_USHORT( itemStore->dataCount ) ) + if ( FT_READ_ULONG( region_offset ) || + FT_READ_USHORT( data_count ) ) goto Exit; /* we need at least one entry in `itemStore->varData' */ - if ( !itemStore->dataCount ) + if ( !data_count ) { - FT_TRACE2(( "ft_var_load_item_variation_store: missing varData\n" )); + FT_TRACE2(( "tt_var_load_item_variation_store: missing varData\n" )); error = FT_THROW( Invalid_Table ); goto Exit; } /* make temporary copy of item variation data offsets; */ /* we will parse region list first, then come back */ - if ( FT_QNEW_ARRAY( dataOffsetArray, itemStore->dataCount ) ) + if ( FT_QNEW_ARRAY( dataOffsetArray, data_count ) ) goto Exit; - for ( i = 0; i < itemStore->dataCount; i++ ) + for ( i = 0; i < data_count; i++ ) { if ( FT_READ_ULONG( dataOffsetArray[i] ) ) goto Exit; @@ -499,39 +554,40 @@ if ( FT_STREAM_SEEK( offset + region_offset ) ) goto Exit; - if ( FT_READ_USHORT( itemStore->axisCount ) || - FT_READ_USHORT( itemStore->regionCount ) ) + if ( FT_READ_USHORT( axis_count ) || + FT_READ_USHORT( region_count ) ) goto Exit; - if ( itemStore->axisCount != (FT_Long)blend->mmvar->num_axis ) + if ( axis_count != (FT_Long)blend->mmvar->num_axis ) { - FT_TRACE2(( "ft_var_load_item_variation_store:" + FT_TRACE2(( "tt_var_load_item_variation_store:" " number of axes in item variation store\n" )); FT_TRACE2(( " " " and `fvar' table are different\n" )); error = FT_THROW( Invalid_Table ); goto Exit; } + itemStore->axisCount = axis_count; /* new constraint in OpenType 1.8.4 */ - if ( itemStore->regionCount >= 32768U ) + if ( region_count >= 32768U ) { - FT_TRACE2(( "ft_var_load_item_variation_store:" + FT_TRACE2(( "tt_var_load_item_variation_store:" " too many variation region tables\n" )); error = FT_THROW( Invalid_Table ); goto Exit; } - if ( FT_NEW_ARRAY( itemStore->varRegionList, itemStore->regionCount ) ) + if ( FT_NEW_ARRAY( itemStore->varRegionList, region_count ) ) goto Exit; + itemStore->regionCount = region_count; for ( i = 0; i < itemStore->regionCount; i++ ) { GX_AxisCoords axisCoords; - if ( FT_NEW_ARRAY( itemStore->varRegionList[i].axisList, - itemStore->axisCount ) ) + if ( FT_NEW_ARRAY( itemStore->varRegionList[i].axisList, axis_count ) ) goto Exit; axisCoords = itemStore->varRegionList[i].axisList; @@ -555,47 +611,53 @@ /* end of region list parse */ /* use dataOffsetArray now to parse varData items */ - if ( FT_NEW_ARRAY( itemStore->varData, itemStore->dataCount ) ) + if ( FT_NEW_ARRAY( itemStore->varData, data_count ) ) goto Exit; + itemStore->dataCount = data_count; - for ( i = 0; i < itemStore->dataCount; i++ ) + for ( i = 0; i < data_count; i++ ) { - varData = &itemStore->varData[i]; + GX_ItemVarData varData = &itemStore->varData[i]; + + FT_UInt item_count; + FT_UInt word_delta_count; + FT_UInt region_idx_count; + if ( FT_STREAM_SEEK( offset + dataOffsetArray[i] ) ) goto Exit; - if ( FT_READ_USHORT( varData->itemCount ) || - FT_READ_USHORT( wordDeltaCount ) || - FT_READ_USHORT( varData->regionIdxCount ) ) + if ( FT_READ_USHORT( item_count ) || + FT_READ_USHORT( word_delta_count ) || + FT_READ_USHORT( region_idx_count ) ) goto Exit; - long_words = !!( wordDeltaCount & 0x8000 ); - wordDeltaCount &= 0x7FFF; + long_words = !!( word_delta_count & 0x8000 ); + word_delta_count &= 0x7FFF; /* check some data consistency */ - if ( wordDeltaCount > varData->regionIdxCount ) + if ( word_delta_count > region_idx_count ) { FT_TRACE2(( "bad short count %d or region count %d\n", - wordDeltaCount, - varData->regionIdxCount )); + word_delta_count, + region_idx_count )); error = FT_THROW( Invalid_Table ); goto Exit; } - if ( varData->regionIdxCount > itemStore->regionCount ) + if ( region_idx_count > itemStore->regionCount ) { FT_TRACE2(( "inconsistent regionCount %d in varData[%d]\n", - varData->regionIdxCount, + region_idx_count, i )); error = FT_THROW( Invalid_Table ); goto Exit; } /* parse region indices */ - if ( FT_NEW_ARRAY( varData->regionIndices, - varData->regionIdxCount ) ) + if ( FT_NEW_ARRAY( varData->regionIndices, region_idx_count ) ) goto Exit; + varData->regionIdxCount = region_idx_count; for ( j = 0; j < varData->regionIdxCount; j++ ) { @@ -611,54 +673,35 @@ } } - /* Parse delta set. */ - /* */ - /* On input, deltas are (wordDeltaCount + regionIdxCount) bytes */ - /* each if `long_words` isn't set, and twice as much otherwise. */ - /* */ - /* On output, deltas are expanded to `regionIdxCount` shorts each. */ - if ( FT_NEW_ARRAY( varData->deltaSet, - varData->regionIdxCount * varData->itemCount ) ) + /* Parse delta set. */ + /* */ + /* On input, deltas are (word_delta_count + region_idx_count) bytes */ + /* each if `long_words` isn't set, and twice as much otherwise. */ + /* */ + /* On output, deltas are expanded to `region_idx_count` shorts each. */ + if ( FT_NEW_ARRAY( varData->deltaSet, item_count * region_idx_count ) ) goto Exit; + varData->itemCount = item_count; - /* the delta set is stored as a 2-dimensional array of shorts */ - if ( long_words ) + for ( j = 0; j < item_count * region_idx_count; ) { - /* new in OpenType 1.9, currently for 'COLR' table only; */ - /* the deltas are interpreted as 16.16 fixed-point scaling values */ - - /* not supported yet */ - - error = FT_THROW( Invalid_Table ); - goto Exit; - } - else - { - for ( j = 0; j < varData->itemCount * varData->regionIdxCount; ) + if ( long_words ) { - for ( k = 0; k < wordDeltaCount; k++, j++ ) - { - /* read the short deltas */ - FT_Short delta; - - - if ( FT_READ_SHORT( delta ) ) + for ( k = 0; k < word_delta_count; k++, j++ ) + if ( FT_READ_LONG( varData->deltaSet[j] ) ) goto Exit; - - varData->deltaSet[j] = delta; - } - - for ( ; k < varData->regionIdxCount; k++, j++ ) - { - /* read the (signed) byte deltas */ - FT_Char delta; - - - if ( FT_READ_CHAR( delta ) ) + for ( ; k < region_idx_count; k++, j++ ) + if ( FT_READ_SHORT( varData->deltaSet[j] ) ) + goto Exit; + } + else + { + for ( k = 0; k < word_delta_count; k++, j++ ) + if ( FT_READ_SHORT( varData->deltaSet[j] ) ) + goto Exit; + for ( ; k < region_idx_count; k++, j++ ) + if ( FT_READ_CHAR( varData->deltaSet[j] ) ) goto Exit; - - varData->deltaSet[j] = delta; - } } } } @@ -670,8 +713,8 @@ } - static FT_Error - ft_var_load_delta_set_index_mapping( TT_Face face, + FT_LOCAL_DEF( FT_Error ) + tt_var_load_delta_set_index_mapping( TT_Face face, FT_ULong offset, GX_DeltaSetIdxMap map, GX_ItemVarStore itemStore, @@ -728,7 +771,7 @@ /* rough sanity check */ if ( map->mapCount * entrySize > table_len ) { - FT_TRACE1(( "ft_var_load_delta_set_index_mapping:" + FT_TRACE1(( "tt_var_load_delta_set_index_mapping:" " invalid number of delta-set index mappings\n" )); error = FT_THROW( Invalid_Table ); goto Exit; @@ -758,6 +801,16 @@ mapData = ( mapData << 8 ) | data; } + /* new in OpenType 1.8.4 */ + if ( mapData == 0xFFFFFFFFUL ) + { + /* no variation data for this item */ + map->outerIndex[i] = 0xFFFFU; + map->innerIndex[i] = 0xFFFFU; + + continue; + } + outerIndex = mapData >> innerBitCount; if ( outerIndex >= itemStore->dataCount ) @@ -887,7 +940,7 @@ table = blend->hvar_table; } - error = ft_var_load_item_variation_store( + error = tt_var_load_item_variation_store( face, table_offset + store_offset, &table->itemStore ); @@ -896,7 +949,7 @@ if ( widthMap_offset ) { - error = ft_var_load_delta_set_index_mapping( + error = tt_var_load_delta_set_index_mapping( face, table_offset + widthMap_offset, &table->widthMap, @@ -938,26 +991,47 @@ } - static FT_Int - ft_var_get_item_delta( TT_Face face, + FT_LOCAL_DEF( FT_ItemVarDelta ) + tt_var_get_item_delta( TT_Face face, GX_ItemVarStore itemStore, FT_UInt outerIndex, FT_UInt innerIndex ) { - GX_ItemVarData varData; - FT_Short* deltaSet; + FT_Stream stream = FT_FACE_STREAM( face ); + FT_Memory memory = stream->memory; + FT_Error error = FT_Err_Ok; + + GX_ItemVarData varData; + FT_ItemVarDelta* deltaSet; - FT_UInt master, j; - FT_Fixed netAdjustment = 0; /* accumulated adjustment */ - FT_Fixed scaledDelta; - FT_Fixed delta; + FT_UInt master, j; + FT_Fixed* scalars = NULL; + FT_ItemVarDelta returnValue; + if ( !face->blend || !face->blend->normalizedcoords ) + return 0; + + /* OpenType 1.8.4+: No variation data for this item */ + /* as indices have special value 0xFFFF. */ + if ( outerIndex == 0xFFFF && innerIndex == 0xFFFF ) + return 0; + /* See pseudo code from `Font Variations Overview' */ /* in the OpenType specification. */ + if ( outerIndex >= itemStore->dataCount ) + return 0; /* Out of range. */ + varData = &itemStore->varData[outerIndex]; - deltaSet = &varData->deltaSet[varData->regionIdxCount * innerIndex]; + deltaSet = FT_OFFSET( varData->deltaSet, + varData->regionIdxCount * innerIndex ); + + if ( innerIndex >= varData->itemCount ) + return 0; /* Out of range. */ + + if ( FT_QNEW_ARRAY( scalars, varData->regionIdxCount ) ) + return 0; /* outer loop steps through master designs to be blended */ for ( master = 0; master < varData->regionIdxCount; master++ ) @@ -1008,18 +1082,33 @@ FT_MulDiv( scalar, axis->endCoord - face->blend->normalizedcoords[j], axis->endCoord - axis->peakCoord ); - } /* per-axis loop */ - /* get the scaled delta for this region */ - delta = FT_intToFixed( deltaSet[master] ); - scaledDelta = FT_MulFix( scalar, delta ); + } /* per-axis loop */ - /* accumulate the adjustments from each region */ - netAdjustment = netAdjustment + scaledDelta; + scalars[master] = scalar; } /* per-region loop */ - return FT_fixedToInt( netAdjustment ); + + /* 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 ); + + FT_FREE( scalars ); + + return returnValue; } @@ -1112,35 +1201,29 @@ } else { - GX_ItemVarData varData; - - /* no widthMap data */ outerIndex = 0; innerIndex = gindex; - - varData = &table->itemStore.varData[outerIndex]; - if ( gindex >= varData->itemCount ) - { - FT_TRACE2(( "gindex %d out of range\n", gindex )); - error = FT_THROW( Invalid_Argument ); - goto Exit; - } } - delta = ft_var_get_item_delta( face, + delta = tt_var_get_item_delta( face, &table->itemStore, outerIndex, innerIndex ); - FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n", - vertical ? "vertical height" : "horizontal width", - *avalue, - delta, - delta == 1 ? "" : "s", - vertical ? "VVAR" : "HVAR" )); - - *avalue += delta; + if ( delta ) + { + FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n", + vertical ? "vertical height" : "horizontal width", + *avalue, + delta, + delta == 1 ? "" : "s", + vertical ? "VVAR" : "HVAR" )); + + // *avalue = ADD_INT( *avalue, delta ); + *avalue += delta; + bug; + } Exit: return error; @@ -1307,7 +1390,7 @@ records_offset = FT_STREAM_POS(); - error = ft_var_load_item_variation_store( + error = tt_var_load_item_variation_store( face, table_offset + store_offset, &blend->mvar_table->itemStore ); @@ -1323,7 +1406,7 @@ return; value = blend->mvar_table->values; - limit = value + blend->mvar_table->valueCount; + limit = FT_OFFSET( value, blend->mvar_table->valueCount ); itemStore = &blend->mvar_table->itemStore; for ( ; value < limit; value++ ) @@ -1332,6 +1415,13 @@ value->outerIndex = FT_GET_USHORT(); value->innerIndex = FT_GET_USHORT(); + /* new in OpenType 1.8.4 */ + if ( value->outerIndex == 0xFFFFU && value->innerIndex == 0xFFFFU ) + { + /* no variation data for this item */ + continue; + } + if ( value->outerIndex >= itemStore->dataCount || value->innerIndex >= itemStore->varData[value->outerIndex] .itemCount ) @@ -1349,7 +1439,7 @@ FT_TRACE2(( "loaded\n" )); value = blend->mvar_table->values; - limit = value + blend->mvar_table->valueCount; + limit = FT_OFFSET( value, blend->mvar_table->valueCount ); /* save original values of the data MVAR is going to modify */ for ( ; value < limit; value++ ) @@ -1414,7 +1504,7 @@ return; value = blend->mvar_table->values; - limit = value + blend->mvar_table->valueCount; + limit = FT_OFFSET( value, blend->mvar_table->valueCount ); for ( ; value < limit; value++ ) { @@ -1422,12 +1512,12 @@ FT_Int delta; - delta = ft_var_get_item_delta( face, + delta = tt_var_get_item_delta( face, &blend->mvar_table->itemStore, value->outerIndex, value->innerIndex ); - if ( p ) + if ( p && delta ) { FT_TRACE5(( "value %c%c%c%c (%d unit%s) adjusted by %d unit%s (MVAR)\n", (FT_Char)( value->tag >> 24 ), @@ -1725,7 +1815,7 @@ blend->tuplecoords[i * gvar_head.axisCount + j] = FT_fdot14ToFixed( FT_GET_SHORT() ); FT_TRACE5(( "%.5f ", - blend->tuplecoords[i * gvar_head.axisCount + j] / 65536.0 )); + (double)blend->tuplecoords[i * gvar_head.axisCount + j] / 65536 )); } FT_TRACE5(( "]\n" )); } @@ -1796,7 +1886,7 @@ for ( i = 0; i < blend->num_axis; i++ ) { FT_TRACE6(( " axis %d coordinate %.5f:\n", - i, blend->normalizedcoords[i] / 65536.0 )); + i, (double)blend->normalizedcoords[i] / 65536 )); /* It's not clear why (for intermediate tuples) we don't need */ /* to check against start/end -- the documentation says we don't. */ @@ -1819,7 +1909,7 @@ if ( blend->normalizedcoords[i] == tuple_coords[i] ) { FT_TRACE6(( " tuple coordinate %.5f fits perfectly\n", - tuple_coords[i] / 65536.0 )); + (double)tuple_coords[i] / 65536 )); /* `apply' does not change */ continue; } @@ -1832,13 +1922,13 @@ blend->normalizedcoords[i] > FT_MAX( 0, tuple_coords[i] ) ) { FT_TRACE6(( " tuple coordinate %.5f is exceeded, stop\n", - tuple_coords[i] / 65536.0 )); + (double)tuple_coords[i] / 65536 )); apply = 0; break; } FT_TRACE6(( " tuple coordinate %.5f fits\n", - tuple_coords[i] / 65536.0 )); + (double)tuple_coords[i] / 65536 )); apply = FT_MulDiv( apply, blend->normalizedcoords[i], tuple_coords[i] ); @@ -1852,15 +1942,15 @@ { FT_TRACE6(( " intermediate tuple range ]%.5f;%.5f[ is exceeded," " stop\n", - im_start_coords[i] / 65536.0, - im_end_coords[i] / 65536.0 )); + (double)im_start_coords[i] / 65536, + (double)im_end_coords[i] / 65536 )); apply = 0; break; } FT_TRACE6(( " intermediate tuple range ]%.5f;%.5f[ fits\n", - im_start_coords[i] / 65536.0, - im_end_coords[i] / 65536.0 )); + (double)im_start_coords[i] / 65536, + (double)im_end_coords[i] / 65536 )); if ( blend->normalizedcoords[i] < tuple_coords[i] ) apply = FT_MulDiv( apply, blend->normalizedcoords[i] - im_start_coords[i], @@ -1872,7 +1962,7 @@ } } - FT_TRACE6(( " apply factor is %.5f\n", apply / 65536.0 )); + FT_TRACE6(( " apply factor is %.5f\n", (double)apply / 65536 )); return apply; } @@ -1886,12 +1976,18 @@ FT_Fixed* coords, FT_Fixed* normalized ) { + FT_Error error = FT_Err_Ok; + FT_Memory memory = face->root.memory; + FT_UInt i, j; + GX_Blend blend; FT_MM_Var* mmvar; - FT_UInt i, j; FT_Var_Axis* a; GX_AVarSegment av; + FT_Fixed* new_normalized = NULL; + FT_Fixed* old_normalized; + blend = face->blend; mmvar = blend->mmvar; @@ -1914,15 +2010,15 @@ FT_Fixed coord = coords[i]; - FT_TRACE5(( " %d: %.5f\n", i, coord / 65536.0 )); + FT_TRACE5(( " %d: %.5f\n", i, (double)coord / 65536 )); if ( coord > a->maximum || coord < a->minimum ) { FT_TRACE1(( "ft_var_to_normalized: design coordinate %.5f\n", - coord / 65536.0 )); + (double)coord / 65536 )); FT_TRACE1(( " is out of range [%.5f;%.5f];" " clamping\n", - a->minimum / 65536.0, - a->maximum / 65536.0 )); + (double)a->minimum / 65536, + (double)a->maximum / 65536 )); } if ( coord > a->def ) @@ -1942,30 +2038,91 @@ for ( ; i < mmvar->num_axis; i++ ) normalized[i] = 0; - if ( blend->avar_segment ) + if ( blend->avar_table ) { + GX_AVarTable table = blend->avar_table; + + FT_TRACE5(( "normalized design coordinates" " before applying `avar' data:\n" )); - av = blend->avar_segment; - for ( i = 0; i < mmvar->num_axis; i++, av++ ) + if ( table->avar_segment ) { - for ( j = 1; j < (FT_UInt)av->pairCount; j++ ) + av = table->avar_segment; + + for ( i = 0; i < mmvar->num_axis; i++, av++ ) { - if ( normalized[i] < av->correspondence[j].fromCoord ) + for ( j = 1; j < (FT_UInt)av->pairCount; j++ ) { - FT_TRACE5(( " %.5f\n", normalized[i] / 65536.0 )); + if ( normalized[i] < av->correspondence[j].fromCoord ) + { + FT_TRACE5(( " %.5f\n", (double)normalized[i] / 65536 )); + + normalized[i] = + FT_MulDiv( normalized[i] - av->correspondence[j - 1].fromCoord, + av->correspondence[j].toCoord - + av->correspondence[j - 1].toCoord, + av->correspondence[j].fromCoord - + av->correspondence[j - 1].fromCoord ) + + av->correspondence[j - 1].toCoord; + break; + } + } + } + } - normalized[i] = - FT_MulDiv( normalized[i] - av->correspondence[j - 1].fromCoord, - av->correspondence[j].toCoord - - av->correspondence[j - 1].toCoord, - av->correspondence[j].fromCoord - - av->correspondence[j - 1].fromCoord ) + - av->correspondence[j - 1].toCoord; - break; + if ( table->itemStore.varData ) + { + if ( FT_QNEW_ARRAY( new_normalized, mmvar->num_axis ) ) + return; + + /* Install our half-normalized coordinates for the next */ + /* Item Variation Store to work with. */ + old_normalized = face->blend->normalizedcoords; + face->blend->normalizedcoords = normalized; + + for ( i = 0; i < mmvar->num_axis; i++ ) + { + FT_Fixed v = normalized[i]; + FT_UInt innerIndex = i; + FT_UInt outerIndex = 0; + FT_Int delta; + + + if ( table->axisMap.innerIndex ) + { + FT_UInt idx = i; + + + if ( idx >= table->axisMap.mapCount ) + idx = table->axisMap.mapCount - 1; + + outerIndex = table->axisMap.outerIndex[idx]; + innerIndex = table->axisMap.innerIndex[idx]; } + + delta = tt_var_get_item_delta( face, + &table->itemStore, + outerIndex, + innerIndex ); + + v += delta << 2; + + /* Clamp value range. */ + v = v >= 0x10000L ? 0x10000 : v; + v = v <= -0x10000L ? -0x10000 : v; + + new_normalized[i] = v; + } + + for ( i = 0; i < mmvar->num_axis; i++ ) + { + normalized[i] = new_normalized[i]; } + + face->blend->normalizedcoords = old_normalized; + + FT_FREE( new_normalized ); } } } @@ -2003,9 +2160,9 @@ for ( ; i < num_coords; i++ ) design[i] = 0; - if ( blend->avar_segment ) + if ( blend->avar_table && blend->avar_table->avar_segment ) { - GX_AVarSegment av = blend->avar_segment; + GX_AVarSegment av = blend->avar_table->avar_segment; FT_TRACE5(( "design coordinates" @@ -2025,7 +2182,7 @@ av->correspondence[j - 1].toCoord ) + av->correspondence[j - 1].fromCoord; - FT_TRACE5(( " %.5f\n", design[i] / 65536.0 )); + FT_TRACE5(( " %.5f\n", (double)design[i] / 65536 )); break; } } @@ -2170,6 +2327,11 @@ FT_FRAME_END }; + /* `num_instances` holds the number of all named instances including */ + /* the default instance, which might be missing in the table of named */ + /* instances (in 'fvar'). This value is validated in `sfobjs.c` and */ + /* may be reset to 0 if consistency checks fail. */ + num_instances = (FT_UInt)face->root.style_flags >> 16; /* read the font data and set up the internal representation */ /* if not already done */ @@ -2180,20 +2342,6 @@ { FT_TRACE2(( "FVAR " )); - /* both `fvar' and `gvar' must be present */ - if ( FT_SET_ERROR( face->goto_table( face, TTAG_gvar, - stream, &table_len ) ) ) - { - /* CFF2 is an alternate to gvar here */ - if ( FT_SET_ERROR( face->goto_table( face, TTAG_CFF2, - stream, &table_len ) ) ) - { - FT_TRACE1(( "\n" )); - FT_TRACE1(( "TT_Get_MM_Var: `gvar' or `CFF2' table is missing\n" )); - goto Exit; - } - } - if ( FT_SET_ERROR( face->goto_table( face, TTAG_fvar, stream, &table_len ) ) ) { @@ -2208,6 +2356,17 @@ if ( FT_STREAM_READ_FIELDS( fvar_fields, &fvar_head ) ) goto Exit; + /* If `num_instances` is larger, synthetization of the default */ + /* instance is required. If `num_instances` is smaller, */ + /* however, the value has been reset to 0 in `sfnt_init_face` */ + /* (in `sfobjs.c`); in this case we have underallocated `mmvar` */ + /* structs. */ + if ( num_instances < fvar_head.instanceCount ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + usePsName = FT_BOOL( fvar_head.instanceSize == 6 + 4 * fvar_head.axisCount ); @@ -2226,11 +2385,6 @@ else num_axes = face->blend->num_axis; - /* `num_instances' holds the number of all named instances, */ - /* including the default instance which might be missing */ - /* in fvar's table of named instances */ - num_instances = (FT_UInt)face->root.style_flags >> 16; - /* prepare storage area for MM data; this cannot overflow */ /* 32-bit arithmetic because of the size limits used in the */ /* `fvar' table validity check in `sfnt_init_face' */ @@ -2358,9 +2512,9 @@ " %10.5f %10.5f %10.5f 0x%04X%s\n", i, a->name, - a->minimum / 65536.0, - a->def / 65536.0, - a->maximum / 65536.0, + (double)a->minimum / 65536, + (double)a->def / 65536, + (double)a->maximum / 65536, *axis_flags, invalid ? " (invalid, disabled)" : "" )); #endif @@ -2561,6 +2715,8 @@ a->name = (char*)"OpticalSize"; else if ( a->tag == TTAG_slnt ) a->name = (char*)"Slant"; + else if ( a->tag == TTAG_ital ) + a->name = (char*)"Italic"; next_name += 5; a++; @@ -2622,11 +2778,11 @@ for ( i = 0; i < num_coords; i++ ) { - FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 )); + FT_TRACE5(( " %.5f\n", (double)coords[i] / 65536 )); if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L ) { FT_TRACE1(( "TT_Set_MM_Blend: normalized design coordinate %.5f\n", - coords[i] / 65536.0 )); + (double)coords[i] / 65536 )); FT_TRACE1(( " is out of range [-1;1]\n" )); error = FT_THROW( Invalid_Argument ); goto Exit; @@ -2636,8 +2792,16 @@ FT_TRACE5(( "\n" )); if ( !face->is_cff2 && !blend->glyphoffsets ) - if ( FT_SET_ERROR( ft_var_load_gvar( face ) ) ) + { + /* While a missing 'gvar' table is acceptable, for example for */ + /* fonts that only vary metrics information or 'COLR' v1 */ + /* `PaintVar*` tables, an incorrect SFNT table offset or size */ + /* for 'gvar', or an inconsistent 'gvar' table is not. */ + error = ft_var_load_gvar( face ); + if ( error != FT_Err_Table_Missing && error != FT_Err_Ok ) goto Exit; + error = FT_Err_Ok; + } if ( !blend->coords ) { @@ -3503,10 +3667,10 @@ { FT_TRACE7(( " %d: %f -> %f\n", j, - ( FT_fdot6ToFixed( face->cvt[j] ) + - old_cvt_delta ) / 65536.0, - ( FT_fdot6ToFixed( face->cvt[j] ) + - cvt_deltas[j] ) / 65536.0 )); + (double)( FT_fdot6ToFixed( face->cvt[j] ) + + old_cvt_delta ) / 65536, + (double)( FT_fdot6ToFixed( face->cvt[j] ) + + cvt_deltas[j] ) / 65536 )); count++; } #endif @@ -3545,10 +3709,10 @@ { FT_TRACE7(( " %d: %f -> %f\n", pindex, - ( FT_fdot6ToFixed( face->cvt[pindex] ) + - old_cvt_delta ) / 65536.0, - ( FT_fdot6ToFixed( face->cvt[pindex] ) + - cvt_deltas[pindex] ) / 65536.0 )); + (double)( FT_fdot6ToFixed( face->cvt[pindex] ) + + old_cvt_delta ) / 65536, + (double)( FT_fdot6ToFixed( face->cvt[pindex] ) + + cvt_deltas[pindex] ) / 65536 )); count++; } #endif @@ -3813,20 +3977,12 @@ * @Description: * Apply the appropriate deltas to the current glyph. * - * @Input: - * face :: - * A handle to the target face object. - * - * glyph_index :: - * The index of the glyph being modified. - * - * n_points :: - * The number of the points in the glyph, including - * phantom points. - * * @InOut: + * loader :: + * A handle to the loader object. + * * outline :: - * The outline to change. + * The outline to change, with appended phantom points. * * @Output: * unrounded :: @@ -3837,15 +3993,16 @@ * FreeType error code. 0 means success. */ FT_LOCAL_DEF( FT_Error ) - TT_Vary_Apply_Glyph_Deltas( TT_Face face, - FT_UInt glyph_index, + TT_Vary_Apply_Glyph_Deltas( TT_Loader loader, FT_Outline* outline, - FT_Vector* unrounded, - FT_UInt n_points ) + FT_Vector* unrounded ) { FT_Error error; - FT_Stream stream = face->root.stream; - FT_Memory memory = stream->memory; + TT_Face face = loader->face; + FT_Stream stream = face->root.stream; + FT_Memory memory = stream->memory; + FT_UInt glyph_index = loader->glyph_index; + FT_UInt n_points = (FT_UInt)outline->n_points + 4; FT_Vector* points_org = NULL; /* coordinates in 16.16 format */ FT_Vector* points_out = NULL; /* coordinates in 16.16 format */ @@ -4063,50 +4220,22 @@ FT_Fixed point_delta_y = FT_MulFix( deltas_y[j], apply ); - if ( j < n_points - 4 ) - { - point_deltas_x[j] = old_point_delta_x + point_delta_x; - point_deltas_y[j] = old_point_delta_y + point_delta_y; - } - else - { - /* To avoid double adjustment of advance width or height, */ - /* adjust phantom points only if there is no HVAR or VVAR */ - /* support, respectively. */ - if ( j == ( n_points - 4 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_LSB ) ) - point_deltas_x[j] = old_point_delta_x + point_delta_x; - - else if ( j == ( n_points - 3 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_HADVANCE ) ) - point_deltas_x[j] = old_point_delta_x + point_delta_x; - - else if ( j == ( n_points - 2 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_TSB ) ) - point_deltas_y[j] = old_point_delta_y + point_delta_y; - - else if ( j == ( n_points - 1 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_VADVANCE ) ) - point_deltas_y[j] = old_point_delta_y + point_delta_y; - } + point_deltas_x[j] = old_point_delta_x + point_delta_x; + point_deltas_y[j] = old_point_delta_y + point_delta_y; #ifdef FT_DEBUG_LEVEL_TRACE if ( point_delta_x || point_delta_y ) { FT_TRACE7(( " %d: (%f, %f) -> (%f, %f)\n", j, - ( FT_intToFixed( outline->points[j].x ) + - old_point_delta_x ) / 65536.0, - ( FT_intToFixed( outline->points[j].y ) + - old_point_delta_y ) / 65536.0, - ( FT_intToFixed( outline->points[j].x ) + - point_deltas_x[j] ) / 65536.0, - ( FT_intToFixed( outline->points[j].y ) + - point_deltas_y[j] ) / 65536.0 )); + (double)( FT_intToFixed( outline->points[j].x ) + + old_point_delta_x ) / 65536, + (double)( FT_intToFixed( outline->points[j].y ) + + old_point_delta_y ) / 65536, + (double)( FT_intToFixed( outline->points[j].x ) + + point_deltas_x[j] ) / 65536, + (double)( FT_intToFixed( outline->points[j].y ) + + point_deltas_y[j] ) / 65536 )); count++; } #endif @@ -4165,50 +4294,22 @@ FT_Pos point_delta_y = points_out[j].y - points_org[j].y; - if ( j < n_points - 4 ) - { - point_deltas_x[j] = old_point_delta_x + point_delta_x; - point_deltas_y[j] = old_point_delta_y + point_delta_y; - } - else - { - /* To avoid double adjustment of advance width or height, */ - /* adjust phantom points only if there is no HVAR or VVAR */ - /* support, respectively. */ - if ( j == ( n_points - 4 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_LSB ) ) - point_deltas_x[j] = old_point_delta_x + point_delta_x; - - else if ( j == ( n_points - 3 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_HADVANCE ) ) - point_deltas_x[j] = old_point_delta_x + point_delta_x; - - else if ( j == ( n_points - 2 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_TSB ) ) - point_deltas_y[j] = old_point_delta_y + point_delta_y; - - else if ( j == ( n_points - 1 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_VADVANCE ) ) - point_deltas_y[j] = old_point_delta_y + point_delta_y; - } + point_deltas_x[j] = old_point_delta_x + point_delta_x; + point_deltas_y[j] = old_point_delta_y + point_delta_y; #ifdef FT_DEBUG_LEVEL_TRACE if ( point_delta_x || point_delta_y ) { FT_TRACE7(( " %d: (%f, %f) -> (%f, %f)\n", j, - ( FT_intToFixed( outline->points[j].x ) + - old_point_delta_x ) / 65536.0, - ( FT_intToFixed( outline->points[j].y ) + - old_point_delta_y ) / 65536.0, - ( FT_intToFixed( outline->points[j].x ) + - point_deltas_x[j] ) / 65536.0, - ( FT_intToFixed( outline->points[j].y ) + - point_deltas_y[j] ) / 65536.0 )); + (double)( FT_intToFixed( outline->points[j].x ) + + old_point_delta_x ) / 65536, + (double)( FT_intToFixed( outline->points[j].y ) + + old_point_delta_y ) / 65536, + (double)( FT_intToFixed( outline->points[j].x ) + + point_deltas_x[j] ) / 65536, + (double)( FT_intToFixed( outline->points[j].y ) + + point_deltas_y[j] ) / 65536 )); count++; } #endif @@ -4232,6 +4333,24 @@ FT_TRACE5(( "\n" )); + /* To avoid double adjustment of advance width or height, */ + /* do not move phantom points if there is HVAR or VVAR */ + /* support, respectively. */ + if ( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) + { + point_deltas_x[n_points - 4] = 0; + point_deltas_y[n_points - 4] = 0; + point_deltas_x[n_points - 3] = 0; + point_deltas_y[n_points - 3] = 0; + } + if ( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) + { + point_deltas_x[n_points - 2] = 0; + point_deltas_y[n_points - 2] = 0; + point_deltas_x[n_points - 1] = 0; + point_deltas_y[n_points - 1] = 0; + } + for ( i = 0; i < n_points; i++ ) { unrounded[i].x += FT_fixedToFdot6( point_deltas_x[i] ); @@ -4241,6 +4360,24 @@ outline->points[i].y += FT_fixedToInt( point_deltas_y[i] ); } + /* To avoid double adjustment of advance width or height, */ + /* adjust phantom points only if there is no HVAR or VVAR */ + /* support, respectively. */ + if ( !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + { + loader->pp1 = outline->points[n_points - 4]; + loader->pp2 = outline->points[n_points - 3]; + loader->linear = FT_PIX_ROUND( unrounded[n_points - 3].x - + unrounded[n_points - 4].x ) / 64; + } + if ( !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + { + loader->pp3 = outline->points[n_points - 2]; + loader->pp4 = outline->points[n_points - 1]; + loader->vadvance = FT_PIX_ROUND( unrounded[n_points - 1].y - + unrounded[n_points - 2].y ) / 64; + } + Fail3: FT_FREE( point_deltas_x ); FT_FREE( point_deltas_y ); @@ -4305,8 +4442,8 @@ } - static void - ft_var_done_item_variation_store( TT_Face face, + FT_LOCAL_DEF( void ) + tt_var_done_item_variation_store( TT_Face face, GX_ItemVarStore itemStore ) { FT_Memory memory = FT_FACE_MEMORY( face ); @@ -4334,6 +4471,18 @@ } + FT_LOCAL_DEF( void ) + tt_var_done_delta_set_index_map( TT_Face face, + GX_DeltaSetIdxMap deltaSetIdxMap ) + { + FT_Memory memory = FT_FACE_MEMORY( face ); + + + FT_FREE( deltaSetIdxMap->innerIndex ); + FT_FREE( deltaSetIdxMap->outerIndex ); + } + + /************************************************************************** * * @Function: @@ -4362,36 +4511,47 @@ FT_FREE( blend->normalized_stylecoords ); FT_FREE( blend->mmvar ); - if ( blend->avar_segment ) + if ( blend->avar_table ) { - for ( i = 0; i < num_axes; i++ ) - FT_FREE( blend->avar_segment[i].correspondence ); - FT_FREE( blend->avar_segment ); + if ( blend->avar_table->avar_segment ) + { + for ( i = 0; i < num_axes; i++ ) + FT_FREE( blend->avar_table->avar_segment[i].correspondence ); + FT_FREE( blend->avar_table->avar_segment ); + } + + tt_var_done_item_variation_store( face, + &blend->avar_table->itemStore ); + + tt_var_done_delta_set_index_map( face, + &blend->avar_table->axisMap ); + + FT_FREE( blend->avar_table ); } if ( blend->hvar_table ) { - ft_var_done_item_variation_store( face, + tt_var_done_item_variation_store( face, &blend->hvar_table->itemStore ); - FT_FREE( blend->hvar_table->widthMap.innerIndex ); - FT_FREE( blend->hvar_table->widthMap.outerIndex ); + tt_var_done_delta_set_index_map( face, + &blend->hvar_table->widthMap ); FT_FREE( blend->hvar_table ); } if ( blend->vvar_table ) { - ft_var_done_item_variation_store( face, + tt_var_done_item_variation_store( face, &blend->vvar_table->itemStore ); - FT_FREE( blend->vvar_table->widthMap.innerIndex ); - FT_FREE( blend->vvar_table->widthMap.outerIndex ); + tt_var_done_delta_set_index_map( face, + &blend->vvar_table->widthMap ); FT_FREE( blend->vvar_table ); } if ( blend->mvar_table ) { - ft_var_done_item_variation_store( face, + tt_var_done_item_variation_store( face, &blend->mvar_table->itemStore ); FT_FREE( blend->mvar_table->values ); diff --git a/lib/freetype/src/truetype/ttgxvar.h b/lib/freetype/src/truetype/ttgxvar.h index 17915f00d..4fec980dc 100644 --- a/lib/freetype/src/truetype/ttgxvar.h +++ b/lib/freetype/src/truetype/ttgxvar.h @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader (specification) * - * Copyright (C) 2004-2022 by + * Copyright (C) 2004-2023 by * David Turner, Robert Wilhelm, Werner Lemberg and George Williams. * * This file is part of the FreeType project, and may only be used, @@ -20,6 +20,7 @@ #define TTGXVAR_H_ +#include <freetype/internal/ftmmtypes.h> #include "ttobjs.h" @@ -62,55 +63,21 @@ FT_BEGIN_HEADER } GX_AVarSegmentRec, *GX_AVarSegment; - typedef struct GX_ItemVarDataRec_ - { - FT_UInt itemCount; /* number of delta sets per item */ - FT_UInt regionIdxCount; /* number of region indices in this data */ - FT_UInt* regionIndices; /* array of `regionCount' indices; */ - /* these index `varRegionList' */ - FT_Short* deltaSet; /* array of `itemCount' deltas */ - /* use `innerIndex' for this array */ - - } GX_ItemVarDataRec, *GX_ItemVarData; - - - /* contribution of one axis to a region */ - typedef struct GX_AxisCoordsRec_ - { - FT_Fixed startCoord; - FT_Fixed peakCoord; /* zero means no effect (factor = 1) */ - FT_Fixed endCoord; - - } GX_AxisCoordsRec, *GX_AxisCoords; - - - typedef struct GX_VarRegionRec_ - { - GX_AxisCoords axisList; /* array of axisCount records */ - - } GX_VarRegionRec, *GX_VarRegion; - - - /* item variation store */ - typedef struct GX_ItemVarStoreRec_ - { - FT_UInt dataCount; - GX_ItemVarData varData; /* array of dataCount records; */ - /* use `outerIndex' for this array */ - FT_UShort axisCount; - FT_UInt regionCount; /* total number of regions defined */ - GX_VarRegion varRegionList; - - } GX_ItemVarStoreRec, *GX_ItemVarStore; - - - typedef struct GX_DeltaSetIdxMapRec_ + /************************************************************************** + * + * @Struct: + * GX_AVarTableRec + * + * @Description: + * Data from the `avar' table. + */ + typedef struct GX_AVarTableRec_ { - FT_ULong mapCount; - FT_UInt* outerIndex; /* indices to item var data */ - FT_UInt* innerIndex; /* indices to delta set */ + GX_AVarSegment avar_segment; /* avar_segment[num_axis] */ + GX_ItemVarStoreRec itemStore; /* Item Variation Store */ + GX_DeltaSetIdxMapRec axisMap; /* Axis Mapping */ - } GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap; + } GX_AVarTableRec, *GX_AVarTable; /************************************************************************** @@ -245,7 +212,7 @@ FT_BEGIN_HEADER * A Boolean; if set, FreeType tried to load (and parse) the `avar' * table. * - * avar_segment :: + * avar_table :: * Data from the `avar' table. * * hvar_loaded :: @@ -310,7 +277,7 @@ FT_BEGIN_HEADER /* normalized_stylecoords[num_namedstyles][num_axis] */ FT_Bool avar_loaded; - GX_AVarSegment avar_segment; /* avar_segment[num_axis] */ + GX_AVarTable avar_table; FT_Bool hvar_loaded; FT_Bool hvar_checked; @@ -376,6 +343,7 @@ FT_BEGIN_HEADER #define TTAG_wdth FT_MAKE_TAG( 'w', 'd', 't', 'h' ) #define TTAG_opsz FT_MAKE_TAG( 'o', 'p', 's', 'z' ) #define TTAG_slnt FT_MAKE_TAG( 's', 'l', 'n', 't' ) +#define TTAG_ital FT_MAKE_TAG( 'i', 't', 'a', 'l' ) FT_LOCAL( FT_Error ) @@ -412,11 +380,9 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - TT_Vary_Apply_Glyph_Deltas( TT_Face face, - FT_UInt glyph_index, + TT_Vary_Apply_Glyph_Deltas( TT_Loader loader, FT_Outline* outline, - FT_Vector* unrounded, - FT_UInt n_points ); + FT_Vector* unrounded ); FT_LOCAL( FT_Error ) tt_hadvance_adjust( TT_Face face, @@ -431,6 +397,34 @@ FT_BEGIN_HEADER FT_LOCAL( void ) tt_apply_mvar( TT_Face face ); + + FT_LOCAL( FT_Error ) + tt_var_load_item_variation_store( TT_Face face, + FT_ULong offset, + GX_ItemVarStore itemStore ); + + FT_LOCAL( FT_Error ) + tt_var_load_delta_set_index_mapping( TT_Face face, + FT_ULong offset, + GX_DeltaSetIdxMap map, + GX_ItemVarStore itemStore, + FT_ULong table_len ); + + FT_LOCAL( FT_ItemVarDelta ) + tt_var_get_item_delta( TT_Face face, + GX_ItemVarStore itemStore, + FT_UInt outerIndex, + FT_UInt innerIndex ); + + FT_LOCAL( void ) + tt_var_done_item_variation_store( TT_Face face, + GX_ItemVarStore itemStore ); + + FT_LOCAL( void ) + tt_var_done_delta_set_index_map( TT_Face face, + GX_DeltaSetIdxMap deltaSetIdxMap ); + + FT_LOCAL( FT_Error ) tt_get_var_blend( TT_Face face, FT_UInt *num_coords, diff --git a/lib/freetype/src/truetype/ttinterp.c b/lib/freetype/src/truetype/ttinterp.c index e16565c3a..4fcfaa3e4 100644 --- a/lib/freetype/src/truetype/ttinterp.c +++ b/lib/freetype/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1527,9 +1527,8 @@ static void Modify_CVT_Check( TT_ExecContext exc ) { - /* TT_RunIns sets origCvt and restores cvt to origCvt when done. */ if ( exc->iniRange == tt_coderange_glyph && - exc->cvt == exc->origCvt ) + exc->cvt != exc->glyfCvt ) { exc->error = Update_Max( exc->memory, &exc->glyfCvtSize, @@ -3115,10 +3114,8 @@ } else { - /* TT_RunIns sets origStorage and restores storage to origStorage */ - /* when done. */ if ( exc->iniRange == tt_coderange_glyph && - exc->storage == exc->origStorage ) + exc->storage != exc->glyfStorage ) { FT_ULong tmp = (FT_ULong)exc->glyfStoreSize; @@ -6874,7 +6871,7 @@ static void - _iup_worker_shift( IUP_Worker worker, + iup_worker_shift_( IUP_Worker worker, FT_UInt p1, FT_UInt p2, FT_UInt p ) @@ -6896,7 +6893,7 @@ static void - _iup_worker_interpolate( IUP_Worker worker, + iup_worker_interpolate_( IUP_Worker worker, FT_UInt p1, FT_UInt p2, FT_UInt ref1, @@ -7090,7 +7087,7 @@ { if ( ( exc->pts.tags[point] & mask ) != 0 ) { - _iup_worker_interpolate( &V, + iup_worker_interpolate_( &V, cur_touched + 1, point - 1, cur_touched, @@ -7102,17 +7099,17 @@ } if ( cur_touched == first_touched ) - _iup_worker_shift( &V, first_point, end_point, cur_touched ); + iup_worker_shift_( &V, first_point, end_point, cur_touched ); else { - _iup_worker_interpolate( &V, + iup_worker_interpolate_( &V, (FT_UShort)( cur_touched + 1 ), end_point, cur_touched, first_touched ); if ( first_touched > 0 ) - _iup_worker_interpolate( &V, + iup_worker_interpolate_( &V, first_point, first_touched - 1, cur_touched, @@ -7832,8 +7829,6 @@ exc->func_move_cvt = Move_CVT; } - exc->origCvt = exc->cvt; - exc->origStorage = exc->storage; exc->iniRange = exc->curRange; Compute_Funcs( exc ); @@ -8570,7 +8565,8 @@ /* increment instruction counter and check if we didn't */ /* run this program for too long (e.g. infinite loops). */ - if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES ) { + if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES ) + { exc->error = FT_THROW( Execution_Too_Long ); goto LErrorLabel_; } @@ -8593,9 +8589,6 @@ ins_counter, ins_counter == 1 ? "" : "s" )); - exc->cvt = exc->origCvt; - exc->storage = exc->origStorage; - return FT_Err_Ok; LErrorCodeOverflow_: @@ -8605,9 +8598,6 @@ if ( exc->error && !exc->instruction_trap ) FT_TRACE1(( " The interpreter returned error 0x%x\n", exc->error )); - exc->cvt = exc->origCvt; - exc->storage = exc->origStorage; - return exc->error; } diff --git a/lib/freetype/src/truetype/ttinterp.h b/lib/freetype/src/truetype/ttinterp.h index 48f618dc9..c54c053b2 100644 --- a/lib/freetype/src/truetype/ttinterp.h +++ b/lib/freetype/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -193,7 +193,6 @@ FT_BEGIN_HEADER FT_Long* cvt; /* ! */ FT_ULong glyfCvtSize; FT_Long* glyfCvt; /* cvt working copy for glyph */ - FT_Long* origCvt; FT_UInt glyphSize; /* ! glyph instructions buffer size */ FT_Byte* glyphIns; /* ! glyph instructions buffer */ @@ -224,7 +223,6 @@ FT_BEGIN_HEADER FT_Long* storage; /* ! storage area */ FT_UShort glyfStoreSize; FT_Long* glyfStorage; /* storage working copy for glyph */ - FT_Long* origStorage; FT_F26Dot6 period; /* values used for the */ FT_F26Dot6 phase; /* `SuperRounding' */ diff --git a/lib/freetype/src/truetype/ttobjs.c b/lib/freetype/src/truetype/ttobjs.c index f4f3c6933..4a8873fd8 100644 --- a/lib/freetype/src/truetype/ttobjs.c +++ b/lib/freetype/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ * * Objects manager (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1004,7 +1004,7 @@ { size->cvt[i] = FT_MulFix( face->cvt[i], scale ); FT_TRACE6(( " %3d: %f (%f)\n", - i, face->cvt[i] / 64.0, size->cvt[i] / 64.0 )); + i, (double)face->cvt[i] / 64, (double)size->cvt[i] / 64 )); } FT_TRACE6(( "\n" )); diff --git a/lib/freetype/src/truetype/ttobjs.h b/lib/freetype/src/truetype/ttobjs.h index 5fa239d43..bc6fbe7f1 100644 --- a/lib/freetype/src/truetype/ttobjs.h +++ b/lib/freetype/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ * * Objects manager (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/ttpload.c b/lib/freetype/src/truetype/ttpload.c index 6982c717a..e08bf309e 100644 --- a/lib/freetype/src/truetype/ttpload.c +++ b/lib/freetype/src/truetype/ttpload.c @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/ttpload.h b/lib/freetype/src/truetype/ttpload.h index fa5d96ed3..939e02fe4 100644 --- a/lib/freetype/src/truetype/ttpload.h +++ b/lib/freetype/src/truetype/ttpload.h @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/ttsubpix.c b/lib/freetype/src/truetype/ttsubpix.c index 2438d3a2a..d811beef0 100644 --- a/lib/freetype/src/truetype/ttsubpix.c +++ b/lib/freetype/src/truetype/ttsubpix.c @@ -4,7 +4,7 @@ * * TrueType Subpixel Hinting. * - * Copyright (C) 2010-2022 by + * Copyright (C) 2010-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/truetype/ttsubpix.h b/lib/freetype/src/truetype/ttsubpix.h index 181f83810..62af4c272 100644 --- a/lib/freetype/src/truetype/ttsubpix.h +++ b/lib/freetype/src/truetype/ttsubpix.h @@ -4,7 +4,7 @@ * * TrueType Subpixel Hinting. * - * Copyright (C) 2010-2022 by + * Copyright (C) 2010-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/module.mk b/lib/freetype/src/type1/module.mk index 0342a08ff..33bceff8a 100644 --- a/lib/freetype/src/type1/module.mk +++ b/lib/freetype/src/type1/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/type1/rules.mk b/lib/freetype/src/type1/rules.mk index cae0ee553..efe744b77 100644 --- a/lib/freetype/src/type1/rules.mk +++ b/lib/freetype/src/type1/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/type1/t1afm.c b/lib/freetype/src/type1/t1afm.c index 6009e9ee2..787aa92c9 100644 --- a/lib/freetype/src/type1/t1afm.c +++ b/lib/freetype/src/type1/t1afm.c @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -178,7 +178,6 @@ /* temporarily. If we find no PostScript charmap, then just use */ /* the default and hope it is the right one. */ oldcharmap = t1_face->charmap; - charmap = NULL; for ( n = 0; n < t1_face->num_charmaps; n++ ) { @@ -186,9 +185,7 @@ /* check against PostScript pseudo platform */ if ( charmap->platform_id == 7 ) { - error = FT_Set_Charmap( t1_face, charmap ); - if ( error ) - goto Exit; + t1_face->charmap = charmap; break; } } @@ -209,10 +206,7 @@ kp++; } - if ( oldcharmap ) - error = FT_Set_Charmap( t1_face, oldcharmap ); - if ( error ) - goto Exit; + t1_face->charmap = oldcharmap; /* now, sort the kern pairs according to their glyph indices */ ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ), @@ -302,9 +296,14 @@ t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16; t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16; - /* no `U' suffix here to 0x8000! */ - t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 ); - t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 ); + /* ascender and descender are optional and could both be zero */ + /* check if values are meaningful before overriding defaults */ + if ( fi->Ascender > fi->Descender ) + { + /* no `U' suffix here to 0x8000! */ + t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 ); + t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 ); + } if ( fi->NumKernPair ) { diff --git a/lib/freetype/src/type1/t1afm.h b/lib/freetype/src/type1/t1afm.h index 040ed6829..e0d5aa5a8 100644 --- a/lib/freetype/src/type1/t1afm.h +++ b/lib/freetype/src/type1/t1afm.h @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/t1driver.c b/lib/freetype/src/type1/t1driver.c index dd31545cf..ded3b264e 100644 --- a/lib/freetype/src/type1/t1driver.c +++ b/lib/freetype/src/type1/t1driver.c @@ -4,7 +4,7 @@ * * Type 1 driver interface (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -121,19 +121,30 @@ #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT static const FT_Service_MultiMastersRec t1_service_multi_masters = { - (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ - (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ - (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ - (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ - (FT_Set_Var_Design_Func) T1_Set_Var_Design, /* set_var_design */ - (FT_Get_Var_Design_Func) T1_Get_Var_Design, /* get_var_design */ - (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ - (FT_Set_MM_WeightVector_Func)T1_Set_MM_WeightVector, /* set_mm_weightvector */ - (FT_Get_MM_WeightVector_Func)T1_Get_MM_WeightVector, /* get_mm_weightvector */ - - (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ - (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ + (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ + (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ + (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ + (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ + (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */ + (FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ + (FT_Set_MM_WeightVector_Func) + T1_Set_MM_WeightVector, /* set_mm_weightvector */ + (FT_Get_MM_WeightVector_Func) + T1_Get_MM_WeightVector, /* get_mm_weightvector */ + (FT_Var_Load_Delta_Set_Idx_Map_Func) + NULL, /* load_delta_set_idx_map */ + (FT_Var_Load_Item_Var_Store_Func) + NULL, /* load_item_variation_store */ + (FT_Var_Get_Item_Delta_Func) + NULL, /* get_item_delta */ + (FT_Var_Done_Item_Var_Store_Func) + NULL, /* done_item_variation_store */ + (FT_Var_Done_Delta_Set_Idx_Map_Func) + NULL, /* done_delta_set_index_map */ + (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ + (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ }; #endif diff --git a/lib/freetype/src/type1/t1driver.h b/lib/freetype/src/type1/t1driver.h index 9fe194033..ee7fcf43e 100644 --- a/lib/freetype/src/type1/t1driver.h +++ b/lib/freetype/src/type1/t1driver.h @@ -4,7 +4,7 @@ * * High-level Type 1 driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/t1errors.h b/lib/freetype/src/type1/t1errors.h index 1b87c42f1..2fbd1e513 100644 --- a/lib/freetype/src/type1/t1errors.h +++ b/lib/freetype/src/type1/t1errors.h @@ -4,7 +4,7 @@ * * Type 1 error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/t1gload.c b/lib/freetype/src/type1/t1gload.c index 540231561..a32a4649d 100644 --- a/lib/freetype/src/type1/t1gload.c +++ b/lib/freetype/src/type1/t1gload.c @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -264,7 +264,7 @@ } FT_TRACE6(( "T1_Compute_Max_Advance: max advance: %f\n", - *max_advance / 65536.0 )); + (double)*max_advance / 65536 )); psaux->t1_decoder_funcs->done( &decoder ); diff --git a/lib/freetype/src/type1/t1gload.h b/lib/freetype/src/type1/t1gload.h index fdb985264..c06484758 100644 --- a/lib/freetype/src/type1/t1gload.h +++ b/lib/freetype/src/type1/t1gload.h @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/t1load.c b/lib/freetype/src/type1/t1load.c index 66bebd560..5a1afd8d9 100644 --- a/lib/freetype/src/type1/t1load.c +++ b/lib/freetype/src/type1/t1load.c @@ -4,7 +4,7 @@ * * Type 1 font loader (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -355,6 +355,10 @@ mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'd', 't', 'h' ); else if ( ft_strcmp( mmvar->axis[i].name, "OpticalSize" ) == 0 ) mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' ); + else if ( ft_strcmp( mmvar->axis[i].name, "Slant" ) == 0 ) + mmvar->axis[i].tag = FT_MAKE_TAG( 's', 'l', 'n', 't' ); + else if ( ft_strcmp( mmvar->axis[i].name, "Italic" ) == 0 ) + mmvar->axis[i].tag = FT_MAKE_TAG( 'i', 't', 'a', 'l' ); } mm_weights_unmap( blend->default_weight_vector, diff --git a/lib/freetype/src/type1/t1load.h b/lib/freetype/src/type1/t1load.h index a6d46eb1e..f8511cccf 100644 --- a/lib/freetype/src/type1/t1load.h +++ b/lib/freetype/src/type1/t1load.h @@ -4,7 +4,7 @@ * * Type 1 font loader (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/t1objs.c b/lib/freetype/src/type1/t1objs.c index 847ae0e64..1bb2f15f3 100644 --- a/lib/freetype/src/type1/t1objs.c +++ b/lib/freetype/src/type1/t1objs.c @@ -4,7 +4,7 @@ * * Type 1 objects manager (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -146,7 +146,9 @@ FT_LOCAL_DEF( void ) T1_GlyphSlot_Done( FT_GlyphSlot slot ) { - slot->internal->glyph_hints = NULL; + /* `slot->internal` might be NULL in out-of-memory situations. */ + if ( slot->internal ) + slot->internal->glyph_hints = NULL; } diff --git a/lib/freetype/src/type1/t1objs.h b/lib/freetype/src/type1/t1objs.h index e632fb58b..03847b27e 100644 --- a/lib/freetype/src/type1/t1objs.h +++ b/lib/freetype/src/type1/t1objs.h @@ -4,7 +4,7 @@ * * Type 1 objects manager (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/t1parse.c b/lib/freetype/src/type1/t1parse.c index 95dc97d79..6dec6c16c 100644 --- a/lib/freetype/src/type1/t1parse.c +++ b/lib/freetype/src/type1/t1parse.c @@ -4,7 +4,7 @@ * * Type 1 parser (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -330,50 +330,25 @@ /* the private dict. Otherwise, simply overwrite into the base */ /* dictionary block in the heap. */ - /* first of all, look at the `eexec' keyword */ + /* First look for the `eexec' keyword. Ensure `eexec' is real -- */ + /* it could be in a comment or string (as e.g. in u003043t.gsf */ + /* from ghostscript). */ FT_Byte* cur = parser->base_dict; FT_Byte* limit = cur + parser->base_len; FT_Pointer pos_lf; FT_Bool test_cr; - Again: - for (;;) - { - if ( cur[0] == 'e' && - cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */ - /* whitespace + 4 chars */ - { - if ( cur[1] == 'e' && - cur[2] == 'x' && - cur[3] == 'e' && - cur[4] == 'c' ) - break; - } - cur++; - if ( cur >= limit ) - { - FT_ERROR(( "T1_Get_Private_Dict:" - " could not find `eexec' keyword\n" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - } - - /* check whether `eexec' was real -- it could be in a comment */ - /* or string (as e.g. in u003043t.gsf from ghostscript) */ - parser->root.cursor = parser->base_dict; - /* set limit to `eexec' + whitespace + 4 characters */ - parser->root.limit = cur + 10; + parser->root.limit = parser->base_dict + parser->base_len; cur = parser->root.cursor; limit = parser->root.limit; while ( cur < limit ) { - if ( cur[0] == 'e' && - cur + 5 < limit ) + /* 9 = 5 letters for `eexec' + whitespace + 4 chars */ + if ( cur[0] == 'e' && cur + 9 < limit ) { if ( cur[1] == 'e' && cur[2] == 'x' && @@ -389,21 +364,9 @@ cur = parser->root.cursor; } - /* we haven't found the correct `eexec'; go back and continue */ - /* searching */ - - cur = limit; - limit = parser->base_dict + parser->base_len; - - if ( cur >= limit ) - { - FT_ERROR(( "T1_Get_Private_Dict:" - " premature end in private dictionary\n" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - - goto Again; + FT_ERROR(( "T1_Get_Private_Dict: could not find `eexec' keyword\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; /* now determine where to write the _encrypted_ binary private */ /* dictionary. We overwrite the base dictionary for disk-based */ diff --git a/lib/freetype/src/type1/t1parse.h b/lib/freetype/src/type1/t1parse.h index d9c7e3b56..0d9a2865d 100644 --- a/lib/freetype/src/type1/t1parse.h +++ b/lib/freetype/src/type1/t1parse.h @@ -4,7 +4,7 @@ * * Type 1 parser (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/t1tokens.h b/lib/freetype/src/type1/t1tokens.h index 79080d9e4..40f360926 100644 --- a/lib/freetype/src/type1/t1tokens.h +++ b/lib/freetype/src/type1/t1tokens.h @@ -4,7 +4,7 @@ * * Type 1 tokenizer (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type1/type1.c b/lib/freetype/src/type1/type1.c index 6f1124928..d9bd8cad9 100644 --- a/lib/freetype/src/type1/type1.c +++ b/lib/freetype/src/type1/type1.c @@ -4,7 +4,7 @@ * * FreeType Type 1 driver component (body only). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/module.mk b/lib/freetype/src/type42/module.mk index f619fa5c7..d98b12319 100644 --- a/lib/freetype/src/type42/module.mk +++ b/lib/freetype/src/type42/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2022 by +# Copyright (C) 2002-2023 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/lib/freetype/src/type42/rules.mk b/lib/freetype/src/type42/rules.mk index 9d26c879d..41cb358d3 100644 --- a/lib/freetype/src/type42/rules.mk +++ b/lib/freetype/src/type42/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2022 by +# Copyright (C) 2002-2023 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/lib/freetype/src/type42/t42drivr.c b/lib/freetype/src/type42/t42drivr.c index 45d8c3821..ce1528e5d 100644 --- a/lib/freetype/src/type42/t42drivr.c +++ b/lib/freetype/src/type42/t42drivr.c @@ -4,7 +4,7 @@ * * High-level Type 42 driver interface (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/t42drivr.h b/lib/freetype/src/type42/t42drivr.h index 95e1207b6..ec7da18cc 100644 --- a/lib/freetype/src/type42/t42drivr.h +++ b/lib/freetype/src/type42/t42drivr.h @@ -4,7 +4,7 @@ * * High-level Type 42 driver interface (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/t42error.h b/lib/freetype/src/type42/t42error.h index b27822100..dcea9c4f6 100644 --- a/lib/freetype/src/type42/t42error.h +++ b/lib/freetype/src/type42/t42error.h @@ -4,7 +4,7 @@ * * Type 42 error codes (specification only). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/t42objs.c b/lib/freetype/src/type42/t42objs.c index da1e0732a..bf4028e75 100644 --- a/lib/freetype/src/type42/t42objs.c +++ b/lib/freetype/src/type42/t42objs.c @@ -4,7 +4,7 @@ * * Type 42 objects manager (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/t42objs.h b/lib/freetype/src/type42/t42objs.h index e677996a3..33e6215e1 100644 --- a/lib/freetype/src/type42/t42objs.h +++ b/lib/freetype/src/type42/t42objs.h @@ -4,7 +4,7 @@ * * Type 42 objects manager (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/t42parse.c b/lib/freetype/src/type42/t42parse.c index 59cc519ea..6d765c8c1 100644 --- a/lib/freetype/src/type42/t42parse.c +++ b/lib/freetype/src/type42/t42parse.c @@ -4,7 +4,7 @@ * * Type 42 font parser (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -733,7 +733,7 @@ ttf_reserved ) ) goto Fail; } - /* fall through */ + FALL_THROUGH; case BEFORE_TABLE_DIR: /* the offset table is read; read the table directory */ @@ -785,7 +785,7 @@ ttf_reserved ) ) goto Fail; } - /* fall through */ + FALL_THROUGH; case OTHER_TABLES: /* all other tables are just copied */ diff --git a/lib/freetype/src/type42/t42parse.h b/lib/freetype/src/type42/t42parse.h index fa633e7f1..5741c5413 100644 --- a/lib/freetype/src/type42/t42parse.h +++ b/lib/freetype/src/type42/t42parse.h @@ -4,7 +4,7 @@ * * Type 42 font parser (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/t42types.h b/lib/freetype/src/type42/t42types.h index 985bdfda9..0bfe14ee4 100644 --- a/lib/freetype/src/type42/t42types.h +++ b/lib/freetype/src/type42/t42types.h @@ -4,7 +4,7 @@ * * Type 42 font data types (specification only). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/type42/type42.c b/lib/freetype/src/type42/type42.c index ccf5d472b..8d2302c8e 100644 --- a/lib/freetype/src/type42/type42.c +++ b/lib/freetype/src/type42/type42.c @@ -4,7 +4,7 @@ * * FreeType Type 42 driver component. * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/winfonts/fnterrs.h b/lib/freetype/src/winfonts/fnterrs.h index 10564e107..dafdb07b4 100644 --- a/lib/freetype/src/winfonts/fnterrs.h +++ b/lib/freetype/src/winfonts/fnterrs.h @@ -4,7 +4,7 @@ * * Win FNT/FON error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/lib/freetype/src/winfonts/module.mk b/lib/freetype/src/winfonts/module.mk index 7a49201fa..78a290065 100644 --- a/lib/freetype/src/winfonts/module.mk +++ b/lib/freetype/src/winfonts/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/winfonts/rules.mk b/lib/freetype/src/winfonts/rules.mk index 2f67ab45f..b39c519e0 100644 --- a/lib/freetype/src/winfonts/rules.mk +++ b/lib/freetype/src/winfonts/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2023 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/lib/freetype/src/winfonts/winfnt.c b/lib/freetype/src/winfonts/winfnt.c index 8afd6be6e..fa73ae4a9 100644 --- a/lib/freetype/src/winfonts/winfnt.c +++ b/lib/freetype/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ * * FreeType font driver for Windows FNT/FON files * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * Copyright 2003 Huw D M Davies for Codeweavers * Copyright 2007 Dmitry Timoshkov for Codeweavers diff --git a/lib/freetype/src/winfonts/winfnt.h b/lib/freetype/src/winfonts/winfnt.h index 7e6f5915e..2f75b9e86 100644 --- a/lib/freetype/src/winfonts/winfnt.h +++ b/lib/freetype/src/winfonts/winfnt.h @@ -4,7 +4,7 @@ * * FreeType font driver for Windows FNT/FON files * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * Copyright 2007 Dmitry Timoshkov for Codeweavers * diff --git a/lib/freetype/subprojects/harfbuzz.wrap b/lib/freetype/subprojects/harfbuzz.wrap new file mode 100644 index 000000000..341be634e --- /dev/null +++ b/lib/freetype/subprojects/harfbuzz.wrap @@ -0,0 +1,12 @@ +[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 + +[provide] +harfbuzz = libharfbuzz_dep +harfbuzz-icu = libharfbuzz_icu_dep +harfbuzz-subset = libharfbuzz_subset_dep +harfbuzz-gobject = libharfbuzz_gobject_dep diff --git a/lib/freetype/subprojects/libpng.wrap b/lib/freetype/subprojects/libpng.wrap new file mode 100644 index 000000000..12ba5b185 --- /dev/null +++ b/lib/freetype/subprojects/libpng.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = libpng-1.6.39 +source_url = https://github.com/glennrp/libpng/archive/v1.6.39.tar.gz +source_filename = libpng-1.6.39.tar.gz +source_hash = a00e9d2f2f664186e4202db9299397f851aea71b36a35e74910b8820e380d441 +patch_filename = libpng_1.6.39-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.39-2/get_patch +patch_hash = 8bcf8f69f50233f3a35e3718ab3c91b0c51b4c1a08a84c87be0b1f4813adf17f +wrapdb_version = 1.6.39-2 + +[provide] +libpng = libpng_dep diff --git a/lib/freetype/subprojects/zlib.wrap b/lib/freetype/subprojects/zlib.wrap new file mode 100644 index 000000000..23af071a2 --- /dev/null +++ b/lib/freetype/subprojects/zlib.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = zlib-1.2.13 +source_url = http://zlib.net/fossils/zlib-1.2.13.tar.gz +source_filename = zlib-1.2.13.tar.gz +source_hash = b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30 +patch_filename = zlib_1.2.13-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.2.13-2/get_patch +patch_hash = a7abea3ad65dc2c291ad5fbbf5355d0585a7f7b8c935d4a74335b8fe18684506 +wrapdb_version = 1.2.13-2 + +[provide] +zlib = zlib_dep diff --git a/lib/freetype/vms_make.com b/lib/freetype/vms_make.com index 2746d4073..a1ccb654e 100644 --- a/lib/freetype/vms_make.com +++ b/lib/freetype/vms_make.com @@ -1,6 +1,6 @@ $! make FreeType 2 under OpenVMS $! -$! Copyright (C) 2003-2022 by +$! Copyright (C) 2003-2023 by $! David Turner, Robert Wilhelm, and Werner Lemberg. $! $! This file is part of the FreeType project, and may only be used, modified, |