Commit graph

6245 commits

Author SHA1 Message Date
Alexei Podtelezhnikov
5a280ecde6 * src/truetype/ttgxvar.c (TT_Get_Var_Design): Zero extras.
Fixes #1436.
2026-05-13 21:53:23 -04:00
Alexei Podtelezhnikov
8fa928f161 * src/type1/t1load.c (T1_Get_Var_Design): Updated. 2026-05-13 21:31:32 -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
3c364321ad [smooth, raster] Fix signedness warning.
* src/smooth/ftgrays.c (gray_convert_glyph): Use unsigned estimate.
* src/raster/ftraster.c (ft_black_render): Ditto and expand.
2026-05-12 19:14:54 -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
9a4751a61d * src/base/ftbitmap.c (FT_Bitmap_Blend): Fix undefined shift.
Reported in
  https://issues.oss-fuzz.com/issues/510113351
2026-05-09 09:51:56 -04:00
Alexei Podtelezhnikov
2c041d32fa * src/base/ftbitmap.c (FT_Bitmap_Blend): Refactor to avoid warnings. 2026-05-09 09:03:57 -04:00
Alexei Podtelezhnikov
8cbc8a7758 * src/smooth/ftgrays.c: Comments expanded. 2026-05-08 21:21:45 -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
Mateusz Jurczyk
7e3750982b * src/truetype/ttinterp.c (TT_RunIns): Remove dead code.
Fixes #1433.
2026-05-07 13:25:40 +00:00
Mateusz Jurczyk
968af86bec * src/psaux/psintrp.c (cf2_interpT2CharString): Fix off-by-one in the subroutine nesting depth check.
Fixes #1432.
2026-05-07 13:16:55 +00:00
Mateusz Jurczyk
1ec3406aef * src/psaux/psstack.c (cf2_stack_roll): Process top stack elements instead of bottom ones.
Fixes #1431.
2026-05-07 13:13:16 +00:00
Mateusz Jurczyk
287206a96b * src/truetype/ttinterp.c (Ins_WCVTF): Add missing CVT copy-on-write protection.
Fixes #1430.
2026-05-07 13:00:15 +00:00
Mateusz Jurczyk
df2fb115bf * src/psaux/psintrp.c (cf2_doBlend): Implement proper bounds check accounting for all operands.
Fixes #1429.
2026-05-07 12:47:52 +00:00
Mateusz Jurczyk
1f705ffb71 * src/psaux/psstack.c (cf2_stack_setReal): Fix off-by-one in index check.
Fixes #1428.
2026-05-07 12:31:59 +00:00
Alexei Podtelezhnikov
b6bcd2177f * src/base/ftbitmap.c (FT_Bitmap_Blend): Check final dimensions.
Fixes #1413.
2026-05-03 13:21:19 -04:00
Alexei Podtelezhnikov
53850f3cd5 * src/base/ftbitmap.c (FT_Bitmap_Blend): Refactor. 2026-05-03 13:10:01 -04:00
Alexei Podtelezhnikov
cbe12767ea * src/base/ftobjs.c (FT_Render_Glyph_Internal): Protect FT_LOAD_COLOR.
Now only *scalable* COLRv0 layers can be rendered with FT_LOAD_COLOR,
in accordance with Chromium. Fixes #1425, also see !424.
2026-05-02 15:17:35 -04:00
Alexei Podtelezhnikov
590b77014b * src/base/ftobjs.c (FT_Render_Glyph_Internal): Formatting. 2026-05-02 15:09:51 -04:00
Alexei Podtelezhnikov
6d9fc45fc4 * src/truetype/ttgxvar.c (tt_delta_shift): Use unsigned references. 2026-04-28 18:56:18 -04:00
Alexei Podtelezhnikov
0d45c7f191 [truetype/GX] Fix signed overflow.
Fixes #1423.

* src/truetype/ttgxvar.c (tt_interpolate_deltas, tt_delta_interpolate):
Use unsigned counters.
2026-04-27 22:33:16 -04:00
Alexei Podtelezhnikov
5d1099341f [truetype] Reduce zone copying.
* src/truetype/ttinterp.c (Compute_Point_Displacement): Reduce
zone copying and return reference on demand only.
(Ins_SHP, Ins_SHC, Ins_SHZ): Updated accordingly.
2026-04-26 09:38:34 -04:00
Alexei Podtelezhnikov
c8c8b4b8a0 [truetype] Simplify shift conditions.
* src/truetype/ttinterp.c (Compute_Point_Displacement,
Ins_SHP, Ins_SHPIX): Use 'FT_UInt" as point references.
(Ins_SHC, Ins_SHZ): Ditto and simplify repeated condition.
2026-04-26 08:36:25 -04:00
Alexei Podtelezhnikov
85c20f4e78 * src/truetype/ttinterp.c (Move_Zp2_Point): Remove 'touch'.
Update all callers.
2026-04-26 08:32:13 -04:00
Alexei Podtelezhnikov
6d0ae3ae94 [truetype] Fix SHZ according to specifications.
SHZ must shift the zone specified by its arguments. Previously,
it was shifting zp2 instead.

* src/truetype/ttinterp.c (Ins_SHZ): Rewrite to specifications.
2026-04-26 08:26:52 -04:00
Alexei Podtelezhnikov
7d600a022e * src/truetype/ttinterp.c (Ins_SHZ): Fix the range limit (cont'd).
Fixes
    https://issues.oss-fuzz.com/issues/505900175
2026-04-23 21:54:58 -04:00
Alexei Podtelezhnikov
1803559c4e * src/truetype/ttinterp.c (Ins_SHZ): Fix the range limit.
Fixes #1419 and #1420, as well as
    https://issues.oss-fuzz.com/issues/499455833
2026-04-22 20:49:51 -04:00
Alexei Podtelezhnikov
7974be74d8 * src/truetype/ttinterp.c (Ins_IUP): Use unsigned counter.
Fixes #1421.
2026-04-22 16:04:14 -04:00
Werner Lemberg
867c296b90 * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Use FT_MulDiv.
Problem reported as

  https://issues.oss-fuzz.com/issues/505058300
2026-04-21 22:12:09 +02:00
Alexei Podtelezhnikov
0db9ecac02 * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use unsigned counts.
This helps Plan 9 compilation.
2026-04-21 14:00:19 -04:00
Alexei Podtelezhnikov
a6d486002d * src/truetype/ttdriver.cv (tt_glyph_load): Remover redundancies.
Fixes #1417, found by `cppcheck`.
2026-04-12 22:46:32 -04:00
Alexei Podtelezhnikov
18a463c2fb * src/sdf/ftsdf.c (sdf_*_to): Remover redundant checks.
Fixes #1417, found by `cppcheck`.
2026-04-12 22:34:21 -04:00
Alexei Podtelezhnikov
ca53609f3c [pcf] Limit bitmap allocation and loading.
Loading huge bitmaps now requires selecting huge size, fixes #1411.

* src/pcf/pcfread.c (pcf_get_metrics): Remove/delay sanity checks.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Sanitize bitmap dimensions.
2026-04-12 12:00:47 -04:00
Alexei Podtelezhnikov
3221895b3f * src/smooth/ftsmooth.c (ft_smooth_raster_lcd): Fix clip_box.
The bug is discussed in #1412, without security repercussions.
2026-04-11 11:12:02 -04:00
Alexei Podtelezhnikov
32c0722622 * src/type1/t1parse.c (T1_Get_Private_Dict): Minor.
Fixes #1416.
2026-04-11 09:31:18 -04:00
Werner Lemberg
ef54557bda [autofit] Prevent signed integer overflow.
Reported as

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

* src/autofit/aflatin.c (af_move_contour_vertically): Use `ADD_LONG`.
2026-04-03 06:27:32 +02:00
Werner Lemberg
cc1adf8d64 [hvf] Correctly initialize driver if no HVF library is available.
Since this font driver is by default enabled in `modules.cfg` and its
availability controlled by `FT_CONFIG_OPTION_HVF`, we need to provide some
stubs so that HVF fonts can be correctly rejected if there is no HVF library
available.

Fixes issue #1409.

* src/hvf/hvfdrv.c (hvf_driver_class): Provide `hvf_face_init` and
  `hvf_slot_load_glyph` unconditionally.

* src/hvf/hvfload.c, src/hvf/hvfload.h (hvf_slot_load_glyph)
  [!FT_CONFIG_OPTION_HVF]: Define stub.
* src/hvf/hvfobjs.c, src/hvf/hvfobjs.h (hvf_face_init)
  [!FT_CONFIG_OPTION_HVF]: Define stub.
2026-04-03 04:20:24 +00:00
Werner Lemberg
675a94f5d0 [autofit] Prevent signed integer overflow.
Reported as

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

* src/autofit/aflatin.c
  (af_glyph_hints_apply_vertical_separation_adjustments): Use `ADD_LONG` and
  `SUB_LONG`.
2026-04-02 07:56:04 +02: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
Alexei Podtelezhnikov
eb13f81a48 * src/truetype/ttinterp.c (TT_MulFix14_i386): Typo.
Fixes #1408.
2026-03-23 14:26:02 -04:00
Rudi Heitbaum
a3c1a452df * src/base/ftstroke.c (ft_stroke_border_get_counts): Remove variable. 2026-03-23 10:44:12 -04: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
David Pokora
67c52a0b68 [psaux] Avoid stack overflow.
* src/psaux/t1.decode.c (t1_decoder_parse_charstrings) [op_pop]: Check stack
  size.

Fixes issue #1406.
2026-03-22 06:28:57 +01:00
Werner Lemberg
238dd13d7d * src/psaux/t1decide.c (t1_decoder_parse_charstrings): Fix bounds check.
During charstring processing, the `decoder->len_buildchar` field can be
corrupted.  Avoid this by caching this value in a local variable at function
entry.

Based on a patch submitted by David Pokora <david.pokora@trailofbits.com>.

Fixes issue #1405.
2026-03-22 06:22:31 +01:00
Werner Lemberg
4130e62d23 * src/sdf/ftsdf.c (sdf_generate_bounding_box): Fix thinko.
Bug introduced in commit bda1d87f69.

We would need an `FT_NEW_ARRAY_MULT` array...

Reported as

  https://issues.oss-fuzz.com/issues/494362618
2026-03-20 07:47:10 +01:00
Alexei Podtelezhnikov
3d7c50d13c [sfnt/COLRv0] Revise sanity checks.
This re-implements 6d62076a and potentially fixes #1404. 

* src/sfnt/ttcolr.c (tt_face_get_colr_layer): Rely on validated total num_layers.
2026-03-19 12:26:32 -04:00
Alexei Podtelezhnikov
5846b6eda6 * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix allocation.
Fixes #1403, proposed by Chris Anderson.
2026-03-19 08:18:59 -04:00
Werner Lemberg
bda1d87f69 * src/sdf/ftsdf.c (sdf_generate_bounding_box): Fix allocation.
Reported in

  https://mail.gnu.org/archive/html/freetype-devel/2026-02/msg00005.html
2026-03-18 14:45:57 +01:00
Werner Lemberg
264b5fbf5b Update all copyright notices. 2026-03-11 17:27:07 +01:00
Alexei Podtelezhnikov
dc17b79e1a [base] Reintroduce overall rendering limits.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Limit absolute
outline coordinnates to prevent integer issues downstream.
2026-03-09 22:53:06 -04:00