Commit graph

8533 commits

Author SHA1 Message Date
Alexei Podtelezhnikov
c236e360e2 Merge branch 'heap_rast' into 'master'
[smooth] Dynamic pool allocation.

See merge request freetype/freetype!429
2026-05-05 20:14:46 -04:00
Alexei Podtelezhnikov
4fbf7dcc4c [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.
2026-05-05 20:07:31 -04: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
Yaroslav Kolomiiets
f2b3f96901 [build] Add a Plan 9 port.
* mkfile: Build instructions.
* build/plan9/p9lib.h: Standard lib replacement.
* build/plan9/README: Docs.
2026-04-22 09:01:21 -04:00
Alexei Podtelezhnikov
ce4105f913 * include/freetype/fttypes.h: Do not include stddef.h. 2026-04-21 19:52:37 -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
Suzuki, Toshiya (鈴木俊哉)
07d8d50a63 Update some VisualStudio project files to include HVF module.
* builds/windows/vc2010/freetype.vcxproj: Add hvf.c before ftlzw.c.
* builds/windows/visualc/freetype.vcproj: Add hvf.c before pcf.c.
* builds/windows/visualce/freetype.vcproj: Add hvf.c before pcf.c.
2026-03-23 19:36:36 +01:00
Debbie Goldsmith
8dff1b4b07 * builds/unix/configure.raw: Handle new HVF driver. 2026-03-23 19:36:36 +01:00
Debbie Goldsmith
2228a8b446 * meson.build, meson_option.txt: Handle new HVF driver.
(hvf): New option.
2026-03-23 19:36:36 +01:00
Debbie Goldsmith
39dab7d2cd * CMakeLists.txt: Handle new HVF driver.
(FT_DISABLE_HVF): New option.
2026-03-23 19:36:36 +01: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
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
Werner Lemberg
402fa01ad9 * subprojects/harfbuzz.wrap: Updated. 2026-03-22 15:51:57 +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
78d65241aa ttnameid.h: Minor documentation improvement. 2026-03-20 08:06:02 +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
99b479dc34 .gitlab-ci.yml: Upgrade Windows pipelines. 2026-03-10 12:17:14 -04: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
Alexei Podtelezhnikov
e7d2cc6466 * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Fix memory leak.
This leak was introduced in 85c8efe0af by overlooking the
direct `ft_bitmap_glyph_init` call (now gone). Fixes #1399,
also reported earlier:
  https://issues.oss-fuzz.com/issues/482909897.
2026-03-09 22:14:01 -04:00
Alexei Podtelezhnikov
06ec4ef453 * src/raster/ftraster.c (Conic_To, Cubic_To): Avoid UB.
Fixes #1396.
2026-03-09 20:22:45 -04:00
Alexei Podtelezhnikov
bf18015d3a [stroker] Actually validate outlines.
Fixes #1400.

* src/base/ftstroke.c (FT_Glyph_Stroke): Check for `GetCount` error.
(ft_stroke_border_get_counts): Actually return expected error.
(FT_Glyph_Stroke): Minor.
2026-03-09 19:53:30 -04:00