2099 Commits
Author SHA1 Message Date
Alexei Podtelezhnikov 2045ea3920 [base] Use unsigned zero-based refcounts.
This reverts 67cf7a88 to unsigned refcounts, with conditional decrements.

* include/freetype/internal/ftobjs.c (FT_Face_InternalRec,
FT_LibraryRec): Make `refcount' unsigned.
* src/base/ftobjs.c (FT_New_Library, ft_open_face_internal): Keep it zero.
(FT_Done_Library, FT_Done_Face): ... and decrement it conditionally.
2026-11-03 10:25:11 -05:00
Behdad Esfahbod 2b01fa2d67 [truetype] Remove TT_CONFIG_OPTION_NO_BORING_EXPANSION.
Despite its name, this option only gated 'avar' version 2 support.
FreeType 2.15.0 includes the complete boring-expansion set of proposals,
now released as ISO Open Font Format, fifth edition
(ISO/IEC 14496-22:2026).  Gating just avar2 no longer makes sense,
especially since it has also been shipping on Apple platforms for
four years.

* include/freetype/config/ftoption.h, devel/ftoption.h
  (TT_CONFIG_OPTION_NO_BORING_EXPANSION): Remove.
* src/truetype/ttgxvar.c (ft_var_load_avar): Remove configuration guards.

* docs/CHANGES: Updated.

All five Meson regression tests pass with the removed macro still
defined.  avar1 and avar2 coordinate mapping agrees with FontTools.

Assisted-by: OpenAI Codex
2026-10-21 19:57:57 +02:00
Alexei Podtelezhnikov 05f343a64b * include/freetype/internal/ftcalc.h (UABS, ULABS): Fix macros. 2026-10-17 04:27:55 -04:00
Werner Lemberg 37515cf56b * Version 2.15.0 released.
==========================

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

* docs/VERSION.TXT: Add entry for version 2.15.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.14.3/2.15.0/, s/2143/2150/.

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

* builds/unix/configure.raw (version_info): Set to 26:7:20.
* CMakeLists.txt (VERSION_MINOR): Set to 15.
(VERSION_PATCH): Set to 0.
2026-10-11 22:46:16 +02:00
Behdad Esfahbod (بهداد اسفهبد) 0d1328f1d8 [truetype] Support cubic outlines in 'GLYF' table.
Preserve the cubic flag while loading extended simple glyphs, including
on-curve points whose state can be changed by TrueType instructions.

Teach outline decomposition, stroking, and rasterization to handle cubic
contours with implied on-curve points, including contours with no explicit
on-curve points.  Continue to ignore the reserved flag in the classic 'glyf'
table.

Tested with a synthetic font with a 'GLYF' table covering all-off contours,
implied cubic endpoints, gray and monochrome rendering, and stroking.  The
full Meson test suite also passes.

Assisted-by: OpenAI Codex <noreply@openai.com>

* include/freetype/ftimage.h (FT_CURVE_TAG): Extended for use with 'GLYF'
  table data.

* src/base/ftoutln.c (FT_Outline_Decompose), src/base/ftstroke.c
  (FT_Stroker_ParseOutline), src/raster/ftraster.c (Decompose_Curve),
  src/smooth/ftgrays.c (FT_Outline_Decompose) [STANDALONE_]: Extend parsing
  code to handle 'GLYF' cubic data.

* src/truetype/ttgload.c (CUBIC_FLAG): New flag macro.
  (TT_Load_Simple_Glyph): Check new flag.
2026-10-02 14:26:34 +02:00
Behdad Esfahbod (بهداد اسفهبد) 2966fc90f8 [sfnt] Support the 'DMAP' table.
Parse the optional, cmap-shaped delta map and apply its mappings before the
corresponding 'cmap' mappings.  Preserve sparse fallback for nominal
characters and variation sequences, including the variant-list APIs.

Also keep variation-only subtables from becoming the active Unicode
charmap when DMAP supplies the only nominal Unicode mapping.

Tested with the Meson test suite and synthetic fonts covering nominal
and UVS precedence, fallback, iteration, DMAP-only subtables, and
extended glyph IDs.

Assisted-by: OpenAI Codex <noreply@openai.com>

* include/freetype/internal/tttypes.h (TT_Face): New fields `dmap_table`,
  `dmap_size`, `dmap_charmaps`, `num_dmap_charmaps`, `dmap_results`,
  `dmap_max_results`.
* include/freetype/tttags.h (TTAG_DMAP): New macro.

* src/sfnt/sfobjs.c (sfnt_init_face, sfnt_done_face): Handle 'DMAP' table.

* src/sfnt/ttcmap.h (TT_CMap): Add fields `cmap_class` and `dmap`.
  Update function declarations.

* src/sfnt/ttcmap.c (tt_cmap14_is_extended, tt_cmap14_get_info): Updated.

  (tt_cmap_free, tt_cmap_new, tt_face_add_dmap, tt_cmap_is_variation,
  tt_face_find_unicode_dmap, tt_face_find_dmap, tt_cmap_dmap_done,
  tt_cmap_dmap_char_index, tt_cmap_dmap_char_next,
  tt_cmap_dmap_char_var_index, tt_cmap_dmap_char_var_isdefault,
  tt_cmap_dmap_merge, tt_cmap_dmap_variants, tt_cmap_dmap_char_variants,
  tt_cmap_dmap_variant_chars, tt_cmap_dmap_get_info): New functions for
  'DMAP' support.

  (tt_cmap_dmap_class_rec): New cmap class.

  (tt_face_build_cmaps): Rename to...
  (tt_face_build_cmaps_from_table): ...  this and handle both cmap and dmap
  data.

  (tt_face_build_cmaps, tt_face_expose_dmap, tt_face_build_dmaps,
  tt_face_done_dmaps): New functions.

* src/sfnt/ttload.c (tt_face_load_cmap): Also handle 'DMAP' table.
2026-10-02 14:07:42 +02:00
Behdad Esfahbod (بهداد اسفهبد) 02881ccbfe [sfnt] Support 'cmap' format 15.
Share the format 14 variation-sequence implementation while reading the
format 15 non-default glyph IDs as 24-bit values.  Expose format 15 through
the existing Unicode variation-sequence APIs.

Assisted-by: OpenAI Codex <noreply@openai.com>

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

* src/base/ftobjs.c (find_variant_selector_charmap): Updated.
* src/sfnt/ttcmap.c: Use `TT_CONFIG_CMAP_FORMAT_15`.
  (tt_cmap14_is_extended): New function.
  (tt_cmap14_validate): Rename to...
  (tt_cmap14_validate_internal): ...this, add argument `is_extended`.
  Handle format 15.

  (tt_cmap14_validate) [TT_CONFIG_CMAP_FORMAT_14]: New function.
  (tt_cmap15_validate) [TT_CONFIG_CMAP_FORMAT_15]: New function.

  (tt_cmap14_get_info, tt_cmap14_char_map_nondef_binary,
  tt_cmap14_char_var_index, tt_cmap14_char_var_isdefault,
  tt_cmap14_char_variants, tt_cmap14_get_nondef_chars,
  tt_cmap14_variant_chars): Updated.

  (tt_cmap15_class_rec) [TT_CONFIG_CMAP_FORMAT_15]: New structure.

* src/sfnt/ttcmapc.h: Register `tt_cmap15_class_rec`.
2026-10-02 11:39:24 +02:00
Behdad Esfahbod (بهداد اسفهبد) 3b3d55e58c [truetype] Support the 'GVAR' table.
Read the 24-bit glyph count in the uppercase header and the 24-bit data
offset in each glyph variation record.  Prefer 'GVAR' for 'GLYF' outlines
while preserving 'gvar' behavior.

Assisted-by: OpenAI Codex <noreply@openai.com>

* include/freetype/tttags.h (TTAG_GVAR): New macro.

* src/truetype/ttgxvar.h (GX_BlendRec): New field `gvar_is_extended`.
* src/truetype/ttgxvar.c (GX_GVar_Head): Use `FT_UInt32` for `glyphCount`.
  (ft_var_load_gvar): Handle 'GVAR' table.
  (TT_Vary_Apply_Glyph_Deltas): Updated.
  Also check `dataSize`.
2026-10-02 11:11:08 +02:00
Behdad Esfahbod (بهداد اسفهبد) ef5ad0f403 [sfnt] Support 'HHEA', 'VHEA', 'HMTX', and 'VMTX' metrics tables.
Read the 32-bit metric counts in 'HHEA' and 'VHEA', and use their 'HMTX'
and 'VMTX' companions.  Keep the wide counts internally while saturating
the legacy public header fields.

Assisted-by: OpenAI Codex <noreply@openai.com>

* include/freetype/internal/tttypes.h (TT_Face): New fields
  `horz_metrics_count`, `horz_metrics_is_extended`, `vert_metrics_count`,
  `vert_metrics_is_extended`.
* include/freetype/tttags.h (TTAG_HHEA, TTAG_HMTX, TTAG_VHEA, TTAG_VMTX):
  New macros.

* src/sfnt/sfobjc.c (sfnt_load_face): Updated.
* src/sfnt/ttload.c (check_table_dir, tt_face_load_font_dir): Updated.
* src/sfnt/ttmtx.c (tt_face_load_hmtx): Updated.
  (tt_face_load_hhea): Handle 'HHEA' and 'VHEA' tables.
  (tt_face_get_metrics): Updated.
2026-10-02 10:58:05 +02:00
Behdad Esfahbod (بهداد اسفهبد) 1b8f5df3a3 [truetype] Support 'GLYF' and 'LOCA' tables.
Prefer 'GLYF' and its 'LOCA' companion over the 'glyf' and 'local' tables.
Allow the extended location table to describe more than 65535 glyphs.

Assisted-by: OpenAI Codex <noreply@openai.com>

* include/freetype/internal/tttypes.h (TT_Face): New field `is_extend_glyf`.
* include/freeetype/tttags.h (TTAG_GLYF, TTAG_LOCA): New macros.

* src/sfnt/sfobjs.c (sfnt_init_face): Prefer 'GLYF' over 'glyf' table.
  (sfnt_load_face): Updated.

* src/truetype/ttpload.c (tt_face_load_loca): Allow 'GLYF' table.
2026-10-02 10:44:47 +02:00
Behdad Esfahbod (بهداد اسفهبد) 3b8912bc0f [sfnt] Support the 'MAXP' table.
Prefer 'MAXP' over 'maxp' and read its 24-bit glyph count.  Keep the wide
count internally while saturating the legacy public `TT_MaxProfile` field.

Assisted-by: OpenAI Codex <noreply@openai.com>

* include/freetype/internal/tttypes.h (TT_Face): New field
  `maxp_num_glyphs`.
* include/freetype/tttags.h (TTAG_MAXP): New macro.

* src/sfnt/sfobjs.c (sfnt_load_face): Updated.
* src/sfnt/ttcmap.c (tt_face_build_cmaps): Updated.
* src/sfnt/ttload.c (tt_face_load_maxp): Handle 'MAXP' table.
* src/sfnt/ttpost.c (load_post_names, tt_face_get_ps_name): Updated.
2026-10-02 10:36:34 +02:00
Alexei Podtelezhnikov a98c7c223a [base] More overflow protections.
FT_ABS() can overflow for INT_MIN and LONG_MIN, reported as
  https://issues.chromium.org/issues/563962723

We introduce and use ULABS() nd UABS() to avoid that.

* include/freetype/internal/ftcalc.h: Add ULABS and UABS.
* src/base/ftcalc.c (FT_Matrix_Check, ft_corner_orientation): Updated.
2026-09-20 18:40:21 -04:00
Behdad Esfahbod a69e39ad9e [varc] Support static component axes.
The VARC draft permits static fonts without a 'fvar' table to retain 'gvar'
or 'CFF2' variation data for component-internal coordinates.  Initialize a
private blend from the relevant variation store without exposing those axes
through the public MM API.

Also add TrueType and CFF2 regression fonts.

* src/truetype/ttvarc.c (tt_face_init_varc_axes): New function.
  (tt_face_load_varc_glyph): Handle static VARC fonts.
* src/tyuetype/ttvarc.h: Updated.

* src/cff/cffdrivr.c (cff_varc_init_axes): New function.
  (cff_varc_load_glyph): Use it.
  (cff_service_varc): Updated.

* src/truetype/ttgxvar.c (ft_var_load_gvar, TT_Get_MM_Var): Handle static
  VARC fonts.
  (tt_var_init_gvar, tt_var_init_blend): New functions.
  (tt_done_blend): Updated.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttdriver.c (tt_service_varc): Updated.

* include/freetype/internal/services/svvarc.h (FT_VARC_Init_Axes_Func): New
  typedef.
  (FT_ServiceVARC): Updated.

* tests/data/varc-static-gvar.ttf, tests/data/varc-static-cff2.otf: New test
  fonts.
* tests/varc/main.c: Updated.
2026-09-18 17:07:35 +02:00
Behdad Esfahbod (بهداد اسفهبد) d939d15557 [cff, truetype] Add VARC (Variable Composites) table support.
The Variable Composites ('VARC' table) technology allows font glyphs to
reuse variants of other glyph shapes as their components.  This is similar
to a feature that some font design tools already provide to designers, for
example, Glyphs calls this 'Smart Components'.  The 'VARC' table allows us
carrying that design all the into the font binary file.

This enables significant file size saving in CJK fonts, for example, up
to 90% savings for simple Hangul shapes.

The 'VARC' table is part of the ISO Open Font Format version 5, and is
implemented and enabled by default in HarfBuzz since 12.0.0 (Sep 2025) and
FontTools.

For test fonts, see

  https://github.com/notofonts/noto-cjk-varco/releases

* include/freetype/config/ftoption.h, devel/ftoption.h
  (TT_CONFIG_OPTION_VARC): New macro.
* include/freetype/tttags.h (TTAG_VARC): New macro.
* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC11): New macro.
* include/freetype/internal/fttrace.h (ttvarc): New macro.

* include/freetype/internal/tttypes.h (TT_FaceRec) [TT_CONFIG_OPTION_VARC]:
  New fields `tt_varc`, `face_varc`, `varc`, `varc_context`, and
  `varc_loading_components`.

* src/base/ftobjs.c [TT_CONFIG_OPTION_VARC]: Include `svvarc.h`.
  (FT_Load_Glyph) [TT_CONFIG_OPTION_VARC]: Don't use auto-hinting for VARC
  glyphs.

* include/freetype/internal/services/svvarc.h, src/truetype/ttvarc.c,
  src/truetype/ttvarc.h: New files.

* src/truetype/rules.mk (TT_DRV_SRC): Add `ttvarc.c`.

* src/truetype/truetype.c: Include `ttvarc.c`.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_VARC]: Include `svvarc.h` and
  `ttvarc.h`.
  (tt_service_varc, tt_services) [TT_CONFIG_OPTION_VARC]: New structures.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_VARC]: Include `ttvarc.h`.
  (TT_Load_Glyph) [TT_CONFIG_OPTION_VARC]: Handle VARC glyphs.

* src/cff/cffdrivr.c [TT_CONFIG_OPTION_VAR]: Include `svvarc.h`.
  (cff_varc_load, cff_varc_done, cff_varc_has_glyph, cff_varc_load_glyph,
  cff_service_varc) [TT_CONFIG_OPTION_VAR]: New wrapper functions and
  structure to provide the VARC service.
  (cff_services): Updated.
* src/cff/cffgload.c [TT_CONFIG_OPTION_VARC]: Include `svvarc.h`.
  (cff_slot_load) [TT_CONFIG_OPTION_VARC]: Handle VARC glyphs.

* src/sfnt/sfobjs.c [TT_CONFIG_OPTION_VARC]: Include `svvarc.h`.
  (sfnt_init_face) [TT_CONFIG_OPTION_VARC]: Load the VARC service.
  (sfnt_load_face) [TT_CONFIG_OPTION_VARC]: Try to load the 'VARC' table.
  (sfnt_done_face) [TT_CONFIG_OPTION_VARC}: Clean up VARC handling.
2026-08-19 04:04:54 +00:00
Elliott Sales de Andrade b04f789a88 * include/freetype/internal/ftdebug.h: Fix logging if NDEBUG is set.
In Meson, the default for `b_ndebug` is `is-release`, which will enable it
when in release mode.  Additionally, in `dlg`, the default log level is
`warn` if `NDEBUG` is set or `trace` otherwise.  Because `FT_LOG` uses the
`trace` level always, all debug logging will be disabled if `b_ndebug` is
set (or in release mode).

Using `NDEBUG` is not documented anywhere to toggle debug logging.  We thus
define `DLG_LOG_LEVEL` so that `trace` level is always output by `dlg`.
FreeType's other (runtime or otherwise) configuration remains as it is to
toggle logging per-component.
2026-08-01 08:25:41 +02:00
Behdad EsfahbodandClaude Opus 4.8 18e4a9aa70 [truetype] Cache item-variation-store region scalars. (3/5)
`tt_var_get_item_delta` (used, e.g., for 'HVAR' advance adjustment, called
once per glyph during glyph loading) recomputed `tt_calculate_scalar`
for every region on every call, although the result depends only on the
normalized coordinates -- which stay constant while glyphs are loaded.

Cache the per-region scalars in the item variation store and recompute
them only when the coordinates change, detected by comparing against a
stored snapshot.  The snapshot check also transparently handles the
temporary coordinate swap performed during 'avar2' processing.  Output
(outlines and advances) is bit-identical; ~4% faster (1.58 -> 1.51 ms).

* include/freetype/internal/ftmmtypes.h (GX_ItemVarStoreRec): New fields
`regionScalars` and `cachedCoords`.

* src/truetype/ttgxvar.c (tt_var_get_item_delta): (Re)compute and cache
all region scalars when the coordinates differ from the cached snapshot,
then index the cache instead of recomputing per region; fall back to
direct computation if the cache cannot be allocated.
(tt_var_done_item_variation_store): Free the new fields.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 10:44:38 +02:00
Alexei Podtelezhnikov 7e0e56f84f Revert to signed span positioning.
In the context of FT_Outline_Render, the outline can be placed
arbitrarily and the resulting spans should be signed. This partially
reverts ef04e4eb20 and fixes #1410.  However, for internal use,
when outlines are placed in the first quadrant, we still can interpret
positions as unsigned.

* include/freetype/ftimage.h (FT_Span): Use signed position again.
* src/smooth/ftgrays.c (gray_sweep_direct): Sync with FT_Span.
* src/smooth/ftsmooth.c (ft_smooth_lcd_spans, ft_smooth_lcdv_spans,
ft_smooth_overlap_spans): Prevent sign extension.
2026-05-17 12:29:34 -04:00
Deborah Goldsmith c39ca391b3 [hvf] Fix macro usage and metrics calculations.
* src/hvf/hvfload.c (hvf_render_callback): Fix glyph loader macro calls
and metrics calculations.
* src/hvf/hvfobjs.c (hvf_refresh_axis_coordinates,
hvf_init_axis_coordinates): Tweak macro usage.
* src/hvf/hvfobjs.h (HVF_RenderContext): Remove `face`.

* include/freetype/ftmoderr.h: Add HVF error base.
2026-05-12 19:48:38 -04:00
Alexei Podtelezhnikov fae1e3160e [raster] Dynamic pool allocation.
Use pool allocation strategy similar to that of the smooth rasterizer.
This is beneficial at sizes larger than 100 ppem.

* src/raster/ftraster.c (Render_Single_Pass): Move pool allocation...
(ft_black_render): ... here. Allocate larger pools dynamically.

* include/freetype/config/ftoption.h: Update comment.
* devel/ftoption.h: Ditto.
2026-05-09 14:14:48 -04:00
Alexei Podtelezhnikov a39ef7632e [smooth] Dynamic pool allocation.
The fixed pool allocation on stack is very fast and works very well
for rendering glyphs smaller than 40 pixels. Larger glyphs have to be
split and rendered piecewise, which is slower.  This commit introduces
dynamic pool allocation for larger glyphs.  Complex large glyphs are
now rendered about 2x faster.

* src/smooth/ftgrays.c (gray_convert_glyph): Use simpler banding schema
in case of rendering emergency.
(gray_raster_render): Allocate larger pools dynamically.

* include/freetype/config/ftoption.h: Explain the render pool size.
* devel/ftoption.h: Ditto.
2026-05-08 18:14:53 -04:00
Alexei Podtelezhnikov ce4105f913 * include/freetype/fttypes.h: Do not include stddef.h. 2026-04-21 19:52:37 -04:00
Debbie Goldsmith 0c9b8e9e93 Support Hierarchical Variable Fonts (HVF) using Apple's 'libhvf' library.
The new 'hvf' module is a thin wrapper around 'libhvf' with the necessary
boilerplate stuff to integrate it into FreeType.  Note that this currently
works on macOS >= 15.4 and iOS >= 18.4 only.

* include/freetype/tttags.h (TTAG_hvgl, TTAG_hvpm): New macros.
* include/freetype/config/ftmodule.h: Add `hvf_driver_class`.
* include/freetype/internal/fttrace.h: Add tracing tags `hvfdrv`, `hvfobjs`,
  and `hvfload`
* include/freetype/internal/services/svfntfmt.h (FT_FONT_FORMAT_HVF): New
  macro.

* modules.cfg (FONT_MODULES): Add `hvf` module.

* src/sfnt/sfobjc.s (sfnt_init_face): Handle 'hvgl' table.

* src/hvf/*: New files.
2026-03-23 19:36:36 +01:00
Debbie Goldsmith 00e6a1bca9 Add flag FT_CONFIG_OPTION_HVF.
This flag is going to be used to conditionally compile support for Apple's
Hierarchical Variable Font (HVF) format.

* devel/ftoption.h, include/freetype/config/ftoption.h
  (FT_CONFIG_OPTION_HVF): New flag.
2026-03-23 19:36:36 +01:00
Werner Lemberg 0a0221a134 * Version 2.14.3 released.
==========================

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

* docs/VERSION.TXT: Add entry for version 2.14.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.14.2/2.14.3/, s/2142/2143/.

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

* builds/unix/configure.raw (version_info): Set to 26:6:20.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
2026-03-22 16:07:10 +01:00
Werner Lemberg 78d65241aa ttnameid.h: Minor documentation improvement. 2026-03-20 08:06:02 +01:00
Werner Lemberg 264b5fbf5b Update all copyright notices. 2026-03-11 17:27:07 +01:00
Werner Lemberg f4205da148 * Version 2.14.2 released.
==========================

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

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

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
  builds/windows/visualc/index.html, builds/windows/visualce/index.html,
  builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
  docs/freetype-config.1: s/2.14.1/2.14.2/, s/2141/2142/.

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

* builds/unix/configure.raw (version_info): Set to 26:5:20.
* CMakeLists.txt (VERSION_PATCH): Set to 2.
2026-03-01 14:55:17 +01:00
Werner Lemberg 109d617da2 Very minor doc fixes. 2026-03-01 12:22:58 +01:00
Alexei Podtelezhnikov be8e126ae0 [base] Clean up bitmap allocations.
* src/base/src/base/ftobjs.c (ft_glyphslot_alloc_bitmap): Use preset
dimensions and call FT_MEM_ALLOC_MULT.
* include/freetype/internal/ftobjs.h (ft_glyphslot_alloc_bitmap):
Updated signature...
* src/*: ... and all callers.
2026-02-20 22:50:50 -05:00
Alexei Podtelezhnikov d41d494341 * include/freetype/config/mac-support.h: Check for FT_MACINTOSH.
Fixes warnings reported in !414.
2026-02-07 11:03:25 -05:00
Alexei Podtelezhnikov 7cc8f37b9a [base, smooth] Implement direct LCD filtering.
Applying an LCD filter to spans rather than the entire image improves
the performance of ClearType-like rendering by about 40% at 32 ppem
and much more at larger sizes.  Small rounding differences are expected.

* src/smooth/ftsmooth.c (ft_smooth_raster_lcd, ft_smooth_lcd_spans,
ft_smooth_raster_lcdv, ft_smooth_lcdv_spans, TOrigin): Implement it.
* include/freetype/internal/ftobjs.h (FT_LibraryRec): lcd_filter_func gone.
* src/base/ftlcdfil.c (ft_lcd_filter_fir): Removed.
(ft_lcd_padding): Use padding sufficient for any 5-tap filter.
(FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated.
* docs/CHANGES: Updated.
2026-01-26 12:43:28 -05:00
Alexei Podtelezhnikov e8f0969dcf [base, smooth] Remove LCD filter from face properties.
This removes the internal face property that sets the filtering weights.
The global filtering algorithms and weights are now optimized to work
well under all conditions.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Do it.
* include/freetype/freetype.h (FT_Face_Properties): Revised docs.
* include/freetype/ftparams.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS): Ditto.
* src/base/ftlcdfil.c (ft_lcd_padding): Updated.
* src/base/ftobjs.c (ft_open_face_internal, FT_Face_Properties): Ditto.
* src/smooth/ftsmooth.c (ft_smooth_render): Ditto.
* docs/CHANGES: Updated.
2026-01-25 15:00:08 -05:00
Alexei Podtelezhnikov 084bf2898b [base] Remove legacy LCD filter.
* src/base/ftlcdfil.c (_ft_lcd_filter_legacy): Removed.
(FT_Library_SetLcdFilter): Updated.
* include/freetype/ftlcdfil.h (FT_LcdFilter): Updated.
* doc/CHANGES: Updated.
2026-01-25 14:51:59 -05:00
Alexei Podtelezhnikov ef04e4eb20 [base, smooth] Fortify direct rendering.
This is a better fix for #1384, which is rather about signed overflow.

* include/freetype/ftimage.h (FT_Span): Use unsigned position.
* src/smooth/ftgrays.c (gray_sweep_direct): Sync with FT_Span.
* src/smooth/ftsmooth.c (ft_smooth_render): Remove redundant shift.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Readjust limits.
2026-01-17 22:55:16 -05:00
Werner Lemberg 5751c184cc Improve documentation of the 'BDF ' table as used in X11 .otb files.
Also do some minor code formatting.
2025-12-04 07:46:36 +01:00
Alexei Podtelezhnikov fc9cc5038e [cff] Handle underline position and thickness as integers.
This is done for consistency with Type 1 fonts.

* include/freetype/internal/cfftypes.h (CFF_FontRecDic): Change
the variable types.
* include/cff/cfftoken.h (CFF_FontRecDic): Change the parsing macros.
* src/cff/cffobjs.c (cff_face_init), src/cff/cffload.c (cff_subfont_load),
src/cff/cffdrivr.c (cff_ps_get_font_info): Update users.
2025-11-05 17:23:14 -05:00
Alexei Podtelezhnikov 3d871c5a0c Minor. 2025-11-04 20:08:04 -05:00
Alexei Podtelezhnikov 3532877461 [cff,cid,type1,type42] Fix up PS_FontInfo.
The italic angle is commonly specified in fractional degrees in
Type 1 fonts and its derivatives.  This change clarifies and fixes
these values.  Note that CFF fonts has always reported them as such,
but truncated the underline position and thickness.  Fixes #1367.

* include/freetype/t1tables.h (PS_FontInfoRec):
Use FT_Fixed for italic_angle.
* src/cid/cidtoken.h, src/type1/t1tokens.h, src/type42/t42parse.c:
Modify the italic_angle token.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Fix the underline
position and thickness.

* docs/CHANGES: Note this change.
2025-11-04 19:21:49 -05:00
Alexei Podtelezhnikov 7e14994b02 * include/freetype/internal/ftobjs.h (ft_default_raster): Relic removed. 2025-09-12 12:57:50 -04:00
Werner Lemberg 526ec5c47b * Version 2.14.1 released.
==========================

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

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

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

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

* builds/unix/configure.raw (version_info): Set to 26:4:20.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2025-09-11 13:16:53 +02:00
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 32cb53904c Update all copyright notices. 2025-09-06 06:14:03 +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 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