summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* 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-182-10/+3
| | | | | | | | * 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.
* [base] Fix ppem size overflow.Werner Lemberg2021-08-181-1/+1
| | | | | | | | | | | | | | 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.
* [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>.
* [sfnt] Add API for retrieving a 'COLR' v1 'ClipBox' table.Dominik Röttsches2021-08-072-11/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [sfnt] 'COLR' v1 PaintSweepGradient spec updateDominik Röttsches2021-07-291-6/+8
| | | | | | | | * 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] 'COLR' v1 PaintSkew related spec updatesDominik Röttsches2021-07-291-2/+4
| | | | | | | * 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-291-1/+3
| | | | | | | | * 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.
* * Version 2.11.0 released.VER-2-11-0Werner Lemberg2021-07-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | ========================== 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.
* Support architectures where `long` is smaller than pointers.Alex Richardson2021-07-151-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-131-2/+4
| | | | | | | | | | | | | | | | | | | | 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-131-7/+7
|
* Small clean-ups for the last few commits.Werner Lemberg2021-07-124-15/+12
| | | | * include/freetype/fttrace.h (afwarp): Removed.
* Remove experimental auto-hinting 'warp' mode.David Turner2021-07-122-52/+4
| | | | | | | 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.
* Remove experimental "Latin2" writing system (FT_OPTION_AUTOFIT2)David Turner2021-07-121-1/+0
| | | | | | 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).
* [sfnt] Support PaintScale in 'COLR' v1 parsing.Dominik Röttsches2021-07-011-10/+68
| | | | | | | | | | * 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.
* Update `CHANGES` file; other minor doc fixes.Werner Lemberg2021-06-302-6/+7
|
* ftcolor.h: Minor grammar fix.Werner Lemberg2021-06-291-27/+27
|
* [base] Add trace level to logging output.Werner Lemberg2021-06-252-3/+9
| | | | | | | | | | | | | | | | | | | | | | | 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.
* fterrors.h: Fix documentation extraction of `FT_Error_String`.Werner Lemberg2021-06-231-0/+2
|
* [sfnt] s/PaintTransformed/PaintTransform/, s/transformed/transform/.Dominik Röttsches2021-06-221-9/+9
| | | | | | | | * 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.
* Move 'COLR' API to `ftcolor.h`.Dominik Röttsches2021-06-222-1238/+1238
| | | | | | | * 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.
* freetype.h: Mark 'COLR' v1 API as experimental.Werner Lemberg2021-06-201-27/+54
|
* More various documentation improvements and fixes.Werner Lemberg2021-06-082-1/+23
|
* Various documentation improvements and fixes.Werner Lemberg2021-06-081-7/+125
|
* [sdf] Formatting and improved comments.Werner Lemberg2021-06-081-14/+16
|
* [sdf] Use 8 bits for final SDF output instead of 16bits.Anuj Verma2021-06-083-24/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 8-bits is enough to represent SDF data we no longer require 16-bits for this purpose. Also, we now normalize the output data to use the entire 8-bit range efficiently. For example: if we use 3.5 format with a spread of 1 we basically only use the starting 5-bits. By normalizing we can use the entire 8-bit range. * include/freetype/freetype.h (FT_Render_Mode): Updated description for `FT_RENDER_MODE_SDF` regarding this change. * include/freetype/ftimage.h (FT_Pixel_Mode): Removed `FT_PIXEL_MODE_GRAY16` since no longer required. * include/freetype/fttypes.h (FT_F6Dot10): Removed since no longer required. * src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Allocate 8-bit bitmap instead of 16-bit buffer. * src/sdf/ftsdfcommon.h (map_fixed_to_sdf): Added function to convert 16.16 distance value to our desired format. * src/sdf/ftsdf.c (sdf_generate_with_overlaps, sdf_generate_bounding_box): Use the new `map_fixed_to_sdf` function and also use 8-bit output buffer. * src/sdf/ftbsdf.c (finalize_sdf): Output to a 8-bit buffer instead of 16-bit buffer.
* [psaux] Guard and trace AFM kern data allocation.Werner Lemberg2021-05-251-0/+1
| | | | | | | | | | | | | | | Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31543 * include/freetype/internal/fttrace.h: Add 'afmparse' trace component. * src/psaux/afmparse.c (FT_COMPONENT): Define. (afm_parse_track_kern, afm_parse_kern_pairs): Protect against allocations bombs. Add tracing. (afm_parse_kern_data): Don't allow multiple kern data sections.
* Prioritize the anti-aliasing renderer module.Alexei Podtelezhnikov2021-05-181-2/+2
| | | | | * modules.cfg: Reorder the renderers. * include/freetype/config/ftmodule.h: Ditto.
* Typo.Alexei Podtelezhnikov2021-04-181-2/+2
|
* freetype.h: Documentation typos.Werner Lemberg2021-02-271-5/+5
|
* [sfnt] Update paint format values to support non-variable paints.Dominik Röttsches2021-02-161-12/+19
| | | | | | | | | | * freetype.h (FT_PaintFormat): Update paint format identifiers after a specification change. The specification was updated to have sibling formats, variable and non-variable variants for each. Reflect that here. * sfnt/ttcolr.c (read_paint): Remove parsing of variable indices as the non-variable formats no longer have them.
* Add new function `FT_Get_Transform`.Werner Lemberg2021-02-131-1/+32
| | | | | | | | | | | See https://github.com/harfbuzz/harfbuzz/issues/2428 for some reasons to introduce this function. * include/freetype/freetype.h, src/base/ftobjs.c (FT_Get_Transform): Implement it.
* Minor editing of last commit; formatting.Werner Lemberg2021-02-131-64/+67
|
* Decorate qsort callbacks with cdecl.Alexei Podtelezhnikov2021-02-121-1/+10
| | | | | | | | | | | * include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF): Add new macro. * src/base/ftrfork.c, src/bdf/bdflib.c, src/gxvalid/gxvcommn.c, src/psaux/afmparse.c, src/psnames/psmodule.c, src/type1/t1afm.c, src/sfnt/sfwoff.c, src/sfnt/sfwoff2.c: Update qsort callbacks. Fixes #1026 when compiling FreeType with an unusual calling convention while the C library qsort still expects cdecl.
* [sfnt] Implement 'COLR' v1 sweep gradients.Dominik Röttsches2021-02-111-9/+53
| | | | | | | | | | * freetype.h (FT_PaintSweepGradient): Add `FT_PaintSweepGradient` to represent a 'COLR' v1 sweep gradient. Update format. (FT_PaintFormat): Update shifted paint formats. Sync with spec. * sfnt/ttcolr.c (read_paint): Logic to parse sweep gradients. Fix struct access in radial gradient implementation.
* [sfnt] Provide optional root transform for 'COLR' v1 glyph graph.Dominik Röttsches2021-02-102-7/+82
| | | | | | | | | | | | | | | | * include/freetype/freetype.h (FT_Get_Color_Glyph_Paint): Additional function argument root_transform to control whether root transform should be returned. (FT_OpaquePaint): Additional tracking field to denote whether root transform is to be returned. * include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_Paint_Func): Propagate additional argument. * src/base/ftobjs.c (FT_Get_Color_Glyph_Paint): Ditto. * src/sfnt/ttcolr.c (tt_face_get_colr_glyph_paint): Return root transform reflecting the size and tranform configured on FT_Face. (read_paint): Initialize and track status of insert_root_transform flag.
* Always provide logging API.Werner Lemberg2021-01-311-8/+8
| | | | | | | | | | | | It's easier to have stubs if FT_DEBUG_LOGGING is undefined than to modify `ftexport.sym` conditionally. Problem reported by Alexei. * src/base/ftdebug.c: Include `ftlogging.h`. (FT_Trace_Set_Level, FT_Trace_Set_Default_Level, FT_Set_Log_Handler, FT_Set_Default_Log_Handler) [!FT_DEBUG_LOGGING]: Provide stubs.
* Minor documentation fixes.Werner Lemberg2021-01-231-6/+2
|
* Update all copyright notices.Werner Lemberg2021-01-1794-94/+94
|
* Add config option to test for 'COLR' v1 support in headers.Dominik Röttsches2021-01-141-0/+15
| | | | | | | | | * include/freetype/config/ftoption.h (TT_SUPPORT_COLRV1): New macro so that clients can test whether the FreeType checkout that they are building against supports the 'COLR' v1 API. This is intended to be a temporary solution until 'COLR' v1 support is released in a FreeType version and such a check can be made by using the version number instead.
* [sfnt] Register 'COLR' v1 API in driver (#59703).Dominik Röttsches2021-01-141-36/+173
| | | | | | | | | | | * include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_Paint_Func, TT_Get_Paint_Layers_Func, TT_Get_Colorline_Stops_Func, TT_Get_Paint_Func): New function pointer types. (SFNT_Interface): Add them. (FT_DEFINE_SFNT_INTERFACE): Updated. * src/sfnt/sfdriver.c (PUT_COLOR_LAYERS_V1): New macro. (sfnt_interface): Add new function pointers.
* Add new methods required for 'COLR' v1 to public API (#59703).Dominik Röttsches2021-01-141-0/+159
| | | | | | | | | | | | * include/freetype/freetype.h (FT_Get_Color_Glyph_Paint): New method for retrieving the root paint object for a color glyph by specifying a glyph ID. (FT_Get_Paint_Layers): New method for retrieving the layers of a `PaintColorGlyph`. (FT_Get_ColorLine_Stops): New method for retrieving the stops of a color. (FT_Get_Paint): New method for resolving an `FT_OpaquePaint` into an `FT_COLR_Paint` object.
* Add types required for 'COLR' v1 to public API (#59703).Dominik Röttsches2021-01-141-1/+661
| | | | | | | | | | | | | | * include/freetype/freetype.h (FT_PaintFormat, FT_ColorStopIterator, FT_ColorIndex, FT_ColorStop, FT_PaintExtend, FT_ColorLine, FT_Affine23, FT_CompositeMode, FT_OpaquePaint, FT_PaintColrLayers, FT_PaintSolid, FT_PaintLinearGradient, FT_PaintRadialGradient, FT_PaintGlyph, FT_PaintColrGlyph, FT_PaintTransformed, FT_PaintTranslate, FT_PaintRotate, FT_PaintSkew, FT_PaintComposite, FT_COLR_Paint): Adding structs and enum to represent paint format, color stop information, gradient extend information, structs to reference paint offsets, and to define transforms and compositions. Adding a union type to represent the union of the structs, distinguished by `FT_PaintFormat`.
* Fix ABI incompatibility.Werner Lemberg2021-01-071-1/+1
| | | | | | | * include/freetype/ftimage.h (FT_Pixel_Mode): Don't insert `FT_PIXEL_MODE_GRAY16' but append it. * src/base/ftobjs.c (pixel_modes): Updated.
* [dlg] Move the headers to include/dlg to simplify their use.Alexei Podtelezhnikov2021-01-071-2/+2
| | | | | | | | * autogen.sh, builds/toplevel.mk: Copy headers to incluide/dlg. * builds/freetype.mk, builds/windows/vc2010/freetype.vcxproj: Simplify included path. * include/freetype/internal/ftdebug.h: Simplify #include. * src/dlg/rules.mk, .gitignore: Updated.
* Typo.Werner Lemberg2020-12-261-1/+1
|
* * src/base/ftobjs.c (pixel_modes): Updated.Werner Lemberg2020-12-261-0/+5
|