Commit Graph

7152 Commits

Author SHA1 Message Date
Werner Lemberg 205d1ae43e Small clean-ups for the last few commits.
* include/freetype/fttrace.h (afwarp): Removed.
2021-07-12 22:03:25 +02:00
David Turner a212668c9f Remove obsolete AF_Angle type and related sources.
Move the af_sort_xxx() functions from afangles.c to afhints.c
in order to get rid of the obsolete angle-related types,
macros and function definitions.
2021-07-12 09:25:39 +02:00
David Turner 2f11522a2a Remove experimental auto-hinting 'warp' mode.
This feature was always experimental, and probably nevery worked
properly. This patch completely removes it from the source code,
except for a documentation block describing it for historical
purpose.
2021-07-12 09:25:22 +02:00
David Turner 15e889800a Remove experimental "Latin2" writing system (FT_OPTION_AUTOFIT2)
This code has always been experimental and was never compiled
anyway (FT_OPTION_AUTOFIT2 does not appear in ftoption.h or even
any of our build files).
2021-07-12 09:25:07 +02:00
Werner Lemberg 59e95b014a Update 'dlg' subproject. 2021-07-12 06:01:14 +02:00
Werner Lemberg 50d0033f7e meson.build: Minor doc fix. 2021-07-05 05:44:13 +02:00
Werner Lemberg 89c60eca67 * src/base/ftlcdfil.c (FT_Library_SetLcdGeometry): Fix argument.
Reported by Hin-Tak.
2021-07-05 05:41:53 +02:00
Werner Lemberg 5e32a03496 README.git: Revised. 2021-07-03 20:24:16 +02:00
Werner Lemberg a399fb89dc meson.build: Minor doc improvements. 2021-07-03 16:34:01 +02:00
Werner Lemberg 4cb8a88ac7 * meson_options.txt: Sort alphabetically; no final full stops. 2021-07-03 13:25:23 +02:00
Ben Wagner d3dc2da9b2 * src/truetype/ttgxvar.c (tt_set_mm_blend): Test `coords`.
It is undefined behavior to pass `NULL` to `memcpy`.  `coords' is
passed to `memcpy` but `TT_Get_MM_Blend` and `TT_Get_Var_Design`
explictly call `tt_set_mm_blend` with `coords` as `NULL`.  In
addition, `TT_Set_MM_Blend` has a similar possible issue.
2021-07-01 07:02:04 +02:00
Dominik Röttsches 286da6c528 [sfnt] Support PaintScale in 'COLR' v1 parsing.
* include/freetype/ftcolor.h (FT_PaintFormat): Renumber values, add
`FT_COLR_PAINTFORMAT_SCALE`.
(FT_PaintScale): New structure to represent 'PaintScale*' tables.
(FT_COLR_Paint): Updated.

* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration.
(read_paint): Parse 'PaintScale' and friends.
2021-07-01 06:49:03 +02:00
Dominik Röttsches 0348c627b1 [sfnt] Handle fonts without layer list in 'COLR' v1.
'COLR' v1 fonts do not necessarily need to have a layer list; for
this reason, 'fontTools' recently started generating fonts in a way
that drops the layer list if there are no layers in it.  This
results in the layer list offset becoming zero, which FreeType
treated as an invalid table.  Fix that and handle the case for layer
list offset being 0.  This slightly changes how we need to calculate
the starting offset for paints.

* src/sfnt/ttcolr.c (tt_face_load_colr): Handle case of layer list
offset being zero without outright rejecting table.
2021-07-01 06:15:22 +02:00
Alexei Podtelezhnikov f27b4834b7 * src/raster/ftraster.c (Render_Single_Pass): Simplify `band_stack'. 2021-06-30 10:54:59 -04:00
Werner Lemberg 90ecac4118 Update `CHANGES` file; other minor doc fixes. 2021-06-30 10:23:42 +02:00
Alexei Podtelezhnikov 69c3516c88 [raster] Do not skip the second pass without dropout control.
The second pass also fixes horizontal lines through the pixel centers.

* src/raster/ftraster.c (black_TWorker): Do not use `second_pass'.
(Render_Glyph): Skip the second pass only with the appropriate flag.
2021-06-29 23:51:23 -04:00
Alexei Podtelezhnikov 3696ac5a18 [raster] Handle sub-band stack locally.
* src/raster/ftraster.c (black_TWorker): Move `band_stack' from here..
(Render_Single_Pass): ... to here and accept limit arguments.
(Render_Glyph): Updated.
2021-06-29 23:27:10 -04:00
Anurag Thakur 7be47010e9 [CI] Introduce linux CI and refactor job names
* .gitlab-ci.yml: Added jobs for building freetype on linux.
2021-06-29 08:43:30 +02:00
Werner Lemberg e1b1b5422c ftcolor.h: Minor grammar fix. 2021-06-29 06:07:00 +02:00
Alexei Podtelezhnikov c852388df7 [raster] Handle Bézier stack locally.
* src/raster/ftraster.c (black_TWorker): Move `arcs' from here...
(Conic_To, Cubic_To): ... to here to tighten their scope.
(Bezier_Up, Bezier_Down): ... Take the current `arc' argument.
2021-06-28 23:26:10 -04:00
Dominik Röttsches 7d4e55c329 [sfnt] Improve paint limit checks
Paint tables can appear before the `base_glyphs_v1` offset if the
font is produced with the layer list before the base glyph list.  In
this case paint tables can occur after the layer list but before the
base glyph list.  Checks in the 'COLR' v1 code were rejecting fonts
with this layout.  Improve these checks by calculating a minimum
offset after which paint tables can occur and use that in safety
checks.

* src/sfnt/ttcolr.c (Colr, tt_face_load_colr): Declare
`paint_start_v1` and calculate that as the minimum of the end of
layer list and base glyph list.
(get_child_table_pointer, read_paint, tt_face_get_paint_layers):
Use that in safety checks.
2021-06-28 18:02:55 +02:00
Alexei Podtelezhnikov 3a278381ae [raster] Clean up vertical sweep.
* src/raster/ftraster.c (black_TWorker): Replace the current line
offset with the pointer and drop the increment.
(Function_Sweep_Init): Take values as arguments instead of pointers.
(Vertical_Sweep_*, Horizontal_Sweep_Init, Draw_Sweep): Updated.
2021-06-28 10:22:03 -04:00
Alexei Podtelezhnikov fb4511eb9a [raster] Make `band_top' local variable.
* src/raster/ftraster.c (black_TWorker): Move `band_top' from here...
(Render_Single_Pass): ... to here, and refactor.
(Render_Glyph): Updated.
2021-06-26 08:49:20 -04:00
Alexei Podtelezhnikov f6370e2f05 [raster] Adjust sub-band bisecting limits.
We can bisect a band until it is just a single scan line.  This might
be slow and cause time-outs but if we need to impose limits it should
be elsewhere.

* src/raster/ftraster.c (Render_Single_Pass): Tweak sub-banding.
2021-06-25 22:59:39 -04:00
Alexei Podtelezhnikov bc1029b9c5 * src/raster/ftraster.c (Render_Single_Pass): Remove dead code. 2021-06-25 18:20:57 -04:00
Werner Lemberg ff40776591 [base] Add trace level to logging output.
Some practical debugging work has shown that displaying level X of
an `FT_TRACEX` macro in the output of `FT2_DEBUG="...  -v"` would be
very helpful to find out which trace level should be selected.  As
an example, we now get output like

```
[ttobjs:2]    TTF driver
[ttobjs:2]      SFNT driver
[sfobjs:2]      not a font using the SFNT container format
[t1objs:2]    Type 1 driver
[stream:7]    FT_Stream_EnterFrame: 14 bytes
```

* include/freetype/internal/ftdebug.h (FT_LOGGING_TAGX): New macro.
(FT_LOG): Use it to add the trace level to the logging tag.

* include/freetype/internal/fttrace.h (FT_MAX_TRACE_LEVEL_LENGTH):
Adjust.

* docs/DEBUG: Updated.
2021-06-25 09:24:07 +02:00
Alexei Podtelezhnikov 1e0cef9e72 [smooth, raster] Fix up and align error codes.
FT_Render_Glyph picked up FAILURE or 1 returned from the raster
function, which became a confusing error code. Instead, return
Raster_Overflow in the unlikely event that banding does not help or
another meaningful error.

* src/smooth/ftgrays.c (gray_convert_glyph_inner, gray_convert_glyph):
Use Raster_Overflow when the rendering pool is exhausted and return it
if banding does not help.
(gray_raster_render): Use Smooth_Err_Ok.

* src/raster/ftraster.c (Render_Single_Pass): Return Raster_Overflow
if banding does not help or another error code.
2021-06-24 00:19:50 -04:00
Alexei Podtelezhnikov d8ac180c88 [smooth, raster] Remove synonymous error macros.
* src/smooth/ftgays.c [STANDALONE_]: s/ErrRaster_/Smooth_Err_/.
(gray_convert_glyph_inner): Updated accordingly.

* src/raster/ftraster.c [STANDALONE_]: Do not abbreviate error macros.
(New_Profile, End_Profile, Insert_Y_Turn, Line_Up, Bezier_Up,
Decompose_Curve, Draw_Sweep, Render_Single_Pass, ft_black_render):
Updated accordingly.
2021-06-23 23:32:02 -04:00
Werner Lemberg 1e65e6051a fterrors.h: Fix documentation extraction of `FT_Error_String`. 2021-06-23 08:14:42 +02:00
Dominik Röttsches 4cb21b9a92 [sfnt] s/PaintTransformed/PaintTransform/, s/transformed/transform/.
* include/freetype/ftcolor.h (FT_PaintTransformed, FT_PaintFormat,
FT_COLR_Paint): Do it to make it harmonize with other names such as
'PaintTranslate'.

* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Ditto.
2021-06-22 20:50:48 +02:00
Dominik Röttsches 284eec1e18 Move 'COLR' API to `ftcolor.h`.
* include/freetype/freetype.h: Cut section layer managament
containing 'COLR' v0 and v1 API and move it to `ftcolor.h` as
requested by Werner on freetype-devel.
* include/freetype/ftcolor.h: Paste that section.
2021-06-22 20:33:33 +02:00
Werner Lemberg bcd73f7dbc freetype.h: Mark 'COLR' v1 API as experimental. 2021-06-20 16:23:40 +02:00
Werner Lemberg 008e42a12c ftver.rc: Update copyright year. 2021-06-19 15:45:46 +02:00
Werner Lemberg b460a50610 [truetype] Fix integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35312

* src/truetype/ttinterp.c (Ins_JMPR): Use `ADD_LONG`.
2021-06-19 07:03:40 +02:00
Werner Lemberg 232243e749 Prevent hinting if there are too many segments.
This speeds up handling of broken glyphs.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35309

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Implement
it.
2021-06-19 06:41:01 +02:00
Alexei Podtelezhnikov 61bac75963 * src/sdf/ftsdfrend.c (ft_(b)sdf_render): Do not FT_ERROR routinely. 2021-06-18 17:38:00 -04:00
Werner Lemberg 482c57cc34 Add `ChangeLog` entries for last two commits. 2021-06-18 16:46:23 +02:00
David Turner f8c5c54680 Fix for issue 1063
See https://gitlab.freedesktop.org/freetype/freetype/-/issues/1063
for more details on the bug.
2021-06-16 10:31:12 +02:00
David Turner 6f273f6878 [meson] Add first regression test to FreeType
* tests/README.md: documentation explaining how to
  build and run the tests with the Meson build.

* tests/scripts/download-test-fonts.sh: Simple script
  to download test font files to the 'tests/data/'
  folder.

* meson.build, meson_options.txt, tests/meson.build:
  Add 'tests' option to enable building and running the
  test programs, disabled by default.

* tests/issue-1063/main.c: Simple regression test to
  exhibit issue 1063.

* .gitignore: Ignore the content of the tests/data/
  folder for now.
2021-06-16 10:28:47 +02:00
Alexei Podtelezhnikov c6fcd61228 Add a comment. 2021-06-15 22:49:21 -04:00
Alexei Podtelezhnikov 8336d53cff [type42] Fix new memory leak.
We need to inverse inheritance of FT_GlyphSlot_Internal so that we
have a chance to free the rendered bitmap from the parent slot.

* src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
of the child `ttslot' and replace it with the parent structure.
(T42_GlyphSlot_Done): Updated accordingly.
2021-06-12 22:33:08 -04:00
Werner Lemberg db0f2c448e [psaux] Fix another assertion.
* src/psaux/psintrp.c (cf2_interpT2CharString)
<cf2_escCALLOTHERSUBR>: Convert assertion into error, since the
problem can happen with invalid user input.

Test case is file

  fuzzing/corpora/legacy/oss-fuzz/5754332360212480-unknown-read

in the `freetype2-testing` repository.
2021-06-12 10:13:08 +02:00
Werner Lemberg a34afe6786 [psaux] Fix assertions.
* src/psaux/pshints.c (cf2_hintmap_adjustHints): Check for overflow
before emitting an assertion error.
2021-06-12 08:40:16 +02:00
Alexei Podtelezhnikov 9bfecfd2b6 * src/truetype/ttinterp.c (TT_RunIns): Optimize tracing. 2021-06-09 23:34:04 -04:00
Alexei Podtelezhnikov 7833e308ef [sdf] Fix SDF positioning.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Add padding to
`bitmap_top' and `bitmap_left'.

* sdf/sdf/ftsdf.c (sdf_generate_with_overlaps): Fix VC++ warning.
2021-06-09 10:40:30 -04:00
Alexei Podtelezhnikov 8dc02fb999 More CHANGES. 2021-06-08 22:31:11 -04:00
Werner Lemberg 08f66322e3 More various documentation improvements and fixes. 2021-06-08 18:23:16 +02:00
Werner Lemberg d586927d16 Various documentation improvements and fixes. 2021-06-08 17:44:53 +02:00
Werner Lemberg 640f654bd1 Fix 'devel' build for COLR 'v1'.
* devel/ftoption.h: Synchronize with
  `include/freetype/config/ftoption.h`.
2021-06-08 16:45:04 +02:00
Werner Lemberg b24cfc8dcc [sfnt] Sanitize cmap4 table better.
Fixes #1062.

* src/sfnt/ttcmap.c (tt_cmap4_validate): Handle a too-small value of
`length` gracefully.
2021-06-08 15:26:41 +02:00