Commit graph

2063 commits

Author SHA1 Message Date
Alexei Podtelezhnikov
b27dc88c4a Remove some declare/define macros (pt 3).
* include/freetype/internal/ftobjs.h (FT_CMap_ClassRec): Make const.
(FT_DECLARE_CMAP_CLASS, FT_DEFINE_CMAP_CLASS): Removed.
* src/*: Update all users.
2025-09-01 23:28:07 -04:00
Alexei Podtelezhnikov
821e87b1ff Remove some declare/define macros (pt 2).
This removes the next set of macros remaining from the PIC support.

* include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH, FT_DEFINE_GLYPH):
Removed.
* include/freetype/ftglyph.h (FT_Glyph_Class): Make const always.
* src/*: Update all users.
2025-09-01 18:19:29 -04:00
Alexei Podtelezhnikov
e08810da82 Remove some declare/define macros (pt 1).
These macros were relics of PIC code removed some time ago. They only hid
the class initializations. We make those explicit again.

* include/freetype/internal/ftobjs.h (FT_DECLARE_MODULE, FT_DEFINE_MODULE,
FT_DECLARE_RENDERER, FT_DEFINE_RENDERER): Removed.
* include/freetype/internal/ftdrv.h (FT_DECLARE_DRIVER, FT_DEFINE_DRIVER):
Removed.
* src/*: Updated all former users.
2025-09-01 17:53:13 -04:00
Alexei Podtelezhnikov
1b6845d9b8 [base] s/FT_Driver_ClassRec/FT_Driver_Class/.
This is done for consistency with FT_Module_Class and FT_Renderer_Class.
All of these classes are constant and used similarly. The 'Rec' suffix
suggests that these classes are modifiable, when they are not.  The old
alias is deprecated.

* include/freetype/internal/ftdrv.h: Do it.
* builds/*, include/*, src/*: Update all users.
2025-08-31 22:51:49 -04:00
Alexei Podtelezhnikov
d25553220e [base] Make FT_Driver_Class always const.
* include/freetype/internal/ftdrv.h (FT_Driver_Class): Make const.
* src/*: Update all users.
2025-08-31 22:51:49 -04:00
Alexei Podtelezhnikov
46c6bc8472 [base] Make FT_Renderer_Class always const.
* include/freetype/ftrender.h (FT_Renderer_Class): Make const.
* include/freetype/internal/ftobjs.h: Updated.
2025-08-31 22:51:49 -04:00
Alexei Podtelezhnikov
7b8a770aac [base] Make FT_Module_Class always const.
All uses of FT_Module_Class are decorated with const now.  Therefore,
it make sense to declare it as such to begin with.

* include/freetype/ftmodapi.h (FT_Module_Class): Decorate with const.
* include/freetype/internal/ftobjs.h (FT_Module): Updated.
* src/*: Update all other users.
2025-08-31 22:50:51 -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
Werner Lemberg
23fa1e3550 Updating CHANGES file; minor fixes elsewhere (mostly formatting). 2025-08-23 19:21:19 +02: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
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
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
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
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
2ab0357d38 [base] Add no-overwrite hash insert functions.
* src/base/fthash.c (ft_hash_num_insert_no_overwrite,
  ft_hash_str_insert_no_overwrite): New functions.
* include/freetype/internal/fthash.h: Updated.
2025-06-26 05:46:58 +02:00
Werner Lemberg
820df38734 [base] Add iterators for FT_Hash.
* src/base/fthash.c (ft_hash_num_iterator, ft_hash_str_iterator): New
  functions.
* include/freetype/internal/fthash.h: Updated.
2025-06-26 05:46:58 +02:00
Alexei Podtelezhnikov
2041c65cd2 [truetype] Simplify twilight zone management.
* include/freetype/internal/tttypes.h (TT_GlyphZone): Remove 'memory'.
* src/truetype/ttobjs.c (tt_glyphzone_done): Use 'memory' as argument.
(tt_glyphzone_new, tt_glyphzone_done): Allocate/free as a single block.
(tt_size_init_bytecode, tt_size_done_bytecode): Updated.
* src/truetype/ttobjs.h (tt_glyphzone_done): Updated signature.
2025-06-20 20:20:54 -04:00
Alexei Podtelezhnikov
3c14c52523 [truetype] Clean up TT_GlyphZone.
* include/freetype/internal/tttypes.h (TT_GlyphZone): Delete fields.
* src/truetype/ttobjs.c (tt_glyphzone_new, tt_glyphzone_done,
tt_size_init_bytecode): Updated.
2025-06-11 15:32:11 -04:00
Alexei Podtelezhnikov
68c62e193f [truetype] Relocate the interpreter pointer.
This reduces dereferencing when calling the interpreter.

* include/freetype/internal/tttypes.h (TT_Face): Move it from here...
* src/truetype/ttinterp.h (TT_ExecContext): ... to here.
* src/truetype/ttobjs.c (tt_size_init_bytecode):  Move its initialization
* src/truetype/ttinterp.c (TT_New_Context): ... to here.
(TT_Run_Context): Updated.
2025-06-11 07:58:51 -04:00
Alexei Podtelezhnikov
ecfefd8ccd [truetype] Clean up the loader initiation.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Remove unused field.
* src/truetype/ttgload.c (tt_loader_init): Refactor.
2025-06-11 07:58:51 -04:00
Werner Lemberg
d736e74177 Two more link fixes. 2025-06-10 05:29:47 +02:00
Werner Lemberg
7f559fbe9a Update links.
Found with `linkchecker --check-extern index.html` running locally in the
'freetype-web' repository.
2025-06-10 04:56:50 +02:00
Werner Lemberg
2adb53616a Replace 'www.freetype.org' with 'freetype.org'. 2025-06-03 10:35:16 +02:00
Werner Lemberg
5a07f41d0e [sfnt] FT_Load_Sfnt_Table can now also load a font's table directory.
Closes issue #1263.

* src/sfnt/ttload.c (tt_face_load_any): Implement it.
2025-05-28 09:52:44 +02:00
Behdad Esfahbod
fa412cf5c5 [mm/gxvar] Always detect default instance and use optimized codepath.
Even if it was explicitly set by either design or normalized APIs.

Also update documentation.

* src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): Use value -2
  of `error` to indicate that we have a non-default instance.
  (TT_Set_Named_Instance): Updated.

* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
  FT_Set_Var_Blend_Coordinates): Updated.
2025-05-27 07:00:08 +02:00
Werner Lemberg
e07e56c7f1 [gxvar] Speed up handling of deltas in ItemVariationStore. (3/3)
* src/base/ftcalc.c (FT_MulAddFix): Removed, no longer needed.
* include/freetype/internal/ftcalc.h: Updated.
2025-05-26 17:22:13 +02:00
Behdad Esfahbod
8eae039923 Lift FT_Int64 type to global (internal) FreeType use.
* src/base/ftcalc.c (FT_Int64) [!FT_INT64]: Move declaration to...
* include/freetype/config/integer-types.h: ... this file.
  (FT_UInt64) [!FT_INT64]: New structure.
  (FT_INT64_ZERO): New macro.
2025-05-26 08:24:21 +02:00
Werner Lemberg
04455084cf * include/freetype/ttnameid.h (TT_UCR_*): Define with unsigned long.
(TT_UCR_PHAGSPA): Fix definition.

Fixes issue #1300.
2025-05-08 07:49:10 +02:00
Werner Lemberg
c2789e7558 [doc] Mention that there is no rendering support for 'COLR' v1 tables.
Handles issue #1319.
2025-05-08 07:03:31 +02:00
Carlo Bramini
c26c150cf2 Fix Cygwin visibility attributes.
Reported as compilation warnings in #1329.

* include/freetype/config/public-macros.h: Check __CYGWIN__.
* include/freetype/internal/compiler-macros.h: Ditto.
2025-05-04 07:22:46 -04:00
Behdad Esfahbod (بهداد اسفهبد)
5d2fd7608a Provide configuration option to dynamically load the HarfBuzz library.
We now request HarfBuzz version 2.6.8 (published in June 2020) or newer to
simplify the setup; this version introduced function
`hb_ot_layout_lookup_get_glyph_alternates`, which we need for the adjustment
database of the auto-hinter.

No CMake support yet for dynamic loading.

* include/freetype/config/ftoption.h, devel/ftoption.h
  (FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC): New configuration macro.

* builds/unix/configure.raw: Implement `--with-harfbuzz=dynamic`.
  This gets tested automatically if we can't link with `libharfbuzz`.
  (ft_option_set, ft_option_unset): Refine.
  Require at least HarfBuzz version 2.6.8.

* meson.build: Do the same as `configure.raw`.
* meson_options.txt: Updated.

* CMakeLists.txt: Require at least HarfBuzz version 2.6.8.
2025-04-29 19:18:12 +00:00
Alexei Podtelezhnikov
3467c2177c * include/freetype/internal/ftcalc.h (FT_MulFix_64): Silence UBSAN. 2025-04-25 08:09:48 -04:00
Alexei Podtelezhnikov
6ed79d5b7a * include/freetype/internal/ftcalc.h: Fix fringe compilation. 2025-04-17 22:46:06 -04:00
Alexei Podtelezhnikov
ccabe7ac02 [base, truetype] Silence UBSAN (cont'd).
* src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14): Use MUL_INT64.
* include/freetype/internal/ftcalc.c (FT_MulFix): Ditto.
2025-04-15 18:49:36 +00:00
Craig White
c46ebd7650 [autofit] Add adjustment database.
* src/autofit/afadjust.c, src/autofit/afadjust.h: New files.

* include/freetype/internal/fttrace.h: Add 'afadjust' component.

* src/autofit/autofit.c: Include `afadjust.c`.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afadjust.c`.
2025-04-14 06:50:00 +02:00
Craig White
f0660df3a9 [base] Make find_unicode_charmap a base function.
This is needed for forthcoming changes in the auto-hinter.

* include/freetype/internal/ftobjs.h, src/base/ftobjs.c: Updated.
2025-04-14 06:50:00 +02:00
Alexei Podtelezhnikov
5416689d95 * include/freetype/internal/ftcalc.h (FT_MSB) [__CC_ARM]: Added. 2025-04-12 12:38:01 -04:00
Alexei Podtelezhnikov
58b3598c2a Typos in macros.
* include/freetype/internal/ftcalc.h: s/_M_X86/_M_IX86/.
* src/truetype/ttinterp.c: s/_M_X86/_M_IX86/.
2025-04-12 09:18:16 -04:00
Alexei Podtelezhnikov
c88bf8a216 [base, truetype] Silence UBSAN.
* src/truetype/ttinterp.c (TT_MulFix14_64): Use unsigned multiplication.
* include/freetype/internal/ftcalc.h (FT_MulFix_64): Ditto.
2025-04-11 22:58:26 -04:00
Alexei Podtelezhnikov
fb99fd63ec [base, truetype] Synchronize MulFix assembly.
* include/freetype/internal/ftcalc.h (FT_MulFix_*),
src/truetype/ttinterp.c (TT_MulFix14_*): Synchronize routines.
2025-04-11 22:57:27 -04:00
Alexei Podtelezhnikov
8f67545d72 [base] Update FT_MulFix inlining.
Resolves inconsistencies in 64-bit multiplication discussed in !355.                                                    Importantly, FT_MulFix arguments and return value is FT_Long,                                                           whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or                                                     4 bytes on Windows.                                                                                                                                                                                                                             * include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed.                                                       (FT_MulFix_64): Generalize and prioritize the inline implementation
for all 64-bit platforms ifdef FT_INT64.                                                                                * src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'.                                                         * src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers                                                     to enable its inlining.
2025-04-09 13:37:23 +00:00
Graham Asher
fc67794e15 Missing header wrappers.
* include/freetype/config/integer-types.h, src/smooth/ftgrays.h:
Add missing FT_BEGIN_HEADER and FT_END_HEADER.
* src/smooth/ftgrays.c: Cosmetics.
2025-04-04 19:54:50 -04:00
Alexei Podtelezhnikov
4f00846dde * include/freetype/ftimage.h (FT_Bitmap): Describe empty bitmap. 2024-08-25 18:13:10 +00:00
luz paz
f92c96550a Fix various typos. 2024-08-13 23:29:13 -04:00
Werner Lemberg
42608f77f2 * Version 2.13.3 released.
==========================

Tag sources with `VER-2-13-3'.

* docs/VERSION.TXT: Add entry for version 2.13.3.
* 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.2/2.13.3/, s/2132/2133/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.

* builds/unix/configure.raw (version_info): Set to 26:2:20.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
2024-08-12 12:50:14 +02:00
Werner Lemberg
ed8b82ba94 Various minor documentation or formatting fixes. 2024-08-12 12:34:28 +02:00
Werner Lemberg
ec378cecaf tttables.h (FT_Get_CMap_Format): Minor documentation improvement. 2024-08-07 21:23:44 +02:00
Alexei Podtelezhnikov
2488854056 [bdf,pcf,winfonts,sfnt] Remove barely used marcros.
* include/freetype/internal/ftobjs.h (FT_FACE_SIZE, FT_SIZE_FACE):
Removed.
* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Updated.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto
* src/sfnt/ttbdf.c (tt_face_find_bdf_prop): Ditto.
2024-07-28 19:42:49 -04:00