Log

Author Commit Date CI Message
AnuthaDev 6af39c3d 2021-07-20T21:32:49 README.git: Add Code of Conduct.
Werner Lemberg ba47af32 2021-07-25T06:50:36 ChangeLog housekeeping. Archive old `ChangeLog` file. We no longer write ChangeLog entries manually; instead, the file will be created from commit messages (which should be formatted in GNU's ChangeLog style) by a call to gitlog-to-changelog --format='%B%n' or something similar (this script is part of the 'gnulib' repository).
Werner Lemberg c2fa51d9 2021-07-24T20:32:16 Fix some `cppcheck` warnings. * src/bzip2/ftbzip2.c (ft_bzip2_file_skip_output), src/gzip/ftgzip.c (ft_gzip_file_skip_output): Reduce scope of `delta`. * src/psaux/psintrp.c, src/psaux/psintrp.h (cf2_interpT2CharString): Add `const` to `buf` parameter. * src/raster/ftraster.c (DelOld): Add `const` to `profile` parameter. (Vertical_Sweep_Span): Reduce scope of `target`. (FT_Outline_Get_CBox): Reduce scope of `xMin`, `xMax`, `yMin`, `yMax`. * src/smooth/ftgrays.c (gray_render_conic): Reduce scope of `split`. (gray_sweep, gray_sweep_direct): Reduce scope of `area`. * src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Reduce scope of `temp`.
AnuthaDev 28c2d7f3 2021-07-20T21:22:14 * .gitlab-ci.yml: Fixed cmake build, using correct options.
AnuthaDev 1f742f05 2021-07-20T20:00:10 * CMakeLists.txt: Make `cmake` handle disabled dependencies correctly. Include 'CMakeDependentOption'. Replace `FT_WITH_XXX` options with `FT_DISABLE_XXX` and `FT_REQUIRE_XXX` pairs. Update option logic accordingly. Fixes #1066.
Ben Wagner 5bcaf51b 2021-07-23T11:59:58 [autofit] Split `afwrtsys.h`. The header file `afwrtsys.h` has two distinct functions: to include the required writing system headers and also to generate code for each writing system. At each current use site only one or the other is used, with various macro trickery selecting one or the other. Split this header into `afws-decl.h` for the required writing system declarations and `afws-iter.h` for iterating over the writing systems to generate code. The motivation for this change is that the Visual C++ compiler treats the standard include guard idiom like `#pragma once` 'if no non-comment code or preprocessor directive comes before or after the standard form of the idiom'. It appears to check this after macro expansion, so if `WRITING_SYSTEM` expands to empty the bottom of `afwrtsys.h` is empty and looks like the standard include guard idiom which is treated like `#pragma once`, so subsequent inclusion of `afwrtsys.h` is elided. Fixes #1075. * src/autofit/afglobal.c (af_writing_system_classes), src/autofit/aftypes.h (AF_WritingSystem), src/autofit/rules.mk (AUTOF_DRV_H): Updated. * src/autofit/afwrtsys.h: Split into... * src/autofit/afws-decl.h, src/autofit/afws-iter.h: New files.
Werner Lemberg 801cd842 2021-07-18T07:53:57 * Version 2.11.0 released. ========================== Tag sources with `VER-2-11-0'. * docs/VERSION.TXT: Add entry for version 2.11.0. * docs/CHANGES: 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.10.4/2.11.0/, s/2104/2110/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 11. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 24:0:18. * CMakeLists.txt (VERSION_MINOR): Set to 11. (VERSION_PATCH): Set to 0. * builds/toplevel.mk (dist): Ignore more git-related files.
Ben Wagner 4082b863 2021-07-16T14:20:44 Document direct header inclusion valid since 2.6.1. Since commit e13391333 'Make macros for header file names optional.' the header file layout has become public and using the macro expansions for includes is no longer required. While this happened in 2.10.3, the header file layout had not changed since commit 392cf22f8a5 'Another adjustment to header locations.' in 2.6.1. Retroactively make the header file layout public back to 2.6.1 to speed adoption.
David Turner 357b353c 2021-07-16T11:12:13 * src/smooth/ftgrays.c: Fix compilation if `FT_LONG64` is undefined. The code assumed that if `__SSE2__` is defined, then 64-bit integer types are available. This is not the case apparently for certain multilib compiler targets like 'x86_32.x86' used by Gentoo. This patch fixes the issue by disabling the special code path when 64-bit integer types are not available. Fixes #1071.
Alex Richardson 7bc0f48c 2021-07-15T18:26:20 [tests] Allow arbitrary build directories. * tests/issue-1063/main.c (main): I am building with a build directory that is not directly inside the source tree, so the path `../tests/data/As.I.Lay.Dying.ttf` does not resolve to the test input file. This change passes the test data directory as an environment variable to allow arbitrary build directories. * tests/meson.build: Updated.
Werner Lemberg 685acc04 2021-07-16T08:20:44 docs/CHANGES: Mention slight rendering changes. Suggested by Ben.
Alex Richardson c35961a9 2021-07-15T18:02:57 * tests/issue-1063/main.c (main): Fix uninitialized variable. I tried running `meson test` but the test just crashed and gdb reported that the face argument to `FT_Get_Char_Index` was nonsense. With this change the test prints 'Could not open file: ' as it should.
Werner Lemberg 552fc97f 2021-07-16T07:49:20 [smooth] Minor fixes. * src/smooth/ftgrays.c (gray_render_conic): Move variable and structure declarations to beginning of function. Inspite of C99 compliance we still do this for the sake of backward compatibility. This also avoids a shadowing declaration of `count`. (gray_convert_glyph_inner): Fix typo.
Werner Lemberg 93771d61 2021-07-16T07:40:56 Formatting and ChangeLog additions for previous commits.
Ben Wagner c37c0873 2021-07-15T11:33:16 Guard inclusion of emmintrin.h Guard inclusion of emmintrin.h with "#ifdef __SSE2__". The gcc version of this header, xmmintrin.h, and mmintrin.h check that the appropriate defines are set before defining anything (are internally guarded). However the clang versions of these includes are not internally guarded. As a result of this, externally guard the inclusion of these headers.
David Turner 56cc2ad4 2021-06-19T10:26:53 [smooth] Implement Bezier quadratic arc flattenning with DDA Benchmarking shows that this provides a very slighty performance boost when rendering fonts with lots of quadratic bezier arcs, compared to the recursive arc splitting, but only when SSE2 is available, or on 64-bit CPUs. On a 2017 Core i5-7300U CPU on Linux/x86_64: ./ftbench -p -s10 -t5 -cb .../DroidSansFallbackFull.ttf Before: 4.033 us/op (best of 5 runs for all numbers) After: 3.876 us/op ./ftbench -p -s60 -t5 -cb .../DroidSansFallbackFull.ttf Before: 13.467 us/op After: 13.385 us/op
David Turner 86b9c934 2021-06-19T11:18:40 [smooth] Minor speedup to smooth rasterizer This speeds up the smooth rasterizer by avoiding a conditional branches in the hot path. Namely: - Define a fixed "null cell" which will be pointed to whenever the current cell is outside of the current target region. This avoids a "ras.cell != NULL" check in the FT_INTEGRATE() macro. - Also use the null cell as a sentinel at the end of all ycells[] linked-lists, by setting its x coordinate to INT_MAX. This avoids a 'if (!cell)' check in gray_set_cell() as well. - Slightly change the worker struct fields to perform a little less operations during rendering. Example results (on a 2013 Corei5-3337U CPU) out/ftbench -p -s10 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf Before: 5.472 us/op After: 5.275 us/op out/ftbench -p -s60 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf Before: 17.988 us/op After: 17.389 us/op
David Turner 5ec7f588 2021-07-11T23:33:19 tests/scripts/download-test-fonts.sh rewrite in Python3 Replaces download-test-fonts.sh with download-test-fonts.py which does the same work, and also avoids downloading anything if the files are already installed with the right content. Now uses the first 8 byte of each file's sha256 hash for the digest.
Alex Richardson f7c6a06c 2021-07-12T13:58:10 Support architectures where `long` is smaller than pointers. I am currently trying to compile FreeType for CHERI-extended ISAs (CHERI-RISC-V and Arm's Morello), but I am getting compiler warnings from the `FT_UINT_TO_POINTER` macro. When compiling with the CHERI Clang compiler, not using `uinptr_t` for casts between integers an pointers results in the following `-Werror` build failures: ``` In file included from .../src/truetype/truetype.c:22: .../src/truetype/ttgload.c:1925:22: error: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Werror,-Wcheri-capability-misuse] node->data = FT_UINT_TO_POINTER( glyph_index ); ^ .../include/freetype/internal/compiler-macros.h:79:34: note: expanded from macro 'FT_UINT_TO_POINTER' ``` * include/freetype/internal/compiler-macros.h (FT_UINT_TO_POINTER): The ISO C standard compliant fix for this would be to use `uintptr_t` from `stdint.h`, but I am not sure if this is supported by the minimum compiler version. Therefore, use the compiler-defined `__UINTPTR_TYPE__` macro (supported in GCC 4.6+ and Clang since about 3.0) before checking for `_WIN64` and falling back to `unsigned long`.
Oleg Oshmyan 5d27b10f 2021-07-13T10:59:32 [base] Fix `FT_Open_Face`'s handling of user-supplied streams. This was already true (though undocumented) most of the time, but not if `FT_NEW` inside `FT_Stream_New` failed or if the `FT_OPEN_XXX` flags were bad. Normally, `FT_Open_Face` calls `FT_Stream_New`, which returns the user-supplied stream unchanged, and in case of any subsequent error in `FT_Open_Face`, the stream is closed via `FT_Stream_Free`. Up to now, however, `FT_Stream_New` allocates a new stream even if it is already given one by the user. If this allocation fails, the user-supplied stream is not returned to `FT_Open_Face` and never closed. Moreover, the user cannot detect this situation: all they see is that `FT_Open_Face` returns `FT_Err_Out_Of_Memory`, but that can also happen after a different allocation fails within the main body of `FT_Open_Face`, when the user's stream has already been closed by `FT_Open_Face`. It is plausible that the user stream's `close` method frees memory allocated for the stream object itself, so the user cannot defensively free it upon `FT_Open_Face` failure lest it ends up doubly freed. All in all, this ends up leaking the memory/resources used by user's stream. Furthermore, `FT_Stream_New` simply returns an error if the `FT_OPEN_XXX` flags are unsupported, which can mean either an invalid combination of flags or a perfectly innocent `FT_OPEN_STREAM` on a FreeType build that lacks stream support. With this patch, the user-supplied stream is closed even in these cases, so the user can be sure that if `FT_Open_Face` failed, the stream is definitely closed. * src/base/ftobjs.c (FT_Stream_New): Don't allocate a buffer unnecessarily. Move error-handling code to make the control flow more obvious. Close user-supplied stream if the flags are unsupported. `FT_Stream_Open` always sets `pathname.pointer`, so remove the redundant (re)assignment. None of the `FT_Stream_Open...` functions uses `stream->memory`, so keep just one assignment at the end, shared among all possible control flow paths. ('Unsupported flags' that may need a stream closure can be either an invalid combination of multiple `FT_OPEN_XXX` mode flags or a clean `FT_OPEN_STREAM` flag on a FreeType build that lacks stream support.)
Oleg Oshmyan a4c8f21a 2021-07-13T10:44:38 [base] Reject combinations of incompatible `FT_OPEN_XXX` flags. The three modes are mutually exclusive, and the documentation of the `FT_OPEN_XXX` constants notes this. However, there was no check to validate this in the code, and the documentation on `FT_Open_Args` claimed that the corresponding bits were checked in a well-defined order, implying it was valid (if useless) to specify more than one. Ironically, this documented order did not agree with the actual code, so it could not be relied upon; hopefully, nobody did this and nobody will be hurt by the new validation. Even if multiple mode bits were allowed, they could cause memory leaks: if both `FT_OPEN_STREAM` and `stream` are set along with either `FT_OPEN_MEMORY` or `FT_OPEN_PATHNAME`, then `FT_Stream_New` allocated a new stream but `FT_Open_Face` marked it as an 'external' stream, so the stream object was never released. * src/base/ftobjs.c (FT_Stream_New): Reject incompatible `FT_OPEN_XXX` flags.
Anuj Verma e592982a 2021-07-13T10:00:22 [sdf] Improve documentation.
Alex Richardson c5516e0f 2021-07-12T09:22:48 * meson.build: Fix build for other UNIX systems (e.g., FreeBSD). Without this change the build of `unix/ftsystem.c` fails because the `ftconfig.h` header that defines macros such as `HAVE_UNISTD_H` and `HAVE_FCNTL_H` is only being generated for Linux, macOS, and Cygwin systems: ``` .../builds/unix/ftsystem.c:258:32: error: use of undeclared identifier 'O_RDONLY' file = open( filepathname, O_RDONLY ); ``` Instead of hardcoding a list of operating systems for this check, update the logic that decides whether to build the file and set a boolean flag that can be checked instead.
Werner Lemberg 825b7ea2 2021-07-12T22:11:24 [autofit] More clean-ups. * src/autofit/afhints.h (AF_GlyphHintsRec): Remove the no longer needed fields `xmin_delta` and `xmax_delta`. * src/autofit/afhints.c (af_glyph_hints_reload), src/autofit/afloader.c (af_loader_load_glyph): Updated.
Werner Lemberg 205d1ae4 2021-07-12T22:03:25 Small clean-ups for the last few commits. * include/freetype/fttrace.h (afwarp): Removed.
David Turner a212668c 2021-06-02T19:07:56 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.
David Turner 2f11522a 2021-06-02T19:05:09 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.
David Turner 15e88980 2021-06-02T18:54:41 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).
Werner Lemberg 59e95b01 2021-07-12T06:01:14 Update 'dlg' subproject.
Werner Lemberg 50d0033f 2021-07-05T05:44:13 meson.build: Minor doc fix.
Werner Lemberg 89c60eca 2021-07-05T05:39:59 * src/base/ftlcdfil.c (FT_Library_SetLcdGeometry): Fix argument. Reported by Hin-Tak.
Werner Lemberg 5e32a034 2021-07-03T20:24:16 README.git: Revised.
Werner Lemberg a399fb89 2021-07-03T16:34:01 meson.build: Minor doc improvements.
Werner Lemberg 4cb8a88a 2021-07-03T10:23:39 * meson_options.txt: Sort alphabetically; no final full stops.
Ben Wagner d3dc2da9 2021-06-30T18:22:29 * 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.
Dominik Röttsches 286da6c5 2021-06-22T15:01:19 [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.
Dominik Röttsches 0348c627 2021-06-29T20:51:32 [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.
Alexei Podtelezhnikov f27b4834 2021-06-30T10:54:59 * src/raster/ftraster.c (Render_Single_Pass): Simplify `band_stack'.
Werner Lemberg 90ecac41 2021-06-30T10:23:42 Update `CHANGES` file; other minor doc fixes.
Alexei Podtelezhnikov 69c3516c 2021-06-29T23:51:23 [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.
Alexei Podtelezhnikov 3696ac5a 2021-06-29T23:27:10 [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.
Anurag Thakur 7be47010 2021-05-18T10:33:25 [CI] Introduce linux CI and refactor job names * .gitlab-ci.yml: Added jobs for building freetype on linux.
Werner Lemberg e1b1b542 2021-06-29T06:07:00 ftcolor.h: Minor grammar fix.
Alexei Podtelezhnikov c852388d 2021-06-28T23:26:10 [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.
Dominik Röttsches 7d4e55c3 2021-06-28T16:29:49 [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.
Alexei Podtelezhnikov 3a278381 2021-06-28T10:22:03 [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.
Alexei Podtelezhnikov fb4511eb 2021-06-26T08:49:20 [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.
Alexei Podtelezhnikov f6370e2f 2021-06-25T22:59:39 [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.
Alexei Podtelezhnikov bc1029b9 2021-06-25T18:20:57 * src/raster/ftraster.c (Render_Single_Pass): Remove dead code.
Werner Lemberg ff407765 2021-06-25T09:19:51 [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.
Alexei Podtelezhnikov 1e0cef9e 2021-06-24T00:19:50 [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.
Alexei Podtelezhnikov d8ac180c 2021-06-23T23:32:02 [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.
Werner Lemberg 1e65e605 2021-06-23T08:14:42 fterrors.h: Fix documentation extraction of `FT_Error_String`.
Dominik Röttsches 4cb21b9a 2021-06-22T20:50:48 [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.
Dominik Röttsches 284eec1e 2021-06-22T14:21:49 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.
Werner Lemberg bcd73f7d 2021-06-20T16:23:40 freetype.h: Mark 'COLR' v1 API as experimental.
Werner Lemberg 008e42a1 2021-06-19T15:45:46 ftver.rc: Update copyright year.
Werner Lemberg b460a506 2021-06-19T07:03:40 [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`.
Werner Lemberg 232243e7 2021-06-19T06:32:29 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.
Alexei Podtelezhnikov 61bac759 2021-06-18T17:38:00 * src/sdf/ftsdfrend.c (ft_(b)sdf_render): Do not FT_ERROR routinely.
Werner Lemberg 482c57cc 2021-06-18T16:46:23 Add `ChangeLog` entries for last two commits.
David Turner f8c5c546 2021-06-16T09:54:49 Fix for issue 1063 See https://gitlab.freedesktop.org/freetype/freetype/-/issues/1063 for more details on the bug.
David Turner 6f273f68 2021-06-15T23:12:57 [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.
Alexei Podtelezhnikov c6fcd612 2021-06-15T22:49:21 Add a comment.
Alexei Podtelezhnikov 8336d53c 2021-06-12T22:33:08 [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.
Werner Lemberg db0f2c44 2021-06-12T10:05:07 [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.
Werner Lemberg a34afe67 2021-06-12T08:40:16 [psaux] Fix assertions. * src/psaux/pshints.c (cf2_hintmap_adjustHints): Check for overflow before emitting an assertion error.
Alexei Podtelezhnikov 9bfecfd2 2021-06-09T23:34:04 * src/truetype/ttinterp.c (TT_RunIns): Optimize tracing.
Alexei Podtelezhnikov 7833e308 2021-06-09T10:40:30 [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.
Alexei Podtelezhnikov 8dc02fb9 2021-06-08T22:31:11 More CHANGES.
Werner Lemberg 08f66322 2021-06-08T18:23:16 More various documentation improvements and fixes.
Werner Lemberg d586927d 2021-06-08T17:44:34 Various documentation improvements and fixes.
Werner Lemberg 640f654b 2021-06-08T16:45:04 Fix 'devel' build for COLR 'v1'. * devel/ftoption.h: Synchronize with `include/freetype/config/ftoption.h`.
Werner Lemberg b24cfc8d 2021-06-08T15:26:41 [sfnt] Sanitize cmap4 table better. Fixes #1062. * src/sfnt/ttcmap.c (tt_cmap4_validate): Handle a too-small value of `length` gracefully.
Dominik Röttsches ee6d03d3 2021-06-08T14:29:11 [sfnt] Pointer validity check when reading COLR 'v1' layers * src/sfnt/ttcolr.c (tt_face_get_paint_layers): In addition to the existing sanity checks, ensure that the pointer to the layer to be read is within the 'COLR' v1 table.
Werner Lemberg 41fa19fc 2021-06-08T10:32:20 * src/sdf/ftsdfcommon.c: Fix inclusion of header files.
Werner Lemberg 35b21c71 2021-06-08T09:06:39 [sdf] Make `make multi` work. * src/sdf/ftsdf.c: Include `ftbitmap.h`. * src/sdf/ftsdfcommon.h: Move function bodies to `ftsdfcommon.c`. Include `ftobjs.h` to get definitions of `FT_LOCAL` and friends. * src/sdf/ftsdfcommon.c: New file. * src/sdf/rules.mk, src/sdf/sdf.c: Updated.
Werner Lemberg 36ee7171 2021-06-08T09:00:39 [sdf] Formatting and improved comments.
Anuj Verma 2b1d5562 2021-06-08T08:29:34 [sdf] Use 8 bits for final SDF output instead of 16bits. Since 8-bits is enough to represent SDF data we no longer require 16-bits for this purpose. Also, we now normalize the output data to use the entire 8-bit range efficiently. For example: if we use 3.5 format with a spread of 1 we basically only use the starting 5-bits. By normalizing we can use the entire 8-bit range. * include/freetype/freetype.h (FT_Render_Mode): Updated description for `FT_RENDER_MODE_SDF` regarding this change. * include/freetype/ftimage.h (FT_Pixel_Mode): Removed `FT_PIXEL_MODE_GRAY16` since no longer required. * include/freetype/fttypes.h (FT_F6Dot10): Removed since no longer required. * src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Allocate 8-bit bitmap instead of 16-bit buffer. * src/sdf/ftsdfcommon.h (map_fixed_to_sdf): Added function to convert 16.16 distance value to our desired format. * src/sdf/ftsdf.c (sdf_generate_with_overlaps, sdf_generate_bounding_box): Use the new `map_fixed_to_sdf` function and also use 8-bit output buffer. * src/sdf/ftbsdf.c (finalize_sdf): Output to a 8-bit buffer instead of 16-bit buffer.
Ben Wagner 2a6665a4 2021-06-01T15:25:31 [sfnt] Fix fallout from 2021-05-29 change. * src/sfnt/ttcolr.c (find_base_glyph_record, find_base_glyph_v1_record): Adjust binary search. Needs to be updated with change to unsigned.
Werner Lemberg 7ca7da9d 2021-06-02T06:59:01 * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix tracing. Problem reported by Alexei.
Werner Lemberg 0abbc9f5 2021-06-02T06:36:11 [psaux] Fix MSVC compiler warnings. * src/psaux/afmparse.c (afm_parse_track_kern, afm_parse_kern_pairs): Add cast.
Werner Lemberg 6e253b26 2021-05-29T11:05:41 Typos in previous commit.
Werner Lemberg a50c39aa 2021-05-29T09:50:29 Fix compilation errors and (some) warnings for clang++. * src/autofit/afmodule.c (AF_GlyphHintsRec): Make it static. * src/cache/ftcache.c (FTC_Cache_NewNode), src/cache/ftcsbits.c (ftc_snode_compare): Remove semicolon. * src/cff/cffparse.c (cff_parser_run): Add `break` statement. * src/cid/cidload.c (cid_hex_to_binary): Add cast. * src/sdf/ftbsdf.c (CHECK_NEIGHBOR): Use `do {} while(0)` loop. (bsdf_init_distance_map, finalize_sdf, bsdf_raster_render): Add casts. * src/sdf/ftsdf.c (sdf_generate_bounding_box, sdf_generate_with_overlaps): Ditto. * src/sdf/ftsdfcommon.h (square_root): Ditto. * src/sdf/ftsdfrend.c (sdf_property_get, ft_sdf_render, ft_bsdf_render): Ditto. * src/sfnt/ttcolr.c (find_base_glyph_record, find_base_glyph_v1_record): Fix variable signedness. (read_color_line): Add cast. (read_paint): Add casts. Fix signedness issue. (tt_face_get_colorline_stops) Fix signedness issues. * src/sfnt/ttpost.c (load_format_20): Add casts. * src/truetype/ttsubpix.c (TWEAK_RULES, TWEAK_RULES_EXCEPTIONS): Remove final semicolons.
Werner Lemberg 2bfdc161 2021-05-29T00:27:40 [build] Allow overriding of `ANSIFLAGS` for GNU make build. * builds/*: Implement it.
Alexei Podtelezhnikov 28eee363 2021-05-27T11:38:56 [type42] Fix auto-hinting. The autohinter could not access the base (unscaled) outline in the child TrueType glyph slot. We now share the internal parts between the parent and child glyph slots. Fixes #1057. * src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts of `T42_GlyphSlot' and replace it with the child TrueType structure. (T42_GlyphSlot_Done): Updated accordingly.
Werner Lemberg 0d1c306e 2021-05-25T11:27:56 [psaux] Guard and trace AFM kern data allocation. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31543 * include/freetype/internal/fttrace.h: Add 'afmparse' trace component. * src/psaux/afmparse.c (FT_COMPONENT): Define. (afm_parse_track_kern, afm_parse_kern_pairs): Protect against allocations bombs. Add tracing. (afm_parse_kern_data): Don't allow multiple kern data sections.
Werner Lemberg 5f485339 2021-05-24T08:24:36 .gitignore: Add `subprojects` directory, fix some patterns.
Alexei Podtelezhnikov 16947c0e 2021-05-23T05:36:16 * meson.build (ft2_public_headers): Add missing `ftcid.h'. Fixes #1058.
Alexei Podtelezhnikov 2468e59a 2021-05-20T22:20:36 [type42] Avoid some memory zeroing. * src/type42/t42objs.c (T42_Open_Face): Tweak allocation macro. * src/type42/t42parse.c (t42_parse_sfnts): Ditto.
Nikolaus Waxweiler ebf9e5ac 2021-05-15T22:36:00 [CMake] Update dependency finders. 1. Fixes CMake using any found HarfBuzz version lower than the minimum required. This is based on HALX99's merge request at https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/31 2. Update FindHarfBuzz.cmake from https://github.com/WebKit/WebKit/blob/1ce32454/Source/cmake/FindHarfBuzz.cmake and guard post-CMake-3.1 features to keep the minimum version unchanged 3. Update FindBrotliDec.cmake to stop the warnings, based on what https://github.com/google/woff2/blob/a0d0ed7d/cmake/FindBrotliDec.cmake is doing * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Implement 1 and 2. * builds/cmake/FindBrotliDec.cmake: Implement 3.
Ben Wagner 06e21ffe 2021-05-18T14:49:50 [gzip] Use exact type for `ft_gzip_alloc` and `ft_gzip_free`. While a function pointer may be cast to another function pointer type, it is required to cast the function pointer back to the original function pointer type before calling it. If a parameter is a pointer the exact pointer type is required. Using a pointer to a different underlying type is technically undefined behavior. The wrapper functions `ft_gzip_alloc` and `ft_gzip_free` took `FT_Memory` (a `FT_MemoryRec_*`) instead of `voidpf` (`void*`), so when gzip calls these callbacks through `alloc_func` or `free_func` it invokes undefined behavior. On most platforms this works out as expected, but newer undefined behavior detectors and targets like wasm can detect this and will produce an error. * src/gzip/ftgzip.c (ft_gzip_alloc, ft_gzip_free): Update signatures to exactly match `alloc_func` and `free_func`, respectively. Internally, cast the `void*` opaque pointer to `FT_Memory`.
Alexei Podtelezhnikov 81852fbc 2021-05-18T22:18:17 Prioritize the anti-aliasing renderer module. * modules.cfg: Reorder the renderers. * include/freetype/config/ftmodule.h: Ditto.
Alexei Podtelezhnikov 1bc801b0 2021-05-16T23:12:01 [sfnt] Additional guards on the POST table. Fixes timeout (#1055) analyzed by Ben Wagner, reported as https://crbug.com/1194092 * src/sfnt/ttload.c (tt_face_load_post): Check POST format. * src/sfnt/sfobjs.c (sfnt_load_face): Synthesize the missing unicode charmap only if the glyph names exist. * src/psnames/psmodule.c (ps_unicode_value): Short cut ".notdef" and ".null".
Daniel McArdle de151657 2021-05-13T23:08:31 [psaux] Use doubling allocation strategy for CF2_ArrStack. Fixes timeout reported as https://crbug.com/1206181 * src/psaux/psarrst.c (cf2_arrstack_{push,init}): Implement it. * src/psaux/psarrst.h (CF2_ArrStackiRec): Drop `chunk'.
Alexei Podtelezhnikov 2d3f5dd2 2021-05-12T17:24:35 * src/smooth/ftgrays.c (FT_MAX_GRAY_SPANS): Increase from 10 to 16. Ten was barely enough for two slanted stems. Sixteen can actually fit a bit more complicated scanlines.
Alexei Podtelezhnikov c653b8d2 2021-05-12T16:17:21 * src/smooth/ftgrays.c (FT_GRAY_SET): Adjust for better code.
Alexei Podtelezhnikov 8f43d324 2021-05-12T00:04:59 [smooth] Faster bitmap sweeping. Selecting the fill rule or checking the direct mode each time we call `gray_hline' is sub-optimal. This effectively splits the direct mode into a separate code path while inlining `gray_hline' and saving 5-7% of rendering time. * src/smooth/ftgrays.c (gray_hline): Eliminated in favor of... (FT_FILL_RULE, FT_GRAY_SET): ... these new macros... (gray_sweep): ... inlined here. (gray_sweep_direct): New function that handles the direct span buffer. (gray_TWorker): Remove the span buffer. (gray_raster_render, gray_convert_glyph): Updated.
Alexei Podtelezhnikov b0702645 2021-05-10T22:06:01 * src/smooth/ftgrays.c (gray_hline): Simplify even-odd computations. It is too bad the even-odd rule is not used much.
Alexei Podtelezhnikov 967a34ee 2021-05-07T19:17:48 [type1] Avoid MM memory zeroing. * src/type1/t1load.c (t1_allocate_blend, parse_blend_design_map): Tweak allocation macros. * src/type1/t1objs.c (T1_Face_Done): Minor.