Commit graph

8520 commits

Author SHA1 Message Date
Werner Lemberg
bf1f34d75e * subprojects/*: Fix meson wrap files. 2026-03-02 08:30:20 +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
8fb4b4ac55 * subprojects/*.wrap: Updated. 2026-03-01 13:56:17 +01:00
Werner Lemberg
109d617da2 Very minor doc fixes. 2026-03-01 12:22:58 +01:00
Alexei Podtelezhnikov
459af335b9 [truetype] Clean up TT_Load_Context.
* src/truetype/ttinterp.c (TT_Load_Context): Remove return type.
* src/truetype/ttinterp.h (TT_Load_Context): Update signature.
* src/truetype/ttobjs.c (tt_size_run_{fpgm,prep}): Update callers.
* src/truetype/ttgload.c (tt_loader_init): Ditto.
2026-02-22 23:13:22 -05:00
Alexei Podtelezhnikov
31db10d922 [truetype] Use FT_QALLOC_MULT.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Here.
This call provides builtin overflow protection. See #1382.
2026-02-21 00:03:07 -05:00
Alexei Podtelezhnikov
c111f0713c * src/base/ftbitmap.c (FT_Bitmap_Blend): Use FT_ALLOC_MULT.
This call is fortified with builtin overflow checks.
2026-02-20 23:48:14 -05:00
Alexei Podtelezhnikov
dd66971f3c [sdf] Substitute allocation macros.
* src/sdf/ftsdf.c (sdf_generate_bounding_box,
sdf_generate_with_overlaps): Use more robust macros.
2026-02-20 23:29:30 -05: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
156c7ea38f * src/sfnt/ttcolr.c (tt_face_colr_blend_layer): Use FT_ALLOC_MULT.
Fixes #1389. The overflow is detected in ft_mem_qrealloc.
2026-02-20 07:55:43 -05:00
Alexei Podtelezhnikov
85c8efe0af * src/base/ftglyph.c (ft_bitmap_glyph_init): Always copy in full.
Other glyph formats never perform lazy copy.  Fixes #1385.
2026-02-07 19:20:05 -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
e3a0652b6d [pshinter] Merge extrema and inflex analyses.
Any point on the horizontal or vertical segment, which can either
be either extreme or inflection point is now marked.  This makes
separate inflection algorithm unnecessary.  This simplifies the
algorithm without noticeable rendering differences.

* src/pshinter/pshalgo.c (psh_glyph_compute_extrema): Rewrite
to detect both extrema and inflection points. Determine the
their direction instantly.
2026-02-03 20:34:35 -05:00
Alexei Podtelezhnikov
676e8b8637 * src/sfnt/ttgpos.c (tt_face_validate_*): Fix check signedness.
This is an alternative to !398 without signed -1.
2026-02-03 20:16:32 -05:00
Alexei Podtelezhnikov
28407bc8cd * src/sfnt/sfwoff2.c (reconstruct_glyf): Revise variables.
This should fix #1379 while resonstructing the code intent.
2026-01-27 19:41:17 -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
83f543a82b * src/svg/ftsvg.c: Use FT_ALLOC_MULT.
Fixes #1378.
2026-01-22 09:07:12 -05:00
Harish Raja Selvan
95db5da7c6 * .gitlab-ci.yml: Add MSBuild for ARM64. 2026-01-19 16:30:23 -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
Alexei Podtelezhnikov
dad4640660 [base] Maintain overall rendering limits.
Reject rendering of outlines that stretch beyond 32767 pixels from
the origin,  which is further restricted to 10922 horizontal pixels
for LCD rendering with ClearType-like algorithms. 16-bit FT_Span is
one of the reasons to have this limit imposed, fixes #1384.

* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Impose global
rendering limits.
2026-01-15 21:09:56 -05:00
Harry Sintonen
a9babbcbc0 * src/autofit/ft-hb-ft.c (ft_hb_ft_reference_table): Use ft_sfree. 2026-01-13 15:39:29 +01:00
Alexei Podtelezhnikov
341049a95b [base] Set ppem-based rendering limits.
Many rendering timeouts occur when the outline stretches far beyond
the Em size.  Limiting the bounding box to 10 Em should reject such
requests.  It is still to possible scribble excessively within the set
limits.  At least, the memory usage will be curtained.

* src/base/ftobjs.c (ft_glyphslot_free_bitmap): Revise limits based
on ppem when available.
2026-01-09 18:22:15 -05:00
Werner Lemberg
b91f75bd02 [autofit] Prevent signed integer overflow.
Reported as

  https://issues.oss-fuzz.com/issues/473887994
  https://issues.oss-fuzz.com/issues/473912282

* src/autofit/afatin.c (af_latin_align_top_tilde,
  af_latin_align_bottom_tilde), src/autofit/afloader.c
  (af_loader_load_glyph): Use `FT_PIX_ROUND_LONG`, `FT_PIX_CEIL_LONG`, and
  `SUB_LONG`.
2026-01-07 07:19:07 +01:00
Werner Lemberg
5f524d04b4 [truetype] Prevent signed integer overflow.
Reported as

  https://issues.oss-fuzz.com/issues/473582311

* src/truetype/ttinterp.c (Ins_MDRP): Use `ADD_LONG` and `SUB_LONG`.
2026-01-06 22:12:18 +01:00
Werner Lemberg
4553f1c396 [autofit] Prevent signed integer overflow.
Reported as

  https://issues.oss-fuzz.com/issues/473582304

* src/autofit/afloader.c (af_loader_load_glyph): Use `ADD_LONG`.
2026-01-06 05:41:15 +01:00
Ben Wagner
26adb9ff98 Fix leak of exec->FDefs in tt_size_init_bytecode 2026-01-05 20:50:05 +00:00
Werner Lemberg
7b72c0f238 [autofit] Prevent signed integer overflow.
Reported as

  https://issues.oss-fuzz.com/issues/471525116

* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
  af_latin_stretch_bottom_tilde): Use `MUL_LONG`.
2026-01-04 07:30:19 +01:00
Celeste Liu
914b474030 [base] Fix support for format 13 charmaps.
According to the OpenType specification of the 'cmap' table, the pair (0,6)
for platform and encoding IDs is used for format 13 charmap tables.  Commit
ba6f3e18 (from 2017-01-17) introduced the `TT_APPLE_ID_FULL_UNICODE` macro
(i.e., encoding_id == 6, added to OpenType 1.8); however, the corresponding
cmap selection code wasn't updated.

Unicode's Last Resort font (https://github.com/unicode-org/last-resort-font)
can be used to test a format 13 charmap.

Fixes issue #1383.

* src/base/ftobjc.s (find_unicode_charmap): Support
  `TT_APPLE_ID_FULL_UNICODE`.

Signed-off-by: Celeste Liu <uwu@coelacanthus.name>
2026-01-04 07:13:27 +01:00
Werner Lemberg
fc85a25584 [ttgxvar] Check for overflow in array size computation.
Problem reported and analyzed by povcfe <povcfe2sec@gmail.com>.

Fixes issue #1382.

* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Do it.
2026-01-03 08:19:49 +01:00
Ben Wagner
23b6cd27ff Fix leak of exec in tt_size_init_bytecode
* src/truetype/ttobjs.c (tt_size_init_bytecode): Call `TT_Done_Context`
on `exec` if it has not yet been assigned to `size->context`.

Bug: https://issues.oss-fuzz.com/issues/467782706
2025-12-11 12:18:15 -05:00
Alexei Podtelezhnikov
30e45abe93 * src/pcf/pcfdrivr.c (PCF_Face_Init): Handle charmap errors.
This is a quick fix for #1377, more clean-ups to follow.
2025-12-05 00:40:13 -05:00
Werner Lemberg
f75ae3d06d * src/sfnt/ttbdf.c (tt_face_load_bdf_props): Fix size test.
This prevents a potential overflow on 32bit systems.

Problem reported by Zhao Zijie <zijie4@illinois.edu>.
2025-12-04 07:51:39 +01: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
Werner Lemberg
85161d7622 * src/otvalid/otvcommn.c (otv_FeatureList_validate): Fix array size check.
Reported by Marc Schönefeld.
2025-12-02 11:39:25 +01:00
Werner Lemberg
c54f1cbfa9 [otvalid] Minor formatting and comment fixes. 2025-12-02 11:39:25 +01:00
Alexei Podtelezhnikov
32fc0af222 [pshinter] Slightly simplify BlueShift application.
* src/pshinter/pshglob.c (psh_blues_scale_zones): Just divide.
2025-11-30 15:25:45 -05:00
Alexei Podtelezhnikov
04743f152a [pshinter] Slightly simplify BlueScale application.
* src/pshinter/pshglob.c (psh_globals_new): Update condition and
properly rescale BlueScale.
(psh_blues_scale_zones): Use it directly.
2025-11-30 15:24:42 -05:00
Alexei Podtelezhnikov
d783d336e6 [pshinter] Fix up degenerate contours.
* src/pshinter/pshalgo.c (psh_glyph_compute_extrema): Use correct
goto label and shortcut degenerate contours.
2025-11-30 12:44:04 -05:00
Alexei Podtelezhnikov
e63975ca64 * src/base/ftutil.c (FT_List_Finalize): Delay reading 'data'.
Fixes #1376.
2025-11-29 11:29:44 -05:00
Werner Lemberg
6a25214ae9 * src/autofit/afgsub.c (af_parse_gsub): Always init gsub_lookup_count.
Problem reported by Marc Schönefeld.
2025-11-29 07:00:41 +01:00
Werner Lemberg
582cea9ee1 [autofit] Fix handling of invalid GSUB lookup indices.
Problem reported by Marc Schönefeld.

HarfBuzz validates everything while processing OpenType tables in fonts.
However, the data returned by `hb_ot_layout_collect_lookups` is not
validated.  This commit adds proper checks.

* src/autofit/afglobal.h (AF_FaceGlobals): New field `gsub_lookup_count`.
* src/autofit/afgsub.c (af_parse_gsub): Set it.

* src/autofit/afadjust.c (af_reverse_character_map_new): Test result of
  `hb_set_next`.
2025-11-28 14:23:00 +01:00
Werner Lemberg
b848824d10 [sfnt] Fix GPOS handling.
Problem reported by Marc Schönefeld.

* src/sfnt/ttgpos.c (tt_face_validate_lookup_table, tt_face_load_gpos): Fix
  counting of fitting subtables by correctly rejecting invalid data.
2025-11-28 14:19:37 +01:00
Alexei Podtelezhnikov
590e35791d * builds/toplevel.mk (dist): Replace for with find ... -exec. 2025-11-27 22:21:35 -05:00
Suzuki, Toshiya (鈴木俊哉)
fe0a9649fc * builds/toplevel.mk (dist): -wholename -> -name.
POSIX does not request `find` to support '-wholename'.
`find ... -wholename '*/.git' -prune -o ...` can be
rewritten as `find ... -name '*/.git' -prune -o ...`
for POSIX find.  Fixes issue #1370.
2025-11-27 12:41:52 +00:00
suzuki toshiya
9d99611723 * .gitlab-ci.yml: update macos image to Tahoe:2025-09-30.
Fixes issue #1394.
2025-11-27 19:08:14 +09:00
Alexei Podtelezhnikov
6d4977d660 * builds/toplevel.mk (dist): Improve compatibility with BSD tar. 2025-11-17 12:12:34 -05: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
suzuki toshiya
c97efd28ca * src/tools/apinames.c (names_add): Remove unrequired cast of
`nm->hash` to int, which has been unrequired since eba2781a.

Fixes issue #1361.
2025-11-05 20:45:35 +09:00