Commit graph

8399 commits

Author SHA1 Message Date
Werner Lemberg
007c46ebbf * Version 2.14.0 released.
==========================

Tag sources with `VER-2-14-0'.

* docs/VERSION.TXT: Add entry for version 2.14.0.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.3/2.14.0/, s/2133/2140/.

* include/freetype/freetype.h (FREETYPE_MINOR): Set to 14.
(FREETYPE_PATCH): Set to 0.

* builds/unix/configure.raw (version_info): Set to 26:3:20.
* CMakeLists.txt (VERSION_MINOR): Set to 14.
(VERSION_PATCH): Set to 0.
2025-09-06 16:47:31 +02:00
Werner Lemberg
28223c5f99 * builds/toplevel.mk (do-dist): Download shallow clone of config.git.
No need for any other commit than the current one.
2025-09-06 16:47:31 +02:00
Werner Lemberg
32cb53904c Update all copyright notices. 2025-09-06 06:14:03 +02:00
Werner Lemberg
d3668e00da src/sfnt/ttload.c (tt_face_load_any): Correctly handle font containers.
Reported as

  https://issues.oss-fuzz.com/issues/424613326
2025-09-05 20:23:22 +02:00
Jouk Jansen
ba7eb5bed7 Clean up OpenVMS support.
This avoids cluttering the source code with VMS-specific changes.

* include/freetype/internal/ftcalc.h [__VMS], src/base/ftcalc.c
  [vms_auto64_source]: Remove.

* builds/vms/patch_ftcalc.sed: New file.

* vms_make.com: Change macro definitions while this script is running; we
  use `GNU sed` to inject the necessary preprocessor code on the fly.
2025-09-05 17:58:54 +00:00
Alexei Podtelezhnikov
c6cf32de3b * src/psaux/psauxmod.h (psaux_driver_class): Removed declaration. 2025-08-31 22:39:11 -04:00
Alexei Podtelezhnikov
61a4234260 [base] Use const FT_Module_Class.
This is intended to warn against modifying any fields in the class,
at compile-time and avoid crashes at run-time.

* include/freetype/internal/ftobjs.h (FT_ModuleRec): Do it.
* src/base/ftobjs.c (Destroy_Module, FT_Add_Module): Updated.
2025-08-29 16:59:50 -04:00
Alexei Podtelezhnikov
48f91b5331 * src/base/ftobjs.c (FT_Load_Glyph): Reduces scope of 'ttface'. 2025-08-27 11:16:07 -04:00
Alexei Podtelezhnikov
c0851258d0 * src/truetype/ttinterp.c: Fix some builds. 2025-08-25 12:35:50 -04:00
Werner Lemberg
8cbabc47da * subprojects/*.wrap: Updated. 2025-08-23 19:21:19 +02:00
Werner Lemberg
23fa1e3550 Updating CHANGES file; minor fixes elsewhere (mostly formatting). 2025-08-23 19:21:19 +02:00
Alexei Podtelezhnikov
ca0247af92 [truetype] Fix compilation without bytecode.
Fixes #1351 and various warnings about unused variables.

* src/truetype/ttinterp.c: Put the entire body under #ifdef.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph): Relocate
some declarations.
* src/truetype/ttinterp.h: Remove some #ifdef conditions.
* src/truetype/ttobjs.c (tt_size_done): Modified.
2025-08-19 23:39:02 -04:00
Alexei Podtelezhnikov
cff6674899 [truetype] Small fix in the incremental interface (again).
Fixes #1299, last [-Wdangling-pointer=] warning.

* src/truetype/ttgload.c (load_truetype_glyph): Restore original stream
on exit unconditionally.
2025-08-14 12:39:57 -04:00
Alexei Podtelezhnikov
6bd5a8cc78 [truetype] Small fix in the incremental interface.
Fixes #1299, last [-Wdangling-pointer=] warning.

* src/truetype/ttgload.c (load_truetype_glyph): Restore original stream
on exit.
2025-08-14 12:23:03 -04:00
Alexei Podtelezhnikov
508c30e086 * src/autofit/afgsub.c: Fix a warning.
Fixes [-Wunused-function] warning without HarfBuzz.
2025-08-14 10:33:30 -04:00
Alexei Podtelezhnikov
adc7b85508 * */ftoption.h: Update C99 wording. 2025-08-11 15:34:27 -04:00
Alexei Podtelezhnikov
4c77a6967d * */ftoption.h: Note C99 compliance. 2025-08-11 13:20:50 -04:00
Behdad Esfahbod
670d0b2121 [ttgxvar] Fix caching of scalars when there are intermediate tuples.
For example, with `GoogleSansFlex-Regular.ttf` at ROND=100, the 'Q' glyph
was misrendering.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reset `tupleScalars`
  earlier.
2025-08-08 13:21:34 +02:00
Jouk Jansen
aa2ee67b3d Improvements to OpenVMS support.
* include/freetype/internal/ftcalc.h [__VMS]: Undefine `FT_MulFix`.

* src/base/ftcalc.c [vms_auto64_source]: Define `FT_MulFix`.

* vms_make.com: Also create 32bit version of the FreeType library.
2025-08-05 17:40:45 +02:00
Alexei Podtelezhnikov
27c1cb10a5 * docs/CHANGES: Mention 'ftmulti' improvements. 2025-08-04 11:47:10 -04:00
Alexei Podtelezhnikov
42047ae84d [type1/MM] Correctly reset the default instance.
Call T1_Set_MM_WeightVector, which actually sets default weights,
instead of TT_Set_MM_Blend, which just centers the axes.

* src/type1/t1load.c (T1_Reset_MM_Blend): Do it.
2025-08-02 11:54:16 -04:00
Alexei Podtelezhnikov
08805be530 [truetype/v40] Fix ROUND_XY_TO_GRID handling.
Fixes #1346.

* src/truetype/ttgload.c (TT_Process_Composite_Component): Round
the x-position unless in backward_compatibility mode.
2025-08-01 11:01:16 -04:00
Alexei Podtelezhnikov
6c18a397cb * src/truetype/ttinterp.c (Ins_MDRP,MIRP): Small tweak. 2025-07-30 09:45:53 -04:00
Alexei Podtelezhnikov
64a0c64a04 [truetype] Tweak size management.
* include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func):
Update typedef, do not return error.
* src/truetype/ttobjs.c (tt_size_reset_height): Move the PPem error
handling from here...
(tt_size_reset): ... to here to improve readability.
src/truetype/ttobjs.h (tt_size_reset_height): Update prototype.
2025-07-29 22:21:42 -04:00
Alexei Podtelezhnikov
8ceba9bbc5 [truetype] Relocate color compensation (cont'd).
* src/truetype/ttinterp.c (Inc_MDAR,MIAP,MDRP,MIRP): Fix forgotten
rounding.
2025-07-29 19:06:27 -04:00
Alexei Podtelezhnikov
47d80cf27b [truetype] Fix EVEN and ODD instructions.
It is possible to have a fractional part after rounding when rounding
to half-grid or super-rounding. The specs call to ignore the fractional
part in that case.

^ src/truetype/ttinterp.c (Ins_EVEN, Ins_ODD): Fix mask.
2025-07-29 07:12:24 -04:00
Alexei Podtelezhnikov
ac662dcdcf * src/truetype/ttinterp.c: Fix comments. 2025-07-27 19:24:36 -04:00
Alexei Podtelezhnikov
63e2c05875 * src/truetype/ttinterp.h (TT_Round_Func): Fix argument.
Fixes #1347: function type mismatch.
2025-07-27 18:33:14 -04:00
Alexei Podtelezhnikov
62ca1fd27e [truetype] Clean up size validation.
Rely on non-zero ppem to validate the size object.

* src/truetype/ttobjs.h (TT_Size_Merics): Remove the `valid` flag.
* src/truetype/ttobjs.c (tt_size_init,done,reset,reset_height): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Check for non-zero ppem.
2025-07-27 09:40:39 -04:00
Alexei Podtelezhnikov
9e9d539f81 [truetype] Relocate color compensation.
The rounding color compensation, which is not used by FreeType, belongs
to GS. This is a more logical place for it, next to round_state.

* src/truetype/ttobjs.h (TT_GraphicsState): Move compensations here...
(TT_Size_Metrics): ... from here.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Updated.
* src/truetype/ttinterp.c (tt_default_graphics_state): Updated.
(Ins_ROUND,NROUND,EVEN,ODD): Updated.
(Round_*): Updated.
2025-07-27 09:28:17 -04:00
Alexei Podtelezhnikov
d6022b6d6e [smooth] Remove usage of setjmp and longjmp.
To support WASM targets with slow or unsupported setjmp and longjmp,
we eliminate these calls in favor of an error propagation model.
When gray_set_cell is out of cells, it raises an exception which is
later handled in gray_convert_glyph_inner.
This is a less invasive alternative to !385.

* src/smooth/ftgrays.c (gray_set_cell): Raise the overflow exception
and redirect all work to `cell_null`.
(gray_move,line,conic,cubic_to): Return the exception.
(gray_convert_glyph, gray_convert_glyph_inner): Handle the exception.
2025-07-26 07:00:51 -04:00
Werner Lemberg
b04db3872c [sfnt] Rewrite GPOS kerning support. (2/2)
The previous code had a fundamental flaw: it didn't validate the necessary
parts of the 'GPOS' table before accessing it, causing crashes with
malformed data (since `TT_CONFIG_OPTION_GPOS_KERNING` is off by default,
standard fuzzers don't catch these problems).  Additionally, it did a lot of
parsing while accessing kerning data, making it rather slow.

The new implementation fixes this.  After validation, offsets to the 'GPOS'
lookup subtables used in the 'kern' feature that correspond to 'simple'
kerning (i.e., similar to 'kern' table kerning) are stored in `TT_Face`;
this greatly simplifies and accelerates access to the kerning data.

Testing with font `SF-Pro.ttf` version '1.00', the validation time for the
'GPOS' table increases the start-up time of `FT_New_Face` by less than 1%,
while calls to `FT_Get_Kerning` become about 3.5 times faster.

* include/freetype/internal (gpos_kerning_available): Replace with...
  (gpos_lookups_kerning, num_gpos_lookups_kerning): ... these new fields.
  Update callers.

* src/ttgpos.c [TT_CONFIG_OPTION_GPOS_KERNING]: A new implementation.
2025-07-05 14:51:40 +02:00
Werner Lemberg
8ef26a803c [sfnt] Rewrite GPOS kerning support. (1/2)
This commit removes the previous implementation.
2025-07-05 14:51:40 +02:00
Werner Lemberg
ecbc1abfa8 [cff] Support GPOS kerning.
* src/cff/cffdrivr.c (cff_get_kerning) [TT_CONFIG_OPTION_GPOS_KERNING]: Add
  code similar to the one in `tt_get_kerning`.
2025-07-05 14:51:40 +02:00
Werner Lemberg
fb6a74269d * src/sfnt/ttkern.h (TT_FACE_HAS_KERNING): Remove macro.
Given that we also support (limited) 'GPOS' table kerning if
`TT_CONFIG_OPTION_GPOS_KERNING` is defined, the name of this macro is
misleading since it only is true for 'kern' table kerning.

* src/sfnt/sfobjs.c (sfn_load_face): Replace `TT_FACE_HAS_KERNING` with
  plain code.
2025-07-05 14:51:40 +02:00
Werner Lemberg
0fd0cf33fd [autofit] Remove globals->gsub_length.
We completely validate the accessed data from the 'GSUB' table, making this
field unnecessary.

* src/autofit/afglobal.h (AF_FaceGlobalsRec): Remove `gsub_length` field.

* src/autofit/afglobal.c (af_face_globals_new), src/autofit/afgsub.c
  (af_parse_gsub): Updated.
2025-07-05 14:51:07 +02:00
Werner Lemberg
f1cd6dbfa0 * src/truetype/ttobjs.c (tt_size_init_bytecode): Correct previous fix.
`FT_NEW_ARRAY` expects a signed value, not an unsigned one.
2025-07-01 21:32:47 +02:00
Werner Lemberg
5e6715101f * src/autofit/afgsub.c: Include tttables.h and afgsub.h.
This fixes 'make multi' compilation with clang.

Reported as

  https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984610
2025-07-01 19:09:46 +02:00
Werner Lemberg
01695ea72a Various minor fixes.
As reported by clang 19.

* src/autofit/afadjust.c (adjustment_database): Make it static.

* src/base/ftdbgmem.c (FT_MEM_SIZE_MIN): Remove unused macro.

* src/psaux/psobjs.c (skip_procedure), src/truetype/ttinterp.c (Ins_IF,
  Ins_ELSE, Ins_FDEF, Ins_IDEF): Add `default` clause.
2025-07-01 18:06:17 +02:00
Werner Lemberg
f1be739219 More signedness fixes.
As reported by clang 19.

* src/autofit/afadjust.c (add_substitute): Make first argument unsigned.
  Update all callers.
  Other minor signedness fixes.
  (af_reverse_character_map_new): Minor signedness fixes.

* src/autofit/afgsub.c (af_hash_insert): Minor signedness fixes.

* src/autofit/aflatin.c
  (af_glyph_hints_apply_vertical_separation_adjustments): Make third
  argument unsigned.
  Update all callers.
  Other minor signedness fixes.
  (af_latin_hints_apply): Minor signedness fixes.

* src/bdf/bdflib.c (bdf_parse_bitmap_): Minor signedness fix.

* src/truetype/ttobjs.c (tt_size_init_bytecode): Minor signedness fix.
2025-07-01 18:00:12 +02:00
Werner Lemberg
8d82c9fa4d */*: Fix trivial signedness issues with format strings in trace messages.
As reported with clang 19's `-Wformat` option.
2025-07-01 17:08:37 +02:00
Werner Lemberg
346d8fae7a Fix make multi.
Reported as

  https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984253

* src/base/fthash.c: Include `ftobjs.h`.
* src/autofit/afgsub.c: Include `afglobal.h`.
2025-07-01 05:18:47 +02:00
Alexei Podtelezhnikov
39d85f1692 * MSBuild.sln: Minor. 2025-06-30 09:32:19 -04:00
Werner Lemberg
d7e640b9c6 [doc] Revise font variation API. 2025-06-29 16:14:57 +02:00
Werner Lemberg
636aede94b [doc] Use 'Adobe MM', 'TrueType GX', and 'OpenType Font Variations'. 2025-06-29 06:23:38 +02:00
Werner Lemberg
61bacf3dae Set minimum HarfBuzz version back to 2.0.0.
Due to the new GSUB parsing we no longer need
`hb_ot_layout_lookup_get_glyph_alternates`.

This partially reverts commit 5d2fd7608a.

* CMakeLists.txt (HARFBUZZ_MIN_VERSION), meson.build (harfbuzz_dep),
  builds/unix/configure.raw (harfbuzz_pkg): Set version to 2.0.0.

* src/autofit/ft-hb-decls.h: Remove entry for
  `hb_ot_layout_lookup_get_glyph_alternates`.
2025-06-26 05:46:58 +02:00
Werner Lemberg
6a982bde85 [autofit] Speed up computation of af_reverse_character_map_new. (4/4)
With this commit, the start-up time for creating the reverse character map
gets reduced from more than 300% to about 25% (as tested with `arial.ttf`
version 7.00).

* src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
  `afgsub.h`.
  (add_substitute): New auxiliary function to recursively add elements to
  the reverse cmap.
  (af_reverse_character_map_new): New code that replaces the old code
  removed in the previous commit.
2025-06-26 05:46:58 +02:00
Werner Lemberg
9e8b642b10 [autofit] Speed up computation of af_reverse_character_map_new. (3/4)
Rip out some HarfBuzz code of `af_reverse_character_map_new`.  The new code
comes immediately in a follow-up commit, making it easier to follow the
changes.

* src/autofit/afadjust.c (af_get_glyph_alternates_helper,
  af_get_glyph_alternates): Remove.
  (af_reverse_character_map_new): Remove code to create the `*map` hash.
2025-06-26 05:46:58 +02:00
Werner Lemberg
9bfb8e80c4 [autofit] Speed up computation of af_reverse_character_map_new. (2/4)
Create an array of GSUB lookup indices for `SingleSubst` and
`AlternateSubst` lookup types to exit early if we have different types.

Also improve tracing.

* src/autofit/afglobal.h (AF_FaceGlobals) [FT_CONFIG_OPTION_USE_HARFBUZZ]:
  New fields `gsub_length`, `gsub`, and `gsub_lookups_single_alternate`.

* src/autofit/afglobal.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
  `afgsub.h`.
  (af_face_globals_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call
  `af_parse_gsub` to fill `gsub_lookups_single_alternate`.
  (af_face_globals_free): Updated.

* src/autofit/afadjust.c (af_get_glyph_alternates_helper): Exit early if we
  possible.
  (af_reverse_character_map_new): Trace GSUB lookup indices to be checked.
2025-06-26 05:46:58 +02:00
Werner Lemberg
cda418a4a5 [autofit] Speed up computation of af_reverse_character_map_new. (1/4)
Using HarfBuzz's API functions to construct the reverse map is too slow; we
have to call `hb_ot_layout_lookup_get_glyph_alternates` far too often
because it can only handle a single glyph at a time.  For this reason we are
going to parse the GSUB table by ourselves.

The new non-local functions are `af_parse_gsub` and `af_map_lookup`.

* src/autofit/afgsub.c, src/autofit/afgsub.h: New files for parsing,
  validating, and mapping the `SingleSubst` and `AlternateSubst` subtable
  types of a GSUB table.

* src/autofit/autofit.c, src/autofit/rules.mk (AUTOF_DRV_SRC): Updated.
2025-06-26 05:46:58 +02:00