summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* [gzip] Update sources to zlib 1.2.11update-zlib-sourcesDavid Turner2021-08-1926-2499/+7039
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gzip/ftgzip.c, src/gzip/rules.mk: Updated for new zlib sources. Also removed the temporary fix introduced in commit 6a431038 [1] to work-around the fact that the internal sources were too old. * src/gzip/README.freetype: Small README file describing the origin of the sources and how they were modified. * src/gzip/patches/*: Patch files applied to original sources. * src/gzip/*: Updated all zlib sources to 1.2.11 plus the patch from src/gzip/patches/ applied. This can be tested by building with the Unix development build: make setup devel make Or by building the freetype-demos programs with: meson setup build -Dfreetype2:zlib=internal meson compile -C out Then trying to run 'ftview' with a .pcf.gz font file. [1] https://gitlab.freedesktop.org/freetype/freetype/-/commit/6a431038c9113d906d66836cd7d216a5c630be7c
* [meson] Change Zlib configuration option.David Turner2021-08-192-9/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | * meson_options.txt, meson.build: Change the format of the 'zlib' meson build configuration option to be a combo with the following choices: - none: Do not support gzip-compressed streams at all. - internal: Support gzip-compressed streams using the copy of the gzip sources under src/gzip/, this should only be used during development to ensure these work properly. - external: Support gzip-compressed streams using the 'zlib' Meson subproject, linked as a static library. - system: Support gzip-compressed streams using a system installed version of zlib. - auto: Support gzip-compressed streams using a system installed version of zlib, if available, or using the 'zlib' subproject otherwise. This is the default! - disabled: backward-compatible alias for 'none'. - enabled: backward-compatible alias for 'auto'.
* Readily use `long long` as a 64-bit type in C99 mode.Alexei Podtelezhnikov2021-08-181-9/+8
| | | | | * include/freetype/config/integer-types.h (FT_INT64): FT_CONFIG_OPTION_FORCE_INT64 is no longer required to use `long long`.
* Use FT_INT64 instead of FT_LONG64.Alexei Podtelezhnikov2021-08-185-23/+16
| | | | | | | | * include/freetype/config/integer-types.h: Remove synonymous FT_LONG64. * include/freetype/internal/ftcalc.h: s/FT_LONG64/FT_INT64/. * src/base/ftcalc.c: Ditto. * src/base/fttrigon.c: Ditto. * src/smooth/ftgrays.c: Ditto.
* [builds/windows] Do not set CharacterSet for VC++.Alexei Podtelezhnikov2021-08-182-12/+12
| | | | | * builds/windows/vc2010/freetype.vcxproj: s/Unicode/NotSet/. * builds/windows/visualc/freetype.vcproj: s/"1"/"0"/.
* * src/sdf/ftsdf.c (get_control_box): Fix compiler warning.Werner Lemberg2021-08-181-3/+3
|
* [base] Fix ppem size overflow.Werner Lemberg2021-08-186-14/+57
| | | | | | | | | | | | | | Fixes #1086. * src/base/ftobjs.c (FT_Request_Metrics): Add return value. Check whether ppem values fit into unsigned short values. (FT_Request_Size): Updated. * include/freetype/internal/ftobjs.h: Updated. * src/cff/cffobjs.c (cff_size_request), src/cid/cidobjs.c (cid_size_request), src/truetype/ttdriver.c (tt_size_request), src/type1/t1objs.c (T1_Size_Request): Updated.
* * builds/windows/ftsystem.c (FT_Stream_Open): Cast to remove warning.Alexei Podtelezhnikov2021-08-171-2/+2
|
* * builds/windows/ftsystem.c (FT_Stream_Open): Support UNICODE compilation.Alexei Podtelezhnikov2021-08-171-2/+2
|
* * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Minor fix.Werner Lemberg2021-08-091-1/+1
|
* [sfnt] Add missing blend mode 'plus' to 'COLR' v1.Dominik Röttsches2021-08-091-16/+17
| | | | | * include/freetype/ftcolor.h (FT_Composite_Mode): Add missing blend mode 'plus' after it was added to the spec.
* include/freetype/freetype.h (FT_Encoding): Improve documentation.Werner Lemberg2021-08-081-5/+10
| | | | Based on a suggestion by Antony Lee <anntzer.lee@gmail.com>.
* [smooth] Avoid integer overflow.Werner Lemberg2021-08-071-10/+5
| | | | | | | | | | | Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36243 * src/smooth/ftgrays.c(ADD_LONG, SUB_LONG, MUL_LONG, NEG_LONG) [STANDALONE_]: Removed, unused. (ADD_INT) [STANDALONE_]: New macro. (FT_INTEGRATE): Use ADD_INT.
* [sfnt] Add API for retrieving a 'COLR' v1 'ClipBox' table.Dominik Röttsches2021-08-076-16/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | The optional 'COLR' v1 glyph-specific clip box helps upstream graphics libraries allocate a sufficiently large bitmap for a glyph without having to traverse the glyph graph for that. See https://github.com/googlefonts/colr-gradients-spec/issues/251 for background on the introduction of this specification change. * include/freetype/ftcolor.h (FT_ClipBox): New structure. (FT_Get_Color_Glyph_ClipBox): New function declaration. * include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_ClipBox_Func): New function type. (SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Use it. * src/base/ftobjs.c (FT_Get_Color_Glyph_ClipBox): New function to link API with SFNT implementation. * src/sfnt/sfdriver.c (sfnt_interface): Updated. * src/sfnt/ttcolr.c (Colr): New field `clip_list`. (tt_face_load_colr): Parse global clip list offset. (tt_face_get_color_glyph_clipbox): New function to find the clip box for a glyph id from the clip list array. * src/sfnt/ttcolr.h: Updated.
* [smooth] Fix left shifts of negative numbers.Werner Lemberg2021-08-061-11/+16
| | | | | | | | | Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36241 * src/smooth/ftgrays.c (LEFT_SHIFT): New macro. (gray_render_conic) [BEZIER_USE_DDA]: Use it.
* * meson.build: Fix zlib support.Werner Lemberg2021-08-021-11/+11
| | | | | | | | | | | This commit synchronizes zlib support with both autotools and cmake: If no external zlib is found (or intentionally disabled on the command line), use the internal zlib by undefining `FT_CONFIG_OPTION_SYSTEM_ZLIB` without modifying `FT_CONFIG_OPTION_USE_ZLIB`. Also improve summary output. Problem reported by Moazin.
* [sdf] Fix out-of-range-access.Anuj Verma2021-08-021-2/+2
| | | | | | | * src/sdf/ftbsdf.c (first_pass, second_pass): Fix range during forward pass. Otherwise the index goes out of range for the last column. Fixes issue #1077.
* Fix invalid memory access in `bsdf` rasterizer.Anuj Verma2021-08-021-3/+27
| | | | | | | | | | | | | | | Do not generate SDF from bitmap if the `FT_GLYPH_OWN_BITMAP` flag is not set. In some cases the bitmap buffer is freed but still points to a valid address; to handle those cases check the flag before accessing the memory. * src/sdf/ftsdfrend.c (ft_bsdf_render): Handle the above case. Also, return an error message if the bitmap's rows/pitch is invalid, otherwise `slot->buffer` might be assigned to some invalid memory location. (ft_sdf_render): Same as above. Plus, move the outline back to original state after rasterization and not if any error occurs. Signed-off-by: Anuj Verma <anujv@iitbhilai.ac.in>
* * meson.build: Honor `--includedir` instead of hard-coding 'include'.Heiko Becker2021-07-291-6/+7
| | | | Signed-off-by: Heiko Becker <heirecka@exherbo.org>
* src/sfnt/ttcolr.c: Minor formatting.Werner Lemberg2021-07-291-5/+5
|
* [sfnt] 'COLR' v1 PaintSweepGradient spec updateDominik Röttsches2021-07-292-8/+10
| | | | | | | | * src/sfnt/ttcolr.c (read_paint): PaintSweepGradient follows other spec changes and now has the angles specified as F2DOT14, reflect that in the implementation. * include/freetype/ftcolor.h (FT_PaintSweepGradient): Update documentation.
* [sfnt] Retrieve affine matrix from offset in 'COLR' v1 parsing.Dominik Röttsches2021-07-291-0/+5
| | | | | | * src/sfnt/ttcolr.c (read_paint): Implement spec change where affine transform matrix is now referenced by offset instead of being placed inline in the PaintTransform table.
* [sfnt] 'COLR' v1 PaintSkew related spec updatesDominik Röttsches2021-07-292-7/+22
| | | | | | | * src/sfnt/ttcolr.c (read_paint): Implement spec changes around PaintSkew, PaintSkewAroundCenter. Update parsing to read shorter values as changed in the spec. * include/freetype/ftcolor.h (FT_PaintSkew): Update documentation.
* [sfnt] PaintRotate/PaintRotateAroundCenter spec updatesDominik Röttsches2021-07-292-5/+24
| | | | | | | | * src/sfnt/ttcolr.c (read_paint): Implement spec change where PaintRotate and PaintRotateAroundCenter were split for a more compact format definition. Update parsing to read shorter values as changed in the spec. * include/freetype/ftcolor.h (FT_PaintRotate): Update documentation.
* [sfnt] 'COLR' v1 PaintTranslate and PaintScale precisionDominik Röttsches2021-07-291-6/+6
| | | | | | * src/sfnt/ttcolr.c (read_paint): Implement spec changes in PaintTranslate and PaintScale and friends. Update parsing to read new shorter values.
* README.git: Add Code of Conduct.AnuthaDev2021-07-292-1/+15
|
* ChangeLog housekeeping.Werner Lemberg2021-07-253-21/+0
| | | | | | | | | | | | 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).
* Fix some `cppcheck` warnings.Werner Lemberg2021-07-247-23/+34
| | | | | | | | | | | | | | | | | | * 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`.
* * .gitlab-ci.yml: Fixed cmake build, using correct options.AnuthaDev2021-07-241-10/+10
|
* * CMakeLists.txt: Make `cmake` handle disabled dependencies correctly.AnuthaDev2021-07-241-53/+100
| | | | | | | | | Include 'CMakeDependentOption'. Replace `FT_WITH_XXX` options with `FT_DISABLE_XXX` and `FT_REQUIRE_XXX` pairs. Update option logic accordingly. Fixes #1066.
* [autofit] Split `afwrtsys.h`.Ben Wagner2021-07-245-34/+47
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * Version 2.11.0 released.VER-2-11-0Werner Lemberg2021-07-1919-30/+60
| | | | | | | | | | | | | | | | | | | | | | | | | ========================== 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.
* Document direct header inclusion valid since 2.6.1.Ben Wagner2021-07-171-1/+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.
* * src/smooth/ftgrays.c: Fix compilation if `FT_LONG64` is undefined.David Turner2021-07-172-1/+24
| | | | | | | | | | | 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.
* [tests] Allow arbitrary build directories.Alex Richardson2021-07-163-8/+45
| | | | | | | | | | * 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.
* docs/CHANGES: Mention slight rendering changes.Werner Lemberg2021-07-161-1/+4
| | | | Suggested by Ben.
* * tests/issue-1063/main.c (main): Fix uninitialized variable.Alex Richardson2021-07-162-3/+11
| | | | | | | 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.
* [smooth] Minor fixes.Werner Lemberg2021-07-162-31/+61
| | | | | | | | * 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.
* Formatting and ChangeLog additions for previous commits.Werner Lemberg2021-07-163-98/+181
|
* Guard inclusion of emmintrin.hBen Wagner2021-07-151-0/+2
| | | | | | | | 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.
* [smooth] Implement Bezier quadratic arc flattenning with DDADavid Turner2021-07-152-1/+202
| | | | | | | | | | | | | | | | | | | 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
* [smooth] Minor speedup to smooth rasterizerDavid Turner2021-07-152-30/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* tests/scripts/download-test-fonts.sh rewrite in Python3David Turner2021-07-154-67/+306
| | | | | | | | | 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.
* Support architectures where `long` is smaller than pointers.Alex Richardson2021-07-152-3/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* [base] Fix `FT_Open_Face`'s handling of user-supplied streams.Oleg Oshmyan2021-07-133-13/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* [base] Reject combinations of incompatible `FT_OPEN_XXX` flags.Oleg Oshmyan2021-07-133-5/+32
| | | | | | | | | | | | | | | | | | | | 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.
* [sdf] Improve documentation.Anuj Verma2021-07-132-8/+9
|
* * meson.build: Fix build for other UNIX systems (e.g., FreeBSD).Alex Richardson2021-07-122-1/+22
| | | | | | | | | | | | | | | | | 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.
* [autofit] More clean-ups.Werner Lemberg2021-07-124-8/+12
| | | | | | | | * 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.
* Small clean-ups for the last few commits.Werner Lemberg2021-07-127-38/+52
| | | | * include/freetype/fttrace.h (afwarp): Removed.