src/base

Branch


Log

Author Commit Date CI Message
Werner Lemberg 526ec5c4 2025-09-11T13:16:53 * Version 2.14.1 released. ========================== Tag sources with `VER-2-14-1'. * docs/VERSION.TXT: Add entry for version 2.14.1. * 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.0/2.14.1/, s/2140/2141/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. * builds/unix/configure.raw (version_info): Set to 26:4:20. * CMakeLists.txt (VERSION_PATCH): Set to 1.
Behdad Esfahbod 566f8805 2025-09-10T14:22:49 [base] Fix return values of two Font Variation functions. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): Do it. Fixes issue #1355.
Werner Lemberg 007c46eb 2025-09-06T15:55:12 * Version 2.14.0 released. ========================== Tag sources with `VER-2-14-0'. * docs/VERSION.TXT: Add entry for version 2.14.0. * 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.13.3/2.14.0/, s/2133/2140/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 14. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 26:3:20. * CMakeLists.txt (VERSION_MINOR): Set to 14. (VERSION_PATCH): Set to 0.
Werner Lemberg 32cb5390 2025-09-06T06:14:03 Update all copyright notices.
Jouk Jansen ba7eb5be 2025-08-30T20:34:36 Clean up OpenVMS support. This avoids cluttering the source code with VMS-specific changes. * include/freetype/internal/ftcalc.h [__VMS], src/base/ftcalc.c [vms_auto64_source]: Remove. * builds/vms/patch_ftcalc.sed: New file. * vms_make.com: Change macro definitions while this script is running; we use `GNU sed` to inject the necessary preprocessor code on the fly.
Alexei Podtelezhnikov 61a42342 2025-08-29T16:59:50 [base] Use const FT_Module_Class. This is intended to warn against modifying any fields in the class, at compile-time and avoid crashes at run-time. * include/freetype/internal/ftobjs.h (FT_ModuleRec): Do it. * src/base/ftobjs.c (Destroy_Module, FT_Add_Module): Updated.
Alexei Podtelezhnikov 48f91b53 2025-08-27T11:16:07 * src/base/ftobjs.c (FT_Load_Glyph): Reduces scope of 'ttface'.
Jouk Jansen aa2ee67b 2025-08-05T17:34:09 Improvements to OpenVMS support. * include/freetype/internal/ftcalc.h [__VMS]: Undefine `FT_MulFix`. * src/base/ftcalc.c [vms_auto64_source]: Define `FT_MulFix`. * vms_make.com: Also create 32bit version of the FreeType library.
Werner Lemberg 01695ea7 2025-07-01T18:06:17 Various minor fixes. As reported by clang 19. * src/autofit/afadjust.c (adjustment_database): Make it static. * src/base/ftdbgmem.c (FT_MEM_SIZE_MIN): Remove unused macro. * src/psaux/psobjs.c (skip_procedure), src/truetype/ttinterp.c (Ins_IF, Ins_ELSE, Ins_FDEF, Ins_IDEF): Add `default` clause.
Werner Lemberg 8d82c9fa 2025-07-01T17:08:37 */*: Fix trivial signedness issues with format strings in trace messages. As reported with clang 19's `-Wformat` option.
Werner Lemberg 346d8fae 2025-07-01T05:16:54 Fix `make multi`. Reported as https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984253 * src/base/fthash.c: Include `ftobjs.h`. * src/autofit/afgsub.c: Include `afglobal.h`.
Werner Lemberg 2ab0357d 2025-06-12T23:15:22 [base] Add no-overwrite hash insert functions. * src/base/fthash.c (ft_hash_num_insert_no_overwrite, ft_hash_str_insert_no_overwrite): New functions. * include/freetype/internal/fthash.h: Updated.
Werner Lemberg 820df387 2025-06-02T16:16:06 [base] Add iterators for `FT_Hash`. * src/base/fthash.c (ft_hash_num_iterator, ft_hash_str_iterator): New functions. * include/freetype/internal/fthash.h: Updated.
Alexei Podtelezhnikov 04f68052 2025-06-12T21:02:57 * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove check. The highest (sign) attribute bit is reserved and should be zero. It is harmless to omit this check however. Fixes #1342.
Werner Lemberg 7f559fbe 2025-06-10T04:55:43 Update links. Found with `linkchecker --check-extern index.html` running locally in the 'freetype-web' repository.
Werner Lemberg 2adb5361 2025-06-03T10:35:16 Replace 'www.freetype.org' with 'freetype.org'.
Vítor Ramos 202297eb 2025-05-25T12:15:11 * src/base/ftobjs.c (FT_Load_Glyph): Loosen auto-hinting constraints. Fixes issue #1320.
Behdad Esfahbod fa412cf5 2025-05-23T15:41:26 [mm/gxvar] Always detect default instance and use optimized codepath. Even if it was explicitly set by either design or normalized APIs. Also update documentation. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): Use value -2 of `error` to indicate that we have a non-default instance. (TT_Set_Named_Instance): Updated. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): Updated.
Werner Lemberg e07e56c7 2025-05-26T17:20:12 [gxvar] Speed up handling of deltas in `ItemVariationStore`. (3/3) * src/base/ftcalc.c (FT_MulAddFix): Removed, no longer needed. * include/freetype/internal/ftcalc.h: Updated.
Behdad Esfahbod 8eae0399 2025-05-26T08:16:53 Lift `FT_Int64` type to global (internal) FreeType use. * src/base/ftcalc.c (FT_Int64) [!FT_INT64]: Move declaration to... * include/freetype/config/integer-types.h: ... this file. (FT_UInt64) [!FT_INT64]: New structure. (FT_INT64_ZERO): New macro.
Behdad Esfahbod 42a649be 2025-05-21T14:35:40 [mm] Short-circuit setting face to default instance if already is so. I found that in hb-ft I need to sometime reset the face to the default instance. However, calling `FT_Set_Var_Design_Coordinates` with no coords was still slowing down at least the glyph-advance code by processing variations. Perhaps there's a better fix, but this handles the easy cases. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates): Implement it.
Werner Lemberg 15b7e8c3 2025-05-14T10:20:04 Whitespace, formatting, minor spelling fix.
Alexei Podtelezhnikov 4fad257a 2025-04-17T22:32:21 * src/base/ftcalc.c (ft_corner_orientation) [!FT_INT32]: Fix up.
Alexei Podtelezhnikov 0a650e8c 2025-04-16T22:54:54 * src/base/ftcalc.c: Miscellaneous cleanups.
Craig White f0660df3 2024-01-28T07:38:41 [base] Make `find_unicode_charmap` a base function. This is needed for forthcoming changes in the auto-hinter. * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: Updated.
Alexei Podtelezhnikov 8f67545d 2025-04-09T13:37:23 [base] Update FT_MulFix inlining. Resolves inconsistencies in 64-bit multiplication discussed in !355. Importantly, FT_MulFix arguments and return value is FT_Long, whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or 4 bytes on Windows. * include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed. (FT_MulFix_64): Generalize and prioritize the inline implementation for all 64-bit platforms ifdef FT_INT64. * src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'. * src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers to enable its inlining.
Behdad Esfahbod d0c905c6 2025-02-24T19:13:39 [sfnt/CPAL] Return early if user requested currently-set palette Before, we were loading a palette (again and again) even if the same was requested. Even if the font only had one palette... For a font like NotoColorEmoji that has over 5000 colors in its palette, this was dominating the COLRv1 loading times for HarfBuzz (and I believe all other clients) because they have to set the palette to get access to the colors. * src/base/ftcolor.c (FT_Palette_Select): Check the current palette.
Ben Wagner 38272bf8 2024-12-16T14:29:36 [ftstroke] Fix invalid pointer assignement to `arc` In `FT_Stroker_ConicTo` and `FT_Stroker_CubicTo` there is a `bez_stack`. `arc` is initialized with `arc = bez_stack` and is never set to point into any different object. The main loop looks like `while ( arc >= bez_stack )` which is depending on a later `arc -= 2` (or `arc -= 3`) to make `arc` point to before `bez_stack`. However, using pointer subtraction to make `arc` point outside the array is undefined behavior, and attempting to use the value in the loop predicate is "very" undefined behavior. (C99 "Additive operators" 6.5.6.8.) This particular undefined behavior was discovered as either hangs or MemorySantizer issues after "[InstCombine] Infer nuw for gep inbounds from base of object" [0]. With this change, clang can infer that `arc` must always point into the `bez_stack` object and therefore cannot be at a "negative index" so the predicate is always true. [0] https://github.com/llvm/llvm-project/commit/e21ab4d16b555c28ded307571d138f594f33e325 * src/base/ftstroke.c (FT_Stroker_ConicTo, FT_Stroker_CubicTo): test loop exit condition (there are no more arcs to process) before decrementing `arc` Fixes: #1307
Behdad Esfahbod 13944366 2024-10-15T18:07:55 Move generic destroy to later in the face and size destruction. * src/base/ftobjs.c (destroy_size, destroy_face): This is such that the generic destroy can be used to call `FT_Done_Library`. For that to work, it needs to call it *after* having removed the face from the respective module.
luz paz f92c9655 2024-08-13T23:29:13 Fix various typos.
Werner Lemberg 42608f77 2024-08-11T20:30:23 * Version 2.13.3 released. ========================== Tag sources with `VER-2-13-3'. * docs/VERSION.TXT: Add entry for version 2.13.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.13.2/2.13.3/, s/2132/2133/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 3. * builds/unix/configure.raw (version_info): Set to 26:2:20. * CMakeLists.txt (VERSION_PATCH): Set to 3.
Werner Lemberg ed8b82ba 2024-08-08T10:28:05 Various minor documentation or formatting fixes.
Alexei Podtelezhnikov e181911d 2024-08-05T13:02:04 * src/base/ftstream.c (FT_Stream_ReadFields): Switch to `FT_Offset`.
Alexei Podtelezhnikov 72e199e8 2024-08-01T21:12:41 * src/base/ftstream.c (FT_Stream_ReadFields): Update condition.
Alexei Podtelezhnikov 044d142b 2024-06-20T22:16:51 Use unsigned tags `FT_Outline`. This change comes along with 2a7bb4596f56 ans is only meant to reduce pointer casting in the code. * include/freetype/ftimage.h (FT_Outline): Do it. * src/*: Update `FT_Outline` users.
Alexei Podtelezhnikov 2a7bb459 2024-06-20T20:49:56 Use unsigned point and contour indexing in `FT_Outline`. This doubles the number or allowed points, see https://github.com/harfbuzz/harfbuzz/issues/4752 Although it is hardly practical to use more than 32767 points, other font engines seem to support it. * docs/CHANGES: Announce it. * include/freetype/ftimage.h (FT_Outline): Do it and update limits. * src/*: Update `FT_Outline` users.
Alexei Podtelezhnikov 7a753c96 2024-06-18T21:14:58 * src/base/ftgloadr.c (FT_GlyphLoader_Prepare): Minor refactoring.
Alexei Podtelezhnikov 93a067e3 2024-06-18T17:48:41 [base, autofit, psaux] Remove unnecessary casting. * src/autofit/afhints.c (af_glyph_hints_reload): Remove (short) casting. * src/base/ftgloadr.c (FT_GlyphLoader_Add): Ditto. * src/psaux/psobjs.c ({t1,cff,ps}_builder_{add,close}_contour): Ditto.
Alexei Podtelezhnikov 47574f7e 2024-01-27T11:11:22 Update all copyright notices.
Alexei Podtelezhnikov cc081d7c 2024-01-06T19:22:36 [base] Fix up Mac resource forks and dfonts. * src/base/ftobjs.c (IsMacResource): Assign `face_index`. * src/base/ftmac.c (FT_New_Face_From_Suitcase): Ditto after rework.
Alexei Podtelezhnikov 49781ab7 2023-09-24T20:09:17 Comment typos.
Alexei Podtelezhnikov 73490681 2023-09-24T19:39:10 * src/base/ftcalc.c (FT_MOVE_SIGN): Enclose assignments.
Alexei Podtelezhnikov 95b0fe2a 2023-09-19T22:26:32 [base] Reintroduce `FT_SqrtFixed`. The general square root calculations are not necessary in FreeType. For vector normalization or length, FreeType uses special functions. It is, however, required in the legacy CFF specifications. * src/base/ftcalc.c (FT_SqrtFixed): New function that uses either Babylonian or bit-wise algorithm, whichever is faster for the given situation. * include/freetype/internal/ftcalc.h (FT_SqrtFixed): Declare it.
Alexei Podtelezhnikov babe6af1 2023-09-18T15:01:26 * src/base/ftcalc.c /* FT_SqrtFixed */: Fix defunct overflow.
Alexei Podtelezhnikov 6eb5f2be 2023-09-13T17:02:31 Update 2 files - /src/base/ftcalc.c - /include/freetype/internal/ftcalc.h
Ben Wagner 16f311d7 2023-09-12T18:35:01 [base] Fix typo to correct predicate for call * src/base/ftobj.c (FT_Get_Color_Glyph_Paint): check `get_colr_glyph_paint` before calling `get_colr_glyph_paint` and not `get_colr_layer`
Werner Lemberg 920c5502 2023-08-25T19:51:30 * Version 2.13.2 released. ========================== Tag sources with `VER-2-13-2'. * docs/VERSION.TXT: Add entry for version 2.13.2. * 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.13.1/2.13.2/, s/2131/2132/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 2. * builds/unix/configure.raw (version_info): Set to 26:1:20. * CMakeLists.txt (VERSION_PATCH): Set to 2.
Alexei Podtelezhnikov 0c817334 2023-08-25T17:57:47 * src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding.
Alexei Podtelezhnikov 97251fd5 2023-08-21T23:23:22 [base] Improve the matrix degeneracy check. Also fixes #1251. * src/base/ftcalc.c (FT_Matrix_Check): To avoid overflow, scale by shifting. * include/freetype/internal/ftcalc.h (FT_Matrix_Check): Update description.
Ben Wagner a9793fea 2023-08-15T11:30:26 [base] Avoid UB with memcpy `FT_NEW_ARRAY(p, 0)` sets `p` to `NULL`. `FT_Stream_ReadAt` with a memory based stream uses `FT_MEM_COPY` which is `memcpy` which specifies that it is undefined behavior for either the `src` or `dst` to be `NULL`. Instead of forcing all callers work around calling `FT_Stream_Read` when `buffer == NULL && count == 0` do the check in `FT_StreamRead`. This allows any call with `count == 0` to succesfully read zero bytes without UB. * src/base/ftstream.c (FT_Stream_ReadAt): skip `FT_MEM_COPY` when `count == 0`. (FT_Stream_TryRead): ditto Fixes: #1250
Alexei Podtelezhnikov 95a87208 2023-08-01T22:48:31 * src/base/ftobjs.c (open_face_from_buffer): Silence `maybe-uninitialized`. We never call this function without a `driver_name` (#1245).
Werner Lemberg e4586d96 2023-06-24T05:18:54 * Version 2.13.1 released. ========================== Tag sources with `VER-2-13-1'. * docs/VERSION.TXT: Add entry for version 2.13.1. * 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.13.0/2.13/1/, s/2130/2131/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. * builds/unix/configure.raw (version_info): Set to 26:0:20. * CMakeLists.txt (VERSION_PATCH): Set to 1. * subprojects/libpng.wrap, subprojects/zlib.wrap, subprojects/dlg: Updated.
Werner Lemberg 416d4c25 2023-05-15T15:44:36 Add new load flag `FT_LOAD_NO_SVG`. Modern color fonts often contain both an 'SVG' and 'COLR' table. FreeType always preferred 'SVG' over 'COLR' (this was a design decision), however, this might not be the right choice for the user. The new flags makes FreeType ignore the 'SVG' table while loading a glyph. Fixes #1229. * include/freetype/freetype.h (FT_LOAD_NO_SVG): New macro. * src/base/ftobjs.c (FT_Load_Glyph), src/cff/cffgload.c (cff_slot_load), src/truetype/ttgload.c (TT_Load_Glyph): Use it.
Werner Lemberg e05c0562 2023-05-07T08:29:15 [base] Signature fixes.
Werner Lemberg c8a24209 2023-04-27T11:40:46 [truetype] Fix PostScript name handling for variation fonts. A variation font's PostScript name of a named instance is usually different from the PostScript name of an unnamed instance. However, if a change between a named instance and an unnamed instance with exactly the same design axis values happened, it was possible that the PostScript name wasn't correctly updated. This commit reorganizes the code to handle this issue within the top-level API functions, using a new service to trigger recomputation of the PostScript name. * include/freetype/internal/services/svmm.h (FT_Construct_PS_Name_Func): New typedef. (FT_Service_MultiMasters): New field `construct_ps_name`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call `mm->construct_ps_name` to handle `postscript_name`. (FT_Set_Named_Instance): Call `mm->construct_ps_name` to handle `postscript_name`. Use shortcut. * src/cff/cffdrivr.c (cff_construct_ps_name): New function. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (tt_set_mm_blend): Don't handle `postscript_name`. (TT_Set_MM_Blend): Simplify. (TT_Set_Named_Instance): Return -1 if axis values haven't changed. Don't set `face_index`. (tt_construct_ps_name): New function. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated. * src/type1/t1load.c (T1_Set_MM_Blend): Simplify.
Werner Lemberg 6713b1e4 2023-04-26T12:03:04 [truetype] Fix deactivation of variation font handling. According to the documentation, the functions `FT_Set_Named_Instance`, `FT_Set_MM_Design_Coordinates`, `FT_Set_Var_Design_Coordinates`, and `FT_Set_Var_Blend_Coordinates` can unset the `FT_FACE_FLAG_VARIATION` flag. (The same is true for `FT_Set_MM_WeightVector` but this information was accidentally omitted from the documentation.) However, if a call of these functions didn't change the axis values this could fail because internal shortcuts exited too early. This commit reorganizes the code to handle `FT_FACE_FLAG_VARIATION` in the top-level API functions, also taking care of the issue at hand. * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, FT_Set_MM_WeightVector, FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Handle `FT_FACE_FLAG_VARIATION`. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design, TT_Set_Named_Instance) Don't handle `FT_FACE_FLAG_VARIATION`. * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_WeightVector, T1_Set_MM_Design): Ditto. * src/cff/cffobjs.c (cff_face_init): Use `FT_Set_Named_Instance` instead of low-level functions. * src/truetype/ttobjs.c (tt_face_init): Ditto.
Werner Lemberg fdcb14a2 2023-04-27T06:18:38 s/set_instance/set_named_instance/ * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): Renamed to... (FT_Set_Named_Instance_Func): ...this. (FT_Service_MultiMasters): Rename `set_instance` to `set_named_instance`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/base/ftmm.c (FT_Set_Named_Instance): Updated. * src/cff/cffdrivr.c (cff_set_instance): Renamed to... (cff_set_named_instance): ...this. (cff_service_multi_masters): Updated. * src/cff/cffobjs.c (cff_face_init): Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.
Werner Lemberg fb982e78 2023-04-26T08:17:17 New Variation Font function `FT_Get_Default_Named_Instance`. * include/freetype/ftmm.h, src/base/ftmm.c (FT_Get_Default_Named_Instance): New function. * include/freetype/internal/services/svmm.h (FT_Get_Default_Named_Instance_Func): New typedef. (FT_Service_MultiMasters): New field `get_default_named_instance`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * include/freetype/internal/tttypes.h (TT_Face): New field `var_default_named_instance`. * src/sfnt/sfobjc.s (sfnt_init_face): Initialize `var_default_named_instance`. * src/cff/cffdrivr.c (cff_get_default_named_instance): New function. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize `var_default_named_instance`. (TT_Get_Default_Named_Instance): New function. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated. * docs/CHANGES: Updated.
Werner Lemberg cfe54d6a 2023-04-26T13:15:57 s/this is,/that is,/
Alexei Podtelezhnikov dd78d4a7 2023-03-16T03:28:59 * src/base/ftsynth.c (FT_GlyphSlot_AdjustWeight): New API.
Alexei Podtelezhnikov fc01e7dd 2023-03-05T22:05:24 Fix a couple of MSVC warnings. * src/base/ftcalc.c (FT_MulAddFix): Add cast. * src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Ditto.
Werner Lemberg d399657f 2023-02-26T20:18:54 * src/*: Replace leading underscores with trailing ones in dummy variables. This is to avoid clang warnings.
Tamir Duberstein 3f2ac7d8 2023-02-24T11:48:48 * src/base/ftsystem.c (ft_ansi_stream_io): Avoid undefined behaviour. Also short-circuit on `offset` to avoid checking `count` a second time when `ft_ansi_stream_io` is used for reading. Per ISO/IEC 9899: If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the address space of the program, or a null pointer, or apointer to non-modifiable storage when the corresponding parameter is not const-qualified) or a type (after promotion) not expected by a function with variable number of arguments, the behavior is undefined. If a function argument is described as being an array, the pointer actually passed to the function shall have a value such that all address computations and accesses to objects (that would be valid if the pointer did point to the first element of such an array) are in fact valid. Per IEEE Std 1003.1: size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream); The `fread` function shall read into the array pointed to by `ptr` up to `nitems` elements whose size is specified by `size` in bytes, from the stream pointed to by `stream`. Since the first argument to `fread` is described as being an array, its behavior is undefined when that argument is a null pointer. Per the documentation on `ft_ansi_stream_io`: If `count' is zero (this is, the function is used for seeking), a non-zero return value indicates an error. Thus the intent is clear, and the call to `fread` can be skipped, avoiding undefined behaviour.
Alexei Podtelezhnikov 78464d1b 2023-02-20T22:31:21 * src/base/ftoutln.c (FT_Outline_Check): Fix C4701 warning.
Alexei Podtelezhnikov fecd19b4 2023-02-20T17:13:40 * src/base/ftstroke.c (FT_Stroker_ParseOutline): Clean up contour indexing.
Alexei Podtelezhnikov 34ed28d0 2023-02-20T16:33:45 [base] Clean up contour indexing. * src/base/ftoutln.c (FT_Outline_Reverse, FT_Outline_EmboldenXY, FT_Outline_Get_Orientation): Set the first and last indexes together. (FT_Outline_Decompose): Ditto and check them more stringently. * src/smooth/ftgrays.c (FT_Outline_Decompose)[STANDALONE_]: Ditto.
Alexei Podtelezhnikov 713580f4 2023-02-20T15:58:04 * src/base/ftoutln.c (FT_Outline_Check): Update error code, clean up.
Alex Ringlein 74ea5454 2023-02-16T22:38:35 * src/base/ftoutln.c (FT_Outline_Reverse): Anchor first contour points. A cubic contour has to always start from an on-point. Therefore, we should not swap the first with the last point, which might be off, and obtain an invalid contour. This does not matter for conic contours. If anything, it also saves one swap there. Fixes #1207.
Werner Lemberg de8b92dd 2023-02-09T07:01:12 * Version 2.13 released. ========================== Tag sources with `VER-2-13-0'. * docs/VERSION.TXT: Add entry for version 2.13. * 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.12.1/2.13/, s/2121/2130/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 13. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 25:0:19. * CMakeLists.txt (VERSION_MINOR): Set to 13. (VERSION_PATCH): Set to 0.
Werner Lemberg ac5babe8 2023-02-08T19:36:10 Fix 'fall-through' warning messages. Modern compilers get more insistent on that... * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Define. * src/*: Use it instead of `/* fall through */` comments.
Werner Lemberg be724c81 2023-02-07T22:24:53 For debugging, avoid implicit conversion from integer to double. Otherwise we get zillions of clang 15 warnings. * src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c, src/base/ftobjs.c, src/base/ftoutln.c, src/cff/cffparse.c, src/raster/ftraster.c, src/sfnt/pngshim.c, src/truetype/ttgload.c, src/truetype/ttgxvar.c, src/truetype/ttobjs.c, src/type1/t1gload.c: Use `double` cast in debugging and tracing macros.
Werner Lemberg 37bc7c26 2023-02-07T07:37:07 Avoid reserved identifiers that are globally defined. This is mandated by the C99 standard, and clang 15 produces zillions of warnings otherwise. * devel/ftoption.h, include/freetype/config/ftoption.h, include/freetype/internal/ftmemory.h, src/autofit/afhints.h, src/autofit/afmodule.c, src/autofit/aftypes.h, src/base/ftadvanc.c, src/base/ftdbgmem.c, src/base/ftstream.c, src/bdf/bdflib.c, src/truetype/ttinterp.c: Replace identifiers of the form `_foo` with `foo_`.
Alexei Podtelezhnikov 27b2cd41 2023-02-07T23:03:18 * src/base/ftsynth.c (FT_GlyphSlot_Slant): Add vertical slant. * include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Update it.
Werner Lemberg e97544a7 2023-01-28T17:04:38 Minor changes. Comment fixes, typos, removing of unnecessary parentheses.
Werner Lemberg bacc48e6 2023-01-28T17:04:11 Whitespace.
Ben Wagner d680908a 2023-01-17T16:18:28 [base] Fix typo. * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Request module 't1cid', not 'cid'.
Ben Wagner 188019eb 2023-01-17T16:04:30 [base] Return error if requested driver is not found. In `open_face_from_buffer` it is possible that a driver is requested but FreeType was built without the requested module. Return an error in this case to indicate that the request could not be satisfied, rather than trying all existing driver modules. * src/base/ftobjs.c (open_face_from_buffer): Return `FT_Err_Missing_Module` if a driver is specified but not found.
Werner Lemberg 65f85237 2023-01-17T09:18:25 Update all copyright notices.
Ben Wagner 29f83d1d 2023-01-12T23:45:12 [base] 'close' callback may not use `stream->memory`. The documentation for `FT_StreamRec::memory` states that it 'shouldn't be touched by stream implementations'. This is true even for internal implementations of the 'close' callback, since it is not guaranteed that `memory` will even be set when the 'close' callback occurs. * src/base/ftobjs.c (new_memory_stream): stash current `memory` in `stream->descriptor`. (memory_stream_close): Use it.
Ben Wagner 0d4f887c 2023-01-12T22:43:08 [base] Always close user-provided stream. The `FT_Open_Face` documentation states > If `FT_OPEN_STREAM` is set in `args->flags`, the stream in `args->stream` > is automatically closed before this function returns any error (including > `FT_Err_Invalid_Argument`). However, if the user provides a stream in `args.stream` with `FT_OPEN_STREAM` set and a `close` function, but then for some reason passes NULL for `aface` and a non-negative `face_index`, the error `Invalid_Argument` is returned but the `close` callback will not be called on the user-provided stream. This may cause resource leaks if the caller is depending on the `close` callback to free resources. The difficulty is that a user may fill out a `FT_StreamRec` and pass its address as `args.stream`, but the stream isn't really 'live' until `FT_Stream_New` is called on it (and `memory` is set). In particular, it cannot really be cleaned up properly in `ft_open_face_internal` until the stream pointer has been copied into the `stream` local variable. * src/base/ftobj.c (ft_open_face_internal): Ensure that user-provided `args.stream.close` is called even with early errors.
Ben Wagner 13983b05 2023-01-11T14:47:26 [base] Fix leak of internal stream marked external. `open_face_from_buffer` allocates a new `FT_Stream` to pass to `ft_open_face_internal`. Because this is an `FT_OPEN_STREAM`, `ft_open_face_internal` will mark this as an 'external stream', which the caller must free. However, `open_face_from_buffer` cannot directly free it because the stream must last as long as the face. There is currently an attempt at this by clearing the 'external stream' bit after `open_face_from_buffer` returns successfully. However, this is too late as the original stream may have already been closed and the stream on the face may not be the same stream as originally passed. It is tempting to use `FT_OPEN_MEMORY` and let `ft_open_face_internal` create the stream internally. However, with this method there is no means to pass through a 'close' function to the created stream to free the underlying data, which must be owned by the stream. A possibility is to check on success if the stream of the face is the same as the original stream. If it is then unset the external flag. If not, then free the original stream. Unfortunately, while no current implementation does so, it is possible that the face still has the original stream somewhere other than as the `FT_FaceRec::stream`. The stream needs to remain available for the life of the face or until it is closed, whichever comes earlier. The approach taken here is to let the stream own itself. When the stream is closed it will free itself. * src/base/ftobjs.c (memory_stream_close): Free `stream`. (open_face_from_buffer): Simplify error handling, since `ft_open_face_internal` always closes `args.stream` on any error. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54930
Ben Wagner 15afb554 2023-01-05T12:42:55 [base] Report used stream's external status. In `open_face` the initial stream is set on the face, along with the information about if FreeType is the owner of the stream object itself. The loaders may in the course of their work replace this stream with a new stream (as is the case for 'woff' and 'woff2'), which may have a different ownership than the initial stream object (likely the original stream object is owned by the user and is external, while the new stream object is created internally to FreeType and is internal). When the stream is replaced, the face's flags are updated with the new ownership status. However, `open_face` cannot itself free this stream as its caller `ft_open_face_internal` is responsible for this. In addition, in the case of an error `open_face` cannot return an actual face with the new stream and its ownership status to the caller. As a result, it must pass this information back to the caller as a sort of "failed face" so that the caller can clean up. `open_face` was already passing back the new stream but was not passing back the stream ownership information. As a result the stream may not have been free'd when needed. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54700 * src/base/ftobjs.c (open_face): Pass back the ownership information as well. (ft_open_face_internal): Updated.
Alexei Podtelezhnikov 81a456b2 2023-01-04T22:41:34 * src/base/ftobjs.c (FT_Request_Metrics): Avoid division by zero. The division-by-zero might happen in broken fonts (see #1194). Instead of returning a huge number from FT_DivFix and failing to scale later, we now bail immediately.
Luca Bacci aca4ec59 2022-11-22T22:34:41 * src/base/ftdbgmem.c (ft_mem_source_compare): Add FT_COMPARE_DEF. Closes !230.
suzuki toshiya 32cfab4b 2022-10-10T14:22:12 [build] fix for make multi Fix "make multi" by MR !223 * include/freetype/internal/services/svmm.h: include ftmm.h to define FT_Get_MM_Func. * src/truetype/ttgxvar.h: include ftmmtypes.h to use GX_AVarTable properly. * src/base/ftmac.c: include ftdebug.h to use FT_THROW() properly.
Liu Kunpeng(柳鲲鹏) bb59c3c9 2022-10-16T22:10:19 * src/base/ftsynth.c (FT_GlyphSlot_Slant): New API with custom slant. * include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Declare it.
Ali Chraghi 5faa1df8 2022-09-29T18:25:41 [base] FT_Attach_Stream: Make `parameters` argument constant.
Alexei Podtelezhnikov c9c32631 2022-09-22T20:40:21 [base] Clean up the bitmap flow control. * src/base/ftbitmap.c (FT_Bitmap_Copy): Flip the copy if its pitch is trully opposite, zero is not a positive value. (FT_Bitmap_Convert): Set negative pitch as needed, accept negative alignment values.
Alexei Podtelezhnikov c456eeb4 2022-09-22T15:09:17 [base] Discard and recreate bitmaps for copying and converting. Reusing target bitmaps for copying and converting is permitted. It is, however, pointless to preserve their content before overwriting. Free- malloc might be faster than realloc. * src/base/ftbitmap.c (FT_Bitmap_Copy, FT_Bitmap_Convert): Free an old buffer and create a new one.
Alexei Podtelezhnikov dd91f6e7 2022-08-26T22:24:02 * src/base/ftver.rc: Explicitly use UTF-16. Fixes #1177 to avoid mistranslation and other problems.
Chris Liddell 37b718d5 2022-08-15T10:44:05 [base, type1] Better handling of out-of-memory situations. This follows similar code in `cff_slot_done`. * src/base/ftobjs.c (ft_glyphslot_done), src/type1/t1objs.c (T1_GlyphSlot_Done): Check `internal` pointer. The Type1 problems was reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50057.
Alexei Podtelezhnikov 480be443 2022-08-01T22:59:58 * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Reduce casting.
Werner Lemberg 2af6903b 2022-07-29T22:42:22 * src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error.
Ben Wagner 0417e54b 2022-07-22T16:22:19 [base] Build outlines in amortized constant time. When resizing the loader's points and contours, resize them to at least 1.5 times their current size. The code currently only reserves as much space as is currently required, leading to O(n^2) runtime when adding points one at a time. This change does not attempt to ever shrink the loader's point and contour storage since this was not attempted previously either. The 1.5 multiple was chosen as a trade-off between potentially unused space and the runtime. * src/base/ftgloader.c (FT_GlyphLoader_CheckPoints): Implement it. Fixes #1173.
Chris Liddell 1a242558 2022-06-30T09:25:14 [base] Improve error handling in `FT_GlyphLoader_CheckPoints`. If `FT_GlyphLoader_CreateExtra` returns an error (and a couple of other places), `FT_GlyphLoader_CheckPoints` would propagate the error immediately, rather than cleaning up the partially set up `FT_GlyphLoader`. As a consequence, a subsequent attempt to create a glyph could result in a crash. * src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Ensure all the error conditions exits are consistent, eventually calling `FT_GlyphLoader_Reset`.
Dominik Röttsches bec4ef41 2022-07-01T12:04:28 [base] Round values in `FT_MulAdd_Fix`. This avoids regressing Blink layout tests and makes `FT_MulAdd_Fix` delta retrieval implementation consistent with the previous implementation, which used `FT_fixedToInt` and included rounding. * src/base/ftcalc.c (FT_MulAdd_Fix): Implement it. Also fix remaining `temp` initialization compilation issue. Fixes #1169.
Werner Lemberg de27955c 2022-07-01T06:33:50 Minor formatting.
Dominik Röttsches 0607e0e9 2022-06-30T10:55:50 Fix initialisation of temp variable in new FT_MulAddFix src/truetype/ttgxvar.c (FT_MulAddFix): Initialise `temp`.
Dominik Röttsches 15fef219 2022-06-29T11:48:10 New function `FT_MulAddFix` to compute the sum of fixed-point products. This function, based on the code of `FT_MulFix`, uses 64-bit precision internally for intermediate computations. * include/freetype/internal/ftcalc.h, base/ftcalc.c (FT_MulAddFix): Implement it.
Ben Wagner f7daf9d2 2022-06-17T12:37:02 [stream] Fix reading s32 when long is s64 `FT_READ_LONG`, `FT_GET_LONG`, and related macros did not return negative values when `long` is more than 32 bits. `FT_Stream_ReadULong` would read four bytes into the LSB of an `FT_ULong` and return that. Since this can never set the MSb of the `FT_ULong` when `FT_ULong` is more than 32 bits the cast to `FT_Long` never resulted in a negative value. Fix this by modifying `FT_Stream_Read*` to return a type of the same size as the bytes it is reading and changing the `FT_READ_*` and `FT_GET_*` macros to cast to the same type returned by `FT_Stream_Read*` but with the correctly signed type (instead of casting to what is assumed to be the type of `var` which will happen automatically anyway). There exist a few cases like with the `OFF3` variants where there isn't generally a type with the correct size. `FT_PEEK_OFF3` works around this loading the bytes into the three most significant bits and then doing a signed shift down. `FT_NEXT_OFF3` also already worked correctly by casting this signed value to another signed type. `FT_Stream_GetUOffset` works correctly but one must be careful not to attempt to cast the returned value to a signed type. Fortunately there is only `FT_GET_UOFF3` and no `FT_GET_OFF3`. All of these cases are handled correctly when reading values through `FT_Stream_ReadFields` since it generically computes the signed value through an `FT_Int32`. This change is essentially doing the same for these macros. * include/freetype/internal/ftstream.h (FT_NEXT_*, FT_GET_*, FT_READ*): Update macros and return types to use fixed size types for fixed size values. * src/base/ftstream.c (FT_StreamGet*, FT_StreamRead*): Dito. Issue: #1161