summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Begin adding comments for documentationgsoc-anurag-2022-docsAnurag Thakur2022-09-111-0/+1
|
* [truetype] Reject 'fvar' loading when `num_instances` is too small.Dominik Röttsches2022-09-061-5/+16
| | | | | | | | | | * src/truetype/ttgxvar.c (TT_Get_MM_Var): Reject retrieving master when 'fvar' values locally do not match with sanitized values from initialization at `sfnt_init_face` time. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=1360295
* [sfnt] Handle variable `COLR` v1 fonts without delta set index mapDominik Röttsches2022-09-051-3/+2
| | | | | | | | Fixes #1178. * src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Set outer index to 0 and inner index to the delta index when retrieving deltas if the `COLR` table has no delta set index map.
* [sfnt] Pointer sanity checks before reading layer info in 'COLR' v0Dominik Röttsches2022-09-051-1/+3
| | | | | | | | | * src/sfnt/ttcolr.c (tt_face_get_colr_layer): Check that the pointer to read from is within the 'COLR' table. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50633
* [autofit] Minor fix.Werner Lemberg2022-09-051-1/+1
| | | | | * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Avoid compiler warning.
* [sfnt] Don't require 'gvar' table to support variation fonts.Dominik Röttsches2022-09-052-22/+10
| | | | | | | | | | | | | Fixes #1172. * src/sfnt/sfobjs.c (sfnt_load_face): Tag font as Multiple Masters font if `fvar` is present; do not require other tables to be present. * src/truetype/ttgxvar.c (tt_set_mm_blend): Allow for a missing 'gvar' table when setting variation coordinates. However, if a 'gvar' table is actually present, do perform a sanity check and fail on malformedness. (TT_Get_MM_Var): Don't assume 'fvar' needs 'gvar' or 'CFF2 tables in all cases, which is an overly tight check.
* * src/base/ftver.rc: Explicitly use UTF-16.Alexei Podtelezhnikov2022-08-261-3/+3
| | | | Fixes #1177 to avoid mistranslation and other problems.
* [sfnt] Avoid undefined shifts in `COLR` v1 color line retrievalDominik Röttsches2022-08-261-2/+2
| | | | | | | * src/sfnt/ttcolr.c (tt_face_get_colorline_stops): Disambiguate shift behavior by using multiplication using macros from ftcalc.h. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50573
* CMakeLists.txt (FT_ENABLE_ERROR_STRINGS): New configuration option.Sean Farrell2022-08-211-0/+10
| | | | | | | | This option uncomments FreeType configuration macro `FT_CONFIG_OPTION_ERROR_STRINGS` to make function `FT_Error_String` return meaningful error strings. This option is off by default.
* [base, type1] Better handling of out-of-memory situations.Chris Liddell2022-08-212-3/+6
| | | | | | | | | | | 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.
* ci: bump windows image and use newer runner and vs2019Tim-Philipp Müller2022-08-061-7/+7
| | | | The old 1809 runner will be decommissioned at some point.
* * src/cache/ftcmanag.c (FTC_Manager_New): Initialize `cur_weight`.@udoudou2022-08-031-0/+1
| | | | See !192.
* * src/sfnt/ttload.c: Trace formatting updates.Alexei Podtelezhnikov2022-08-021-13/+13
|
* * src/psaux/psobjs.c (ps_table_release): Remove redundant casting. Alexei Podtelezhnikov2022-08-021-1/+1
|
* * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Reduce casting.Alexei Podtelezhnikov2022-08-011-6/+6
|
* [cache] Remove some casts, clean up tracing.Alexei Podtelezhnikov2022-08-014-11/+11
| | | | | | | | | * src/cache/ftcbasic.c (FTC_ImageCache_Lookup, FTC_SBitCache_Lookup): Clean up tracing types. * src/cache/ftccache.c (ftc_node_destroy): Ditto. * src/cache/ftcmanag.c (FTC_Manager_Check): Ditto. (FTC_Manager_Check, FTC_Node_Unref): Remove a cast. * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto.
* [autofit] Updated to reduce casting (cont'd).Alexei Podtelezhnikov2022-08-013-16/+13
| | | | | | | * src/autofit/afmodule.h (AF_ModuleRec): Change `default_script` type. * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Remove casting. * src/autofit/afmodule.c (af_property_{set,get}): Updated accordingly.
* [autofit] Updated to reduce casting.Alexei Podtelezhnikov2022-08-013-20/+20
| | | | | | | | * src/autofit/afglobal.h (AF_FaceGlobalsRec): Change `glyph_count` type. * src/autofit/afglobal.c (af_face_globals_compute_style_coverage, af_face_globals_get_metrics, af_face_globals_is_digit, af_face_globals_new): Changed local types and updated accordingly. * src/autofit/aflatin.c (af_latin_metrics_init_blues): Ditto.
* [psaux] Remove unused structure field.Alexei Podtelezhnikov2022-07-312-5/+0
| | | | | * include/freetype/internal/psaux.h (PS_TableRec): Remove `num_elems`. * src/psaux/psobjs.c (ps_table_new): Remoove its initialization.
* [sfnt] Implement VarClipBox.Dominik Röttsches2022-07-301-2/+30
| | | | | * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Depending on the format, read `var_index_base`, then retrieve and apply scaled deltas.
* [sfnt] Fix typo in clip box computation.Dominik Röttsches2022-07-301-2/+3
| | | | | * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Use appropriate scale factor for `yMin` and `yMax`.
* [autofit] Use unsigned accounting for hints.Alexei Podtelezhnikov2022-07-294-16/+16
| | | | | | | | | | * src/autofit/afhints.h (AF_AxisHintsRec): Use unsigned types. * src/autofit/afhints.c (af_axis_hints_new_{segment,edge}, af_glyph_hints_get_num_segments, af_glyph_hints_get_segment_offset): Updated accordingly. * src/autofit/aflatin.c (af_cjk_hints_compute_edges): Ditto. * src/autofit/afcjk.c (af_cjk_hints_compute_edges): Ditto.
* * src/autofit/afhints.h: Remove dead code.Alexei Podtelezhnikov2022-07-291-5/+0
|
* * src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error.Werner Lemberg2022-07-292-3/+6
|
* Fix compilation if `TT_CONFIG_OPTION_GX_VAR_SUPPORT` is not set.Werner Lemberg2022-07-291-14/+32
| | | | | * src/sfnt/ttcolr.c: Protect relevant code with `TT_CONFIG_OPTION_GX_VAR_SUPPORT`.
* Fix clang14 compiler warnings.Werner Lemberg2022-07-292-7/+4
| | | | | | | | | * 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`.
* [pfr] Fortify the kerning code.Alexei Podtelezhnikov2022-07-261-8/+7
| | | | | | | | | | | | Any array index must be strictly less then the array size. Therefore, we must reject indexes that are equal to the array size. Alternatively, we should move the bounds check before the index decrement but that would be confusing. In addition, it is ok to decrement zero (.notdef) and get UINT_MAX, which is then automatically rejected in the bounds check. * src/pfr/pfrobjs.c (pfr_face_get_kerning): Fix the bounds checking.
* [pfr] Add some safety guards.Werner Lemberg2022-07-261-0/+15
| | | | | | | * src/pfr/pfrload.c (pfr_phy_font_load): Check resolutions and number of characters. Fixes #1174.
* * src/pfr/*.c: Trivial improvements and formatting.Werner Lemberg2022-07-264-21/+14
|
* * configure: s/egrep/grep -E/Werner Lemberg2022-07-241-2/+2
| | | | `egrep` is deprecated.
* [base] Build outlines in amortized constant time.Ben Wagner2022-07-231-5/+15
| | | | | | | | | | | | | | | 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.
* [sfnt] Support variable 'COLR' v1 `PaintVarSkew*`.Dominik Röttsches2022-07-091-4/+49
| | | | | | | | * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW`, `FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER`, and `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER`. (read_paint): Handle new enumeration values.
* [sfnt] Support variable 'COLR' v1 `PaintVarRotate*`.Dominik Röttsches2022-07-091-3/+47
| | | | | | | * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values `FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE` and `FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER`. (read_paint): Handle new enumeration values.
* [sfnt] Support 'COLR' v1 variable `PaintVarScale*`.Dominik Röttsches2022-07-091-24/+95
| | | | | | | | | * src/sfnt/ttcolr.c: (FT_PaintFormatInternal): New enumeration values `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE`, `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER`, `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM`, and `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER`. (read_paint): Handle new enumeration values.
* [sfnt] Support for 'COLR' v1 variable translate.Dominik Röttsches2022-07-091-1/+22
| | | | | | * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value `FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE`. (read_paint): Handle new enumeration value.
* [sfnt] Support for 'COLR' v1 variable transforms.Dominik Röttsches2022-07-091-1/+26
| | | | | | * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value `FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM`. (read_paint): Handle new enumeration value.
* [sfnt] Deltas for 'COLR' v1 gradient coordinates.Dominik Röttsches2022-07-091-0/+59
| | | | | | * src/sfnt/ttcolr.c (read_paint) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Read and apply deltas to radial, linear, and sweep gradient coordinates such as 'p0', 'p1', 'p2', 'center', 'radii', and 'angles'.
* [sfnt] Support variable 'COLR' v1 color lines.Dominik Röttsches2022-07-082-11/+66
| | | | | | | | | | | | * 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.
* [sfnt] Apply variation deltas to `PaintVarSolid`.Dominik Röttsches2022-07-071-5/+92
| | | | | | | | | | | | * src/sfnt/ttcolr.c (FT_PaintFormat_Internal_): New enumeration `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`. (get_deltas_for_var_index_base) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function to retrieve an array of delta values, which will be used for most of 'COLR' v1 variation formats (in follow-up commits). (read_paint): Add `face` parameter; update caller. Handle `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`.
* [sfnt] Check safety of cast to `TT_Driver` before accessing member.Dominik Röttsches2022-07-071-4/+8
| | | | | * src/sfnt/ttcolr.c (VARIABLE_COLRV1_ENABLED): Access `enable_variable_colrv1` only if driver class matches.
* doc: Clarify description of `FT_Stream_IoFunc`.Stephen Holdaway2022-07-061-3/+9
| | | | | | | | | | 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).
* [sfnt] Load variation store for 'COLR' v1.Dominik Röttsches2022-07-041-0/+100
| | | | | | | | | | * src/sfnt/ttcolr.c: Include `ttobjs.h` temporarily. (VARIABLE_COLRV1_ENABLED): New temporary macro to detect whether variable COLRv1 is enabled. (Colr): New fields `var_store` and `delta_set_idx_map`. (tt_face_load_colr, tt_face_free_colr) [VARIABLE_COLRV1_ENABLED]: Load and free variation store data using the functions from the Multiple Masters service.
* [base] Improve error handling in `FT_GlyphLoader_CheckPoints`.Chris Liddell2022-07-031-4/+10
| | | | | | | | | | 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`.
* CMakeLists.txt: Provide both 'freetype' and 'Freetype::Freetype' targets.Thomas Sondergaard2022-07-031-1/+8
| | | | | | | | | | | | | | FreeType can be located by consuming projects that use `find_package(Freetype)` either via the old `MODULE` path (which uses `FindFreetype.cmake` supplied by CMake), or via the new `CONFIG` path (which uses `freetype-config.cmake` as supplied by this project). Up to this point the CMake module has supplied the target `Freetype::Freetype` and the config file provided by this project the target `freetype`. Now we supply both `freetype` and `Freetype::Freetype` so that consuming projects can always use the target `Freetype::Freetype` regardless of what path was taken by `find_package(Freetype)`. Fixes #1165.
* include/freetype/ftmm.h: Improve documentation.Werner Lemberg2022-07-021-4/+13
|
* [base] Round values in `FT_MulAdd_Fix`.Dominik Röttsches2022-07-011-4/+11
| | | | | | | | | | | 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.
* Minor formatting.Werner Lemberg2022-07-013-3/+6
|
* Fix initialisation of temp variable in new FT_MulAddFixDominik Röttsches2022-06-301-1/+1
| | | | src/truetype/ttgxvar.c (FT_MulAddFix): Initialise `temp`.
* [truetype] Perform variation store delta computation with 64-bit precision.Dominik Röttsches2022-06-294-15/+37
| | | | | | | | | | | | * 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`.
* New function `FT_MulAddFix` to compute the sum of fixed-point products.Dominik Röttsches2022-06-292-0/+94
| | | | | | | | 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.