summaryrefslogtreecommitdiff
path: root/src/sfnt
Commit message (Collapse)AuthorAgeFilesLines
* Minor changes.Werner Lemberg2023-01-281-19/+19
| | | | Comment fixes, typos, removing of unnecessary parentheses.
* Whitespace.Werner Lemberg2023-01-281-39/+40
|
* [sfnt] Avoid nullptr dereference in reading malformed 'COLR' v1 table.Dominik Röttsches2023-01-181-1/+1
| | | | | | | Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1408044. * src/sfnt/ttcolr.c (tt_face_load_colr): When the 'COLR' v1 table header is too small, don't deallocate delta set index map structures.
* Update all copyright notices.Werner Lemberg2023-01-1737-37/+37
|
* sr/*.c: Various minor fixes.Werner Lemberg2023-01-162-2/+3
| | | | | | | | | | | | | | | | * src/autofit/ft-hb.c (_hb_ft_reference_table): Call `FT_UNUSED` after variable declarations. * src/gxvalid/gxvjust.c (gxv_just_widthDeltaClusters_validate): Eliminate unused variable. * src/gzip/ftgzip.c: Don't call GCC '-Wstrict-prototypes' pragma for C++ compiler. * src/sfnt/ttcolr.c (ENSURE_READ_BYTES): Remove final semicolon to avoid compiler warning. * src/sfnt/ttsvg.c (tt_face_load_svg_doc): Fix signedness warning.
* [sfnt] Remove temporary runtime flag for variable 'COLR' v1.Dominik Röttsches2023-01-161-39/+11
| | | | | | | | | | | | | | | Fixes #1187. * src/sfnt/ttcolr.c (top level, read_paint, tt_face_load_colr, tt_face_free_colr, get_deltas_for_var_index_base, tt_face_get_color_glyph_clipbox, tt_face_get_colorline_stops): Remove macro definition `VARIABLE_COLRV1_ENABLED` and its usage. * src/truetype/ttdriver.c (tt_property_set): Remove parsing of 'TEMPORARY-enable-variable-colrv1' property name. * src/truetype/ttobjs.h (TT_DriverRec): Remove `enable_variable_colrv1` flag.
* [sfnt] Fix color stop bounds check calculation at table end.Dominik Röttsches2023-01-051-7/+17
| | | | | | | | Fixes https://bugs.chromium.org/p/skia/issues/detail?id=14021 * src/sfnt/ttcolr.c (VAR_IDX_BASE_SIZE): New macro. (tt_face_get_colorline_stops): Fix off-by-one bounds check calculation, take `VarColorStop` into account, and hopefully make it easier to read.
* [sdf, sfnt] Handle minor compiler warnings.Werner Lemberg2022-12-131-1/+1
| | | | | | | | * src/sdf/ftsdf.c (get_min_distance_conic): Initialize `nearest_point`. * src/sfnt/ttsvg.c (find_doc): Initialize `mid_doc`. Fixes #1195.
* [sfnt] Additional bounds checks for `COLR` v1 table handling.Dominik Röttsches2022-10-181-11/+18
| | | | | | | | | | | * src/sfnt/ttcolr.c (read_paint): Add `colr` argument, necessary for... ... another use of `ENSURE_READ_BYTES`. Update callers. (tt_face_get_paint_layers): Ensure that the 4-byte paint table offset can be read. This is a follow-up to !124 and issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404
* * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Simplify calculations.Alexei Podtelezhnikov2022-10-181-21/+12
|
* [sfnt] Guard individual `COLR` v1 paint field reads.Dominik Röttsches2022-10-181-2/+38
| | | | | | | | | | | * src/sfnt/ttcolr.c (ENSURE_READ_BYTES): New macro. (read_paint): Use it – after the start pointer `p` has been checked for whether it allows reading the format byte, each successive paint table field read need to be bounds-checked before reading further values. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404
* Minor comment changes.Werner Lemberg2022-10-101-2/+2
|
* * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Use lighter FT_DivFix.Alexei Podtelezhnikov2022-09-291-4/+2
|
* [sfnt] Guard access in 'COLR' table when requesting child table pointer.Dominik Röttsches2022-09-271-5/+13
| | | | | | | | | | | * src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Tighten pointer bounds checks. (get_child_table_pointer): Check whether incoming pointer `p` lies within the 'COLR' table. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51816
* [sfnt] Add SVG document bounds checking.Ben Wagner2022-09-271-36/+45
| | | | | | | | | | | | | | | | | Add a check that the document content is actually contained within the `SVG ` table. Without this check a malformed font may claim arbitrary memory as its document content. * src/sfnt/ttsvg.c (tt_face_load_svg): Take `numEntries` into account when testing 'documentRecord' extents. (find_doc): Rename `stream` to `document_records` for clarity. (tt_face_load_svg_doc): Split `doc` from `doc_list` pointer for clarity. Test that the document content is contained within the table. Ensure minimum length of document before testing for gzip format. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51812
* Reject 'COLR' table if version is 1 but header too small.Dominik Röttsches2022-09-161-3/+13
| | | | | | | | | * src/sfnt/ttcolr.c (tt_face_load_colr): If the version is determined to be 1, then the table size has to be at least the size of the v1 header. Also, for peeking the number of base glyphs and entries in the layer list, ensure that the table is sufficiently long. Fixes #1179. Original patch by Sergey Temnikov.
* [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
* [sfnt] Don't require 'gvar' table to support variation fonts.Dominik Röttsches2022-09-051-7/+1
| | | | | | | | | | | | | 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.
* [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
* * src/sfnt/ttload.c: Trace formatting updates.Alexei Podtelezhnikov2022-08-021-13/+13
|
* [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`.
* 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-291-5/+2
| | | | | | | | | * 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`.
* [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-081-8/+56
| | | | | | | | | | | | * 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.
* [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.
* [sfnt] Upgrade stop_offset to FT_Fixed from FT_F2Dot14Dominik Röttsches2022-06-221-1/+1
|
* s/fixed point/fixed-point/Werner Lemberg2022-06-211-3/+3
|
* [woff] Don't allocate table entries until neededBen Wagner2022-06-131-5/+2
| | | | | * src/sfnt/sfwoff.c (woff_open_font): delay allocating space for the table entries until they are actually written out with the data.
* * src/sfnt/sfwoff2.c (woff2_open_font): Partial revert.Alexei Podtelezhnikov2022-06-121-1/+2
| | | | Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47981.
* [woff, woff2] Avoid buffer zeroing.Alexei Podtelezhnikov2022-06-112-41/+35
| | | | | | * src/sfnt/sfwoff.c (woff_open_font): Use Q-macros. * src/sfnt/sfwoff2.c: Ditto. (reconstruct_font): Allocate table_entry on stack.
* * src/sfnt/ttmtx.c (tt_face_get_metrics): Apply variations unconditionally.Behdad Esfahbod (بهداد اسفهبد)2022-05-251-1/+1
| | | | This causes a speed-up of approx. 20% for getting advance widths.
* * src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_COLOR` for SVG fonts.Werner Lemberg2022-04-301-1/+2
| | | | Fixes #1151.
* * src/sfnt/sfwoff.c (reconstruct_glyf): Fix gcc 10 warning.Werner Lemberg2022-04-011-1/+1
|
* Whitespace.Werner Lemberg2022-04-013-5/+5
|
* Fix clang++ warnings.Werner Lemberg2022-03-311-1/+1
| | | | | | | | | | | | | * src/base/ftglyph.c (ft_svg_glyph_prepare), src/base/ftobj.c (ft_glyphslot_init), src/cache/ftccmap.c (ftc_cmap_node_new), src/cache/ftcimage.c (FTC_INode_New), src/lzw/ftlzw.c (FT_Stream_OpenLZW), src/psaux/psobjs.c (ps_parser_load_field), src/pshinter/pshglob.c (psh_globals_new), src/sfnt/ttsvg.c (tt_face_load_svg_doc): Initialize variables used for allocation. * src/sdf/ftsdf.c (split_sdf_conic, split_sdf_cubic): Change type of `max_splits` to FT_UInt. (sdf_generate_bounding_box): Add cast.
* Add `FT_FACE_FLAG_SBIX_OVERLAY` and `FT_HAS_SBIX_OVERLAY`.Werner Lemberg2022-03-251-10/+1
| | | | | | | | * 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.
* Add `FT_PARAM_TAG_IGNORE_SBIX`.Werner Lemberg2022-03-251-17/+35
| | | | | | | | | | | | | 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.
* [truetype] Fix 'sbix' table handling.Werner Lemberg2022-03-252-13/+27
| | | | | | | | | | | | | | | | | * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Correct calculation of 'metrics->horiBearingY'. Set vertical metrics. * src/sfnt/sfobjs.c (sfnt_load_face): Adjust setting of `FT_FACE_FLAG_SBIX`. Handle metrics of fonts with 'sbix' table. * src/truetype/ttgload.c (TT_Load_Glyph): For 'sbix' embedded bitmaps, apply bbox offset and bearing values of the corresponding glyph in the 'glyf' table if it exists and has a contour. * src/truetype/ttobjs.c (tt_face_init): Handle font with 'sbix' table. Fixes issue #998.
* Add `FT_FACE_FLAG_SBIX` and `FT_HAS_SBIX`.Werner Lemberg2022-03-251-0/+5
| | | | | | | | | 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.
* * src/sfnt/ttkern.c (tt_face_get_kerning): Exit early if no table.Werner Lemberg2022-03-211-2/+8
| | | | Fixes #1141.