include


Log

Author Commit Date CI Message
Werner Lemberg 2af6903b 2022-07-29T22:42:22 * src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error.
Werner Lemberg 38dc768a 2022-07-29T21:17:06 Fix clang14 compiler warnings. * include/freetype/internal/ftstream.h (FT_GET_SHORT_LE, FT_GET_USHORT_LE): Fix type. * src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Always return boolean value. (tt_face_get_colorline_stops): Fix type of `var_index_base`.
Dominik Röttsches 3414fef7 2022-07-04T16:29:31 [sfnt] Support variable 'COLR' v1 color lines. * include/freetype/ftcolor.h (FT_ColorStopIterator): Add field `read_variable` to indicate whether a variation index base should be read. * src/sfnt/ttcolr.c: (FT_PaintFormat_Internal): New enumerations `FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT` `FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT`, and `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT`. (read_color_line): New parameter `read_variable`; update callers. (read_paint): Handle new enumerations.
Stephen Holdaway d5d048bb 2022-07-03T20:26:31 doc: Clarify description of `FT_Stream_IoFunc`. The existing documentation comments on `FT_Stream_IoFunc` hinted at the dual seek/read behavior required for custom stream implementations to work, but it didn't explicitly explain it. Without looking at the internals of FreeType, it was easy for someone to assume their implementation should handle both seek and read operations all the time. If this is done, you get a variety of errors, but mostly just `Unknown_File_Format` (error code 0x02).
Werner Lemberg 31005d98 2022-07-02T09:34:13 include/freetype/ftmm.h: Improve documentation.
Dominik Röttsches dece9535 2022-06-29T11:48:53 [truetype] Perform variation store delta computation with 64-bit precision. * include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Make type explicitly 32-bit. * include/freetype/internal/services/svmm.h (FT_Var_Get_Item_Delta_Func): Change return type to `FT_ItemVarDelta` * truetype/ttgxvar.h (tt_var_get_item_delta): Change return type to `FT_ItemVarDelta`. * truetype/ttgxvar.c (tt_var_get_item_delta): Store scalars and deltas to intermediate array, perform computation using new method `FT_MulAddFix`.
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.
Dominik Röttsches 117df36b 2022-06-22T09:33:20 [sfnt] Upgrade stop_offset to FT_Fixed from FT_F2Dot14
Werner Lemberg 2848378b 2022-06-21T17:08:04 s/fixed point/fixed-point/
Dominik Röttsches 4b6f92e6 2022-06-01T13:24:09 Proposal: Feature control for variable COLRv1 * include/freetype/ftdriver.h (variable-color-v1 property): Add documentation for variable-colr-v1 property. * src/truetype/ttdriver.c (tt_property_set): Ingest variable-control property when called, set to enable_variable_colrv1 driver flag. * src/truetype/ttobjs.h (TT_DriverRec): Add enable_variable_colrv1 flag.
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
Ben Wagner b11074cf 2022-06-06T15:59:56 [svg] Set linear advances when loading SVG glyphs * include/freetype/freetype.h (FT_GlyphSlotRec_): update doc * src/cff/cffgload.c (cff_slot_load): do it * src/truetype/ttgload.c (TT_Load_Glyph): do it Fixes: #1156
Dominik Röttsches 7838c78f 2022-05-20T17:22:25 [truetype] Support reading 32bit/16bit VarStore deltas * include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Define type to be used for delta arrays, upgrade to FT_long. * src/truetype/ttgxvar.c: Adhere to long_words bit and read either Short/Byte pairs or Long/Short pairs, as defined by spec. For better readability, define macro for repetitive read code.
Dominik Röttsches a4c4566b 2022-05-19T06:30:47 [truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`. This will be needed for 'COLR' v1 variation support. * src/truetype/ttgxvar.h (GX_ItemVarData, GX_AxisCoords, GX_VarRegion, GX_VarItemStore, GX_DeltaSetIdxMap): Move structures to... * include/freetype/internal/ftmmtypes.h: ... this new file. * include/freetype/internal/service/svmm.h (MultiMasters): Include `ftmmtypes.h`. (FT_Var_Load_Delta_Set_Idx_Map_Func, FT_Var_Load_Item_Var_Store_Func, FT_Var_Get_Item_Delta_Func, FT_Var_Done_Item_Var_Store_Func, FT_Var_Done_Delta_Set_Idx_Map_Func): New function typedefs. (MultiMasters): Add them. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/cff/cffdrivr.c (cff_load_item_variation_store, cff_load_delta_set_index_mapping, cff_get_item_delta, cff_done_item_variation_store, cff_done_delta_set_index_map): New wrapper methods calling into mm service. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (ft_var_load_item_variation_store, ft_var_load_delta_set_index_mapping, ft_var_get_item_delta, ft_var_done_item_variation_store, ft_var_done_delta_set_index_map): Renamed to ... (tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping, tt_var_get_item_delta, tt_var_done_item_variation_store, tt_var_done_delta_set_index_map): ... this for consistency. Mark them as non-static. * src/truetype/ttgxvar.h: Add corresponding prototypes. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.
Werner Lemberg e8ebfe98 2022-05-01T07:05:36 * Version 2.12.1 released. ========================== Tag sources with `VER-2-12-1'. * docs/VERSION.TXT: Add entry for version 2.12.1. * docs/CHANGES, docs/release: 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.0/2.12.1/, s/2120/2121/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. * builds/unix/configure.raw (version_info): Set to 24:3:18. * CMakeLists.txt (VERSION_PATCH): Set to 1.
Ben Wagner a1ca7010 2022-04-04T15:28:54 [sfnt] Correct FT_ColorStopIterator documentation. * include/freetype/ftcolor.h (FT_ColorStopIterator): the user should not set `p` to NULL before calling `FT_Get_Colorline_Stops`. `p` and `num_color_stops` are set by `FT_Get_Paint`. `p` and `current_color_stop` are updated by `FT_Get_Colorline_Stops`.
Werner Lemberg e50798b7 2022-03-30T14:06:21 * Version 2.12.0 released. ========================== Tag sources with `VER-2-12-0'. * docs/VERSION.TXT: Add entry for version 2.12.0. * docs/CHANGES, docs/release: 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.11.1/2.12.0/, s/2111/2120/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 12. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 24:2:18. * CMakeLists.txt (VERSION_MINOR): Set to 12. (VERSION_PATCH): Set to 0. * builds/toplevel.mk (do-dist): Generate `ChangeLog` entries for all commits since version 2.11.0 (when we stopped creating this file manually).
Werner Lemberg a8e4563c 2022-03-19T23:54:31 Add `FT_FACE_FLAG_SBIX_OVERLAY` and `FT_HAS_SBIX_OVERLAY`. * include/freetype/freetype.h (FT_FACE_FLAG_SBIX_OVERLAY, FT_HAS_SBIX_OVERLAY): New macro. * src/sfnt/ttsbit.c (tt_face_load_sbit): Handle `FT_FACE_FLAG_SBIX_OVERLAY`. Remove obsolete tracing message.
Werner Lemberg 1949a7ec 2022-03-19T18:51:34 Add `FT_PARAM_TAG_IGNORE_SBIX`. This is another bit to handle 'sbix' tables as described in the OpenType specification. * include/freetype/ftparams.h (FT_PARAM_TAG_IGNORE_SBIX): New macro. * src/sfnt/sfobjc.c (is_apple_sbix): Rename to... (has_sbix): ... this. Check for more sbit tables. Handle `FT_PARAM_TAG_IGNORE_SBIX` to eventually control `has_sbix`. Only call sbit table loader if an sbit table is present.
Werner Lemberg 907715a6 2022-02-09T07:31:56 Add `FT_FACE_FLAG_SBIX` and `FT_HAS_SBIX`. Fonts with 'sbix' tables need special handling by the application. * include/freetype/freetype.h (FT_FACE_FLAG_SBIX, FT_HAS_SBIX): New macros. * src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_SBIX` if 'sbix' table is present.
Werner Lemberg 06727a52 2022-02-09T08:36:15 * include/freetype/freetype.h (FT_LOAD_SBITS_ONLY): Tag macro as public.
Ben Wagner 7789f2bb 2022-03-18T15:52:47 [doc] FT_OUTLINE_OVERLAP was introduced in 2.10.3. * include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Document when added.
Anuj Verma 5499d7bf 2022-03-04T16:42:02 * include/freetype/freetype.h: Improve SDF documentation.
Werner Lemberg 01d4deb0 2022-02-16T14:21:00 ftmm.h: Minor documentation improvement.
Werner Lemberg 5a53e51b 2022-02-12T07:58:43 t1tables.h: Documentation improvements.
Werner Lemberg c67ecb8c 2022-02-12T07:52:57 t1tables.h: Whitespace.
Werner Lemberg 24db55ec 2022-02-05T09:06:39 Various minor doc fixes.
Werner Lemberg 36ee3160 2022-01-31T10:37:56 freetype.h: Minor documentation improvement.
Ben Wagner e34a860a 2022-01-27T11:50:12 Document `FT_Outline_Decompose` degenerate segments. `FT_Outline_Decompose` does not filter out and can return degenerate segments in an outline. This can be surprising when attemping to stroke such an outline. Clarify the existing documentation on this matter to cover all forms of degeneracy (without specifying exactly how they will be reported), why they might arise, and better explain in what cases they may be an issue. * include/freetype/ftoutlin.h (FT_Outline_Decompose): update documentation. Fixes #952.
Werner Lemberg 267c6918 2022-01-25T14:46:36 Aarg, typo.
Werner Lemberg 9af1127f 2022-01-25T14:45:10 freetype.h: More updates to `FT_LOAD_COLOR` description.
Werner Lemberg 6a8e95b7 2022-01-25T08:49:41 Update documentation for `FT_LOAD_COLOR`.
Werner Lemberg ef48a332 2022-01-23T19:05:15 * src/svg/ftsvg.c (ft_svg_property_set): Disallow NULL pointers.
Werner Lemberg 21d0fa37 2022-01-23T12:03:44 More documentation on handling OT-SVG.
Moazin Khatti 0bf49bd2 2021-12-25T20:14:11 Add 'svg' module for OT-SVG rendering. * CMakeLists.txt (BASE_SRCS): Add svg module file. * meson.build (ft2_public_headers): Add `otsvg.h`. * modules.cfg (RASTER_MODULES): Add `svg` module. * builds/meson/parse_modules_cfg.py: Add svg module. * include/freetype/config/ftmodule.h: Add `ft_svg_renderer_class`. * include/freetype/fterrdef.h: Add `Invalid_SVG_Document` and `Missing_SVG_Hooks` error codes. * include/freetype/internal/fttrace.h: Add tracing for `otsvg`. * include/freetype/internal/svginterface.h: New file. It adds an interface to enable the presetting hook from the `base` module. * include/freetype/otsvg.h (SVG_Lib_Init_Func, SVG_Lib_Free_Func, SVG_Lib_Render_Func, SVG_Lib_Preset_Slot_Func): New hooks for SVG rendering. (SVG_RendererHooks): New structure to access them. * src/base/ftobjs.c: Include `svginterface.h`. (ft_glyphslot_preset_bitmap): Add code for presetting the slot for SVG glyphs. (ft_add_renderer): Updated. * src/svg/*: New files.
Moazin Khatti 97c09a80 2021-12-25T19:55:58 Add `FT_Glyph` support for OT-SVG glyphs. * include/freetype/ftglyph.h (FT_SvgGlyphRec, FT_SvgGlyph): New structure. * src/base/ftglyph.c: Include `otsvg.h`. (ft_svg_glyph_init, ft_svg_glyph_done, ft_svg_glyph_copy, ft_svg_glyph_transform, ft_svg_glyph_prepare): New function. (ft_svg_glyph_class): New class. (FT_New_Glyph, FT_Glyph_To_Bitmap): Updated to handle OT-SVG glyphs. * src/base/ftglyph.h: Updated.
Moazin Khatti f93a897a 2021-12-25T19:20:44 Add code to load OT-SVG glyph documents. * include/freetype/config/ftheader.h (FT_OTSVG_H): New macro. * include/freetype/freetype.h (FT_FACE_FLAG_SVG, FT_HAS_SVG): New macros. (FT_LOAD_SVG_ONLY): New internal macro. * include/freetype/ftimage.h (FT_Glyph_Format): New enumeration value `FT_GLYPH_FORMAT_SVG`. * include/freetype/internal/ftobjs.h (FT_GLYPH_OWN_GZIP_SVG): New macro. * include/freetype/internal/fttrace.h: Add `ttsvg` for `ttsvg.c`. * include/freetype/internal/sfnt.h(load_svg, free_svg, load_svg_doc): New functions. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `svg` for the SVG table. * include/freetype/otsvg.h (FT_SVG_DocumentRec): New structure to hold the SVG document and other necessary information of an OT-SVG glyph in a glyph slot. * include/freetype/tttags.h (TTAG_SVG): New macro. * src/base/ftobjs.c: Include `otsvg.h`. (ft_glyphslot_init): Allocate `FT_SVG_DocumentRec` in `slot->other` if the SVG table exists. (ft_glyphslot_clear): Free it upon clean-up if it is a GZIP compressed glyph. (ft_glyphslot_done): Free the document data if it is a GZIP compressed glyph. (FT_Load_Glyph): Don't auto-hint SVG documents. * src/cache/ftcbasic.c (ftc_basic_family_load_glyph): Add support for FT_GLYPH_FORMAT_SVG. * src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttsvg.c`. * src/sfnt/sfdriver.c: Include `ttsvg.h`. (sfnt_interface): Add `tt_face_load_svg`, `tt_face_free_svg` and `tt_face_load_svg_doc`. * src/sfnt/sfnt.c: Include `ttsvg.c`. * src/sfnt/sfobjs.c (sfnt_load_face, sfnt_done_face): Add code to load and free data of the the SVG table. * src/sfnt/ttsvg.c: New file, implementing `tt_face_load_svg`, `tt_face_free_svg` and `tt_face_load_svg_doc`. * src/sfnt/ttsvg.h: Declarations of the SVG functions in `ttsvg.c`.
Moazin Khatti 06c1a25e 2021-12-25T17:59:42 Add flag `FT_CONFIG_OPTION_SVG`. This flag is going to be used to conditionally compile support for OT-SVG glyphs. FreeType will do the parsing and rely on external hooks for rendering of OT-SVG glyphs. * devel/ftoption.h, include/freetype/config/ftoption.h (FT_CONFIG_OPTION_SVG): New flag.
Alexei Podtelezhnikov 99a940f8 2022-01-20T15:06:09 * include/freetype/freetype.h: Clarify `FT_Size` life cycle.
Alexei Podtelezhnikov 054782c4 2022-01-19T22:14:06 [base] Undefined scale means no scale. It might be surprising that FreeType does not have default ppem and the size has to be set explicitly or face undefined behavior with undefined variables and errors. This offers an alternative to missing or zero scale by simply setting FT_LOAD_NO_SCALE. Defined behavior is bettr than undefined one. This is alternative to !132 and discussed in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43708 * src/base/ftobjs.c (FT_Load_Glyph): Deal with zero scale. * include/freetype/freetype.h: Document it.
Ozkan Sezer 3f6497bd 2022-01-15T22:44:28 Add Watcom C/C++ calling. In the unlikely case the source is built with OpenWatcom's -ec? switches to enforce a calling convention, the qsort() compare function must still be set to __watcall. * include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF): Updated.
Ozkan Sezer 11ea89b5 2022-01-14T22:07:44 Add Watcom C/C++ support. * include/freetype/config/integer-types.h: Make sure `long long` is used then available. * include/freetype/internal/ftcalc.h (FT_MSB): Add Watcom C/C++ pragma.
Alexei Podtelezhnikov 7f7bf6f0 2022-01-14T20:33:28 * include/freetype/internal/compiler-macros.h [FT_COMPARE_DEF]: Tighten. This works around Watcom C library using __watcall.
Werner Lemberg d0cfb4e1 2022-01-11T10:54:10 Update all copyright notices.
Werner Lemberg 2b672e72 2022-01-02T18:33:03 * builds/unix/configure.raw: Restore `SYSTEM_ZLIB` variable. This was accidentally removed with commit 93ebcbd0 almost eight years ago.
Alexei Podtelezhnikov 7add5b2b 2021-12-11T22:54:06 [truetype] Binary search through the `hdmx` records. The `hdmx` table is supposed to be sorted by ppem size, which enables binary search. We also drop the check for the sufficient length of the record because it is now enforced when the table is loaded. * include/freetype/internal/tttypes.h (TT_FaceRec): Store the `hdmx` record pointers sorted by ppem instead of ppem's themselves. * src/truetype/ttpload.c (tt_face_load_hdmx): Prudently sort records. (tt_face_get_device_metrics): Implement binary search to retrieve advances.
Alexei Podtelezhnikov 6c831d65 2021-12-11T22:34:27 [truetype] Initialize the loader with `hdmx` data. The `hdmx` matching can be done before the glyph is loaded. * include/freetype/internal/tttypes.h (TT_LoaderRec): Add a field. * src/truetype/ttgload.c (compute_glyph_metrics): Relocate the `hdmx` code from here... (tt_loader_init): ... to here, before the glyph is loaded.
Werner Lemberg 3f83daee 2021-12-01T20:17:59 * Version 2.11.1 released. ========================== Tag sources with `VER-2-11-1'. * docs/VERSION.TXT: Add entry for version 2.11.1. * docs/CHANGES, docs/release: 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.11.0/2.11.1/, s/2110/2111/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. * builds/unix/configure.raw (version_info): Set to 24:1:18. * CMakeLists.txt (VERSION_PATCH): Set to 1. * builds/toplevel.mk (version_tag, CHANGELOG_SCRIPT): New variables. (do-dist): Generate `ChangeLog` file with all commits since last release.
Werner Lemberg 3cabd142 2021-11-22T19:36:45 Update `CHANGES` files, other minor whitespace and documentation issues.
Alexei Podtelezhnikov f8a4163a 2021-11-20T07:01:26 * include/freetype/fttypes.h (FT_MAKE_TAG): Remove the same casting.
Werner Lemberg 8c8f51c5 2021-11-19T21:50:22 Avoid undefined left-shifts. We really have to use double casts to avoid issues with C's and C++'s signedness propagation rules in implicit casts. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41178 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41182 * include/freetype/config/public-macros.h (FT_STATIC_CAST, FT_REINTERPRET_CAST): Modify macro to take two arguments. Update all callers. (FT_STATIC_BYTE_CAST): New macro. * include/freetype/freetype.h (FT_ENC_TAG): Use `FT_STATIC_BYTE_CAST`. * include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto. * include/freetype/fttypes.h (FT_MAKE_TAG): Ditto. Use `FT_Tag` for casting. * src/ftraster/ftmisc.h (FT_MAKE_TAG): Removed, no longer needed. (FT_STATIC_BYTE_CAST): New macro. * src/smooth/ftgrays.c (FT_STATIC_CAST): Replace with... (FT_STATIC_BYTE_CAST): ... this.
Werner Lemberg 9079c5d9 2021-11-13T08:53:19 Provide C++ versions for public macros with casts. Many FreeType clients use C++. However `g++ -Wold-style-cast` warns for macros with C-style casts even for system header files; this also affects directories included with `-isystem`. While this could be seen as a problem with g++, the problem is more a philosophical one: Over the time, C and C++ diverged more and more, and some features of C are no longer the 'right' solution in C++. * include/freetype/config/public-macros.h (FT_STATIC_CAST, FT_REINTERPRET_CAST): New macros. * include/freetype/freetype.h (FT_ENC_TAG, FT_LOAD_TARGET_, FT_LOAD_TARGET_MODE): Use `FT_STATIC_CAST`. Correctly handle negative 'signed char' input. * include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto. * include/freetype/fttypes.h (FT_MAKE_TAG, FT_BOOL): Ditto. * include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): Use `FT_REINTERPRET_CAST`. * src/smooth/ftgrays.c (FT_STATIC_CAST)[STANDALONE_]: New macro. [!STANDALONE]: Include `FT_CONFIG_CONFIG_H`. Fixes #1116.
Alexei Podtelezhnikov 42e61723 2021-11-11T23:06:36 Explicitly define `FT_MSB` for Clang. * include/freetype/internal/ftcalc.h [__clang__] (FT_MSB): Updated.
Alexei Podtelezhnikov 188c7d66 2021-11-09T22:47:26 Additional `FT_MSB` macro definitions. Better macros for Windoes CE and ARM in general, based on !109 from metarutaiga. * include/freetype/internal/ftcalc.h [_MSC_VER] (FT_MSB): Updated.
Alexei Podtelezhnikov 7f4b9bfb 2021-11-07T10:20:16 [dlg] Define DLG_STATIC explicitly. DLG_STATIC is intended to disable Windows DLL linking attributes. It does not hurt to define it explicitly when we wrap DLG code. This fixes tons of LNK4286 and C4273 warnings from MSVC if we forget to define DLG_STATIC as a compiler option. * builds/windows/vc2010/freetype.vcxproj: Remove DLG_STATIC option. * src/dlg/dlgwrap.c [FT_DEBUG_LOGGING]: Define DLG_STATIC. * include/freetype/internal/ftdebug.h [FT_DEBUG_LOGGING]: Ditto.
Dominik Röttsches d3d3ff76 2021-11-01T17:32:27 [sfnt] Clarify `COLR` v1 FT_Paint* format representations * include/freetype/ftcolor.h (FT_PaintLinearGradient, FT_PaintRadialGradient, FT_PaintSweepGradient, FT_PaintTransform, FT_PaintTranslate, FT_PaintScale, FT_PaintRotate, FT_PaintSkew): Clarify 16.16 fixed point representation of struct fields. * src/sfnt/ttcolr.c (read_paint): Shift coordinates for FT_PaintLinearGradient, FT_PaintRadialGradient, FT_PaintSweepGradient accordingly. Fixes: https://gitlab.freedesktop.org/freetype/freetype/-/issues/1110
Alexei Podtelezhnikov 793c0126 2021-10-27T22:36:11 [woff] Optimize table tagging. * include/freetype/internal/wofftypes.h (WOFF_TableRec): Use 32-bit tag. * src/sfnt/sfwoff.c (woff_open_font): Use 32-bit tag.
Alexei Podtelezhnikov a577bbcb 2021-10-27T22:24:27 [woff2] Optimize table tagging. Fixes #1107. * include/freetype/internal/wofftypes.h (WOFF2_TableRec): Use 32-bit tag. * src/sfnt/sfwoff2.c (compare_tags, find_table, woff2_open_font): Use 32-bit tag. * src/sfnt/woff2tags.[ch] (woff2_known_tags): Use static storage and return 32-bit tag.
Ben Wagner c71eb22d 2021-10-15T22:18:38 Fix typos in memory macros. FT_QNEW_ARRAY and FT_QRENEW_ARRAY were using the non-Q FT_MEM_NEW_ARRAY and FT_MEM_RENEW_ARRAY. Change these to use the Q versions. Also fix the one issue discovered in tt_face_load_name where table->names is created with FT_QNEW_ARRAY but the extra string member is not initialized to NULL. * include/freetype/internal/ftmemory.h (FT_Q(RE)NEW_ARRAY): Use FT_MEM_Q(RE)NEW_ARRAY as needed. * src/sfnt/ttload.c (tt_face_load_name): Initialize `entry->string`.
Alexei Podtelezhnikov 3b036820 2021-10-10T23:11:10 [cid] Signedness revisions. Unsigned checks are simpler. * include/freetype/t1tables.h (CID_FaceInfoRec): Change to unsignd `num_dicts`. * src/cid/cidparse.h (CID_Parser): Change to unsigned `num_dict`. * src/cid/cidgload.c (cid_load_glyph): Updated. * src/cid/cidload.c (cid_load_keyword, parse_fd_array, parse_expansion_factor, parse_font_name, cid_read_subrs, cid_face_open): Updated. * src/cid/cidobjs.c (cid_face_done): Updated. * src/cid/cidparse.c (cid_parser_new): Updated.
Alexei Podtelezhnikov 22befeef 2021-10-07T22:41:56 Signedness revisions. This eliminates explicit casting by switching to unsigned fields. The revisions mostly impact the handling of CID fonts. * include/freetype/fttypes.h (FT_Data): Change to unsigned `length`. * include/freetype/t1tables.h (CID_FaceDictRec): Ditto for `sd_bytes`. (CID_FaceInfoRec): Ditto for `gd_bytes` and `gd_bytes`. * include/freetype/internal/tttypes.h (TT_LoaderRec): Ditto for `byte_len`. * src/cid/cidgload.c (cid_load_glyph): Updated. * src/cid/cidload.h (cid_get_offset): Update argument. * src/cid/cidload.c (cid_get_offset, cid_read_subrs, cid_face_open): Updated. * src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data): Updated. * src/psaux/psft.c (cf2_getT1SeacComponent): Updated. * src/truetype/ttgload.c (TT_Process_Composite_Glyph, load_truetype_glyph): Updated.
Alexei Podtelezhnikov bbab0a67 2021-10-04T23:55:46 * include/freetype/internal/ftgloadr.h: Add missing header. Noticed by Jouk Jansen.
Alexei Podtelezhnikov 311764fa 2021-10-01T11:50:12 Additional `FT_MSB` macro definitions. * include/freetype/internal/ftcalc.h [__DECC,_CRAYC]: Use builtins and intrinsics.
Alexei Podtelezhnikov 766b2c19 2021-09-24T22:14:22 Propagate sign when reading OFF3. Signed 24-bit values are extremely rare. FreeType only reads them in PFR fonts with bitmap strikes conditionally. They have not been seen in the known fonts. That is why this bug could never be discovered. `FT_FRAME_OFF3` propagates sign correctly. * include/freetype/internal/ftstream.h (FT_PEEK_OFF3, FT_PEEK_OFF3_LE): Propagate sign into 32-bit value. (FT_GET_OFF3, FT_READ_OFF3): Needed fixing but removed as unused.
Alexei Podtelezhnikov a29e0200 2021-09-23T23:10:26 Use NULL for pointers only. * src/bdf/bdflib.c (*): Code changes. * include/freetype/freetype.h: Comments only. * src/cff/cffload.c, src/cff/cffobjs.c: Ditto. * src/winfonts/winfnt.c: Ditto.
Werner Lemberg 6d19b29f 2021-09-23T08:46:01 Minor documentation fixes and improvements.
Alexei Podtelezhnikov 3b573e45 2021-09-22T22:22:13 Reference `fopen` in the docs.
Alexei Podtelezhnikov e942a310 2021-09-09T22:17:46 [truetype] Tweak `loca` clamping. Fixes #1095. * src/truetype/ttpload.c (tt_face_load_loca): Fix up clamping. * include/freetype/internal/tttypes.h (TT_Face): Correct docs.
Alexei Podtelezhnikov 7482c98f 2021-09-01T22:18:29 [base] Clean up stream reading. * src/base/ftstream.c (FT_Stream_ReadUShort, FT_Stream_ReadUOffset, FT_Stream_ReadULong and their LE variants): Remove unnecessary initialization and slightly refactor. (FT_Stream_GetByte, FT_Stream_ReadByte): Rename to return unsigned value and align with sister functions. * include/freetype/internal/ftstream.h (FT_Stream_GetByte, FT_Stream_ReadByte): Update prototypes and caller macros.
Alexei Podtelezhnikov 78f2bd0b 2021-08-22T22:32:07 Whitespace formatting.
Alexei Podtelezhnikov d92aa23f 2021-08-22T13:12:45 Decorate const arguments. * src/base/ftglyph.c (FT_Glyph_Transform, FT_Glyph_To_Bitmap): Do it. * include/freetype/ftglyph.h (FT_Glyph_Transform, FT_Glyph_To_Bitmap): Do it.
Alexei Podtelezhnikov ffdac8d6 2021-08-19T20:41:55 Determine `long long` availability based on its size. MSVC, for example, used `long long` even without full C99 support. * include/freetype/config/ftstdlib.h: Check if `long long` limits are defined in <limits.h>. * include/freetype/config/integer-types.h: Check `long long` size and use it to typedef FT_Int64.
Alexei Podtelezhnikov 02ba0fc8 2021-08-18T23:27:48 Readily use `long long` as a 64-bit type in C99 mode. * include/freetype/config/integer-types.h (FT_INT64): FT_CONFIG_OPTION_FORCE_INT64 is no longer required to use `long long`.
Alexei Podtelezhnikov 85703839 2021-08-18T23:05:51 Use FT_INT64 instead of FT_LONG64. * 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.
Werner Lemberg f11f3ed1 2021-08-18T06:54:34 [base] Fix ppem size overflow. 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.
Dominik Röttsches e40ae756 2021-08-09T13:44:55 [sfnt] Add missing blend mode 'plus' to 'COLR' v1. * include/freetype/ftcolor.h (FT_Composite_Mode): Add missing blend mode 'plus' after it was added to the spec.
Werner Lemberg 2c853b38 2021-08-08T00:22:34 include/freetype/freetype.h (FT_Encoding): Improve documentation. Based on a suggestion by Antony Lee <anntzer.lee@gmail.com>.
Dominik Röttsches 47cf8ebf 2021-07-28T17:36:57 [sfnt] Add API for retrieving a 'COLR' v1 'ClipBox' table. 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.
Dominik Röttsches 30a82e1e 2021-07-26T18:28:56 [sfnt] 'COLR' v1 PaintSweepGradient spec update * 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.
Dominik Röttsches 66189807 2021-07-26T17:32:22 [sfnt] 'COLR' v1 PaintSkew related spec updates * 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.
Dominik Röttsches 48df0fa6 2021-07-23T19:02:51 [sfnt] PaintRotate/PaintRotateAroundCenter spec updates * 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.
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.
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.
Werner Lemberg 205d1ae4 2021-07-12T22:03:25 Small clean-ups for the last few commits. * include/freetype/fttrace.h (afwarp): Removed.
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).
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.
Werner Lemberg 90ecac41 2021-06-30T10:23:42 Update `CHANGES` file; other minor doc fixes.
Werner Lemberg e1b1b542 2021-06-29T06:07:00 ftcolor.h: Minor grammar fix.
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.
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 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 36ee7171 2021-06-08T09:00:39 [sdf] Formatting and improved comments.