Update Android port

* src/sfnt.c (sfnt_table_names): Add fvar, gvar, cvar.
(sfnt_read_maxp_table): Call xmalloc, not malloc.
(sfnt_read_simple_glyph): Avoid use-after-free if simple is
invalid.
(sfnt_fill_span): Fix max coverage.
(sfnt_normalize_vector): Fail if magnitude is zero.
(sfnt_measure_distance): Fix opcode order.
(sfnt_dot_fix_14): Fix implementation.
(struct sfnt_variation_axis, struct sfnt_instance)
(struct sfnt_fvar_table, struct sfnt_gvar_table)
(sfnt_read_fvar_table, sfnt_read_gvar_table, struct sfnt_blend)
(sfnt_init_blend, sfnt_free_blend, sfnt_normalize_blend)
(struct sfnt_tuple_header, struct sfnt_gvar_glyph_header)
(sfnt_read_packed_points, sfnt_read_packed_deltas)
(sfnt_compute_tuple_scale, sfnt_infer_deltas_1, sfnt_infer_deltas)
(sfnt_vary_glyph): Add WIP variation glyph implementation.
* src/sfnt.h (enum sfnt_table, struct sfnt_simple_glyph):
Likewise.
This commit is contained in:
Po Lu 2023-03-24 10:43:34 +08:00
parent b26b4c537b
commit b78ef9bcd1
2 changed files with 1795 additions and 38 deletions

1809
src/sfnt.c

File diff suppressed because it is too large Load diff

View file

@ -53,6 +53,9 @@ enum sfnt_table
SFNT_TABLE_CVT ,
SFNT_TABLE_FPGM,
SFNT_TABLE_PREP,
SFNT_TABLE_FVAR,
SFNT_TABLE_GVAR,
SFNT_TABLE_CVAR,
};
#define SFNT_ENDOF(type, field, type1) \
@ -61,7 +64,14 @@ enum sfnt_table
/* Each of these structures must be aligned so that no compiler will
ever generate padding bytes on platforms where the alignment
requirements for uint32_t and uint16_t are no larger than 4 and 2
bytes respectively. */
bytes respectively.
Pointer types are assumed to impose an alignmnent requirement no
less than that of uint32_t.
If a table has more than one kind of variable-length subtable array
at the end, make sure to pad subsequent subtables
appropriately. */
struct sfnt_offset_subtable
{
@ -568,25 +578,25 @@ struct sfnt_simple_glyph
size_t number_of_points;
/* Array containing the last points of each contour. */
uint16_t *end_pts_of_contours;
uint16_t *restrict end_pts_of_contours;
/* Total number of bytes needed for instructions. */
uint16_t instruction_length;
/* Instruction data. */
uint8_t *instructions;
uint8_t *restrict instructions;
/* Array of flags. */
uint8_t *flags;
uint8_t *restrict flags;
/* Array of X coordinates. */
int16_t *x_coordinates;
int16_t *restrict x_coordinates;
/* Array of Y coordinates. */
int16_t *y_coordinates;
int16_t *restrict y_coordinates;
/* Pointer to the end of that array. */
int16_t *y_coordinates_end;
int16_t *restrict y_coordinates_end;
};
struct sfnt_compound_glyph_component