[ot-glyph] remove open callback

Apparently it wasn't requested actually and can be detected easily
as paths are opened usually when move command is issued anyway.
This commit is contained in:
Ebrahim Byagowi 2020-01-23 15:12:12 +03:30
parent 684ff3e0cd
commit 02f324c949
9 changed files with 11 additions and 38 deletions

View File

@ -528,7 +528,6 @@ hb_ot_glyph_decompose_conic_to_func_t
hb_ot_glyph_decompose_cubic_to_func_t hb_ot_glyph_decompose_cubic_to_func_t
hb_ot_glyph_decompose_line_to_func_t hb_ot_glyph_decompose_line_to_func_t
hb_ot_glyph_decompose_move_to_func_t hb_ot_glyph_decompose_move_to_func_t
hb_ot_glyph_decompose_open_path_func_t
hb_ot_glyph_decompose hb_ot_glyph_decompose
hb_ot_glyph_decompose_funcs_create hb_ot_glyph_decompose_funcs_create
hb_ot_glyph_decompose_funcs_destroy hb_ot_glyph_decompose_funcs_destroy
@ -538,7 +537,6 @@ hb_ot_glyph_decompose_funcs_set_conic_to_func
hb_ot_glyph_decompose_funcs_set_cubic_to_func hb_ot_glyph_decompose_funcs_set_cubic_to_func
hb_ot_glyph_decompose_funcs_set_line_to_func hb_ot_glyph_decompose_funcs_set_line_to_func
hb_ot_glyph_decompose_funcs_set_move_to_func hb_ot_glyph_decompose_funcs_set_move_to_func
hb_ot_glyph_decompose_funcs_set_open_path_func
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -358,7 +358,7 @@ struct cff1_path_param_t
} }
~cff1_path_param_t () { end_path (); } ~cff1_path_param_t () { end_path (); }
void start_path () { funcs->open_path (user_data); path_open = true; } void start_path () { path_open = true; }
void end_path () { if (path_open) funcs->close_path (user_data); path_open = false; } void end_path () { if (path_open) funcs->close_path (user_data); path_open = false; }
bool is_path_open () const { return path_open; } bool is_path_open () const { return path_open; }

View File

@ -154,7 +154,7 @@ struct cff2_path_param_t
} }
~cff2_path_param_t () { end_path (); } ~cff2_path_param_t () { end_path (); }
void start_path () { funcs->open_path (user_data); path_open = true; } void start_path () { path_open = true; }
void end_path () { if (path_open) funcs->close_path (user_data); path_open = false; } void end_path () { if (path_open) funcs->close_path (user_data); path_open = false; }
bool is_path_open () const { return path_open; } bool is_path_open () const { return path_open; }

View File

@ -1059,7 +1059,6 @@ struct glyf
/* Learnt from https://github.com/opentypejs/opentype.js/blob/4e0bb99/src/tables/glyf.js#L222 */ /* Learnt from https://github.com/opentypejs/opentype.js/blob/4e0bb99/src/tables/glyf.js#L222 */
while (contour_start < points.length) while (contour_start < points.length)
{ {
funcs->open_path (user_data);
unsigned contour_length = 0; unsigned contour_length = 0;
for (unsigned i = contour_start; i < points.length; ++i) for (unsigned i = contour_start; i < points.length; ++i)
{ {

View File

@ -100,23 +100,6 @@ hb_ot_glyph_decompose_funcs_set_cubic_to_func (hb_ot_glyph_decompose_funcs_t
funcs->cubic_to = cubic_to; funcs->cubic_to = cubic_to;
} }
/**
* hb_ot_glyph_decompose_funcs_set_open_path_func:
* @funcs: decompose functions object
* @open_path: open-path callback
*
* Sets open-path callback to the decompose functions object.
*
* Since: REPLACEME
**/
void
hb_ot_glyph_decompose_funcs_set_open_path_func (hb_ot_glyph_decompose_funcs_t *funcs,
hb_ot_glyph_decompose_open_path_func_t open_path)
{
if (unlikely (funcs == &Null (hb_ot_glyph_decompose_funcs_t))) return;
funcs->open_path = open_path;
}
/** /**
* hb_ot_glyph_decompose_funcs_set_close_path_func: * hb_ot_glyph_decompose_funcs_set_close_path_func:
* @funcs: decompose functions object * @funcs: decompose functions object
@ -135,7 +118,10 @@ hb_ot_glyph_decompose_funcs_set_close_path_func (hb_ot_glyph_decompose_funcs_t
} }
static void static void
_move_line_to_nil (hb_position_t to_x HB_UNUSED, hb_position_t to_y HB_UNUSED, void *user_data HB_UNUSED) {} _move_to_nil (hb_position_t to_x HB_UNUSED, hb_position_t to_y HB_UNUSED, void *user_data HB_UNUSED) {}
static void
_line_to_nil (hb_position_t to_x HB_UNUSED, hb_position_t to_y HB_UNUSED, void *user_data HB_UNUSED) {}
static void static void
_conic_to_nil (hb_position_t control_x HB_UNUSED, hb_position_t control_y HB_UNUSED, _conic_to_nil (hb_position_t control_x HB_UNUSED, hb_position_t control_y HB_UNUSED,
@ -148,7 +134,7 @@ _cubic_to_nil (hb_position_t control1_x HB_UNUSED, hb_position_t control1_y HB_U
void *user_data HB_UNUSED) {} void *user_data HB_UNUSED) {}
static void static void
_open_close_path_nil (void *user_data HB_UNUSED) {} _close_path_nil (void *user_data HB_UNUSED) {}
/** /**
* hb_ot_glyph_decompose_funcs_create: * hb_ot_glyph_decompose_funcs_create:
@ -164,12 +150,11 @@ hb_ot_glyph_decompose_funcs_create ()
if (unlikely (!(funcs = hb_object_create<hb_ot_glyph_decompose_funcs_t> ()))) if (unlikely (!(funcs = hb_object_create<hb_ot_glyph_decompose_funcs_t> ())))
return const_cast<hb_ot_glyph_decompose_funcs_t *> (&Null (hb_ot_glyph_decompose_funcs_t)); return const_cast<hb_ot_glyph_decompose_funcs_t *> (&Null (hb_ot_glyph_decompose_funcs_t));
funcs->move_to = (hb_ot_glyph_decompose_move_to_func_t) _move_line_to_nil; funcs->move_to = (hb_ot_glyph_decompose_move_to_func_t) _move_to_nil;
funcs->line_to = (hb_ot_glyph_decompose_line_to_func_t) _move_line_to_nil; funcs->line_to = (hb_ot_glyph_decompose_line_to_func_t) _line_to_nil;
funcs->conic_to = (hb_ot_glyph_decompose_conic_to_func_t) _conic_to_nil; funcs->conic_to = (hb_ot_glyph_decompose_conic_to_func_t) _conic_to_nil;
funcs->cubic_to = (hb_ot_glyph_decompose_cubic_to_func_t) _cubic_to_nil; funcs->cubic_to = (hb_ot_glyph_decompose_cubic_to_func_t) _cubic_to_nil;
funcs->open_path = (hb_ot_glyph_decompose_open_path_func_t) _open_close_path_nil; funcs->close_path = (hb_ot_glyph_decompose_close_path_func_t) _close_path_nil;
funcs->close_path = (hb_ot_glyph_decompose_close_path_func_t) _open_close_path_nil;
return funcs; return funcs;
} }

View File

@ -42,7 +42,6 @@ typedef void (*hb_ot_glyph_decompose_cubic_to_func_t) (hb_position_t control1_x,
hb_position_t control2_x, hb_position_t control2_y, hb_position_t control2_x, hb_position_t control2_y,
hb_position_t to_x, hb_position_t to_y, hb_position_t to_x, hb_position_t to_y,
void *user_data); void *user_data);
typedef void (*hb_ot_glyph_decompose_open_path_func_t) (void *user_data);
typedef void (*hb_ot_glyph_decompose_close_path_func_t) (void *user_data); typedef void (*hb_ot_glyph_decompose_close_path_func_t) (void *user_data);
/** /**
@ -70,10 +69,6 @@ HB_EXTERN void
hb_ot_glyph_decompose_funcs_set_cubic_to_func (hb_ot_glyph_decompose_funcs_t *funcs, hb_ot_glyph_decompose_funcs_set_cubic_to_func (hb_ot_glyph_decompose_funcs_t *funcs,
hb_ot_glyph_decompose_cubic_to_func_t cubic_to); hb_ot_glyph_decompose_cubic_to_func_t cubic_to);
HB_EXTERN void
hb_ot_glyph_decompose_funcs_set_open_path_func (hb_ot_glyph_decompose_funcs_t *funcs,
hb_ot_glyph_decompose_open_path_func_t open_path);
HB_EXTERN void HB_EXTERN void
hb_ot_glyph_decompose_funcs_set_close_path_func (hb_ot_glyph_decompose_funcs_t *funcs, hb_ot_glyph_decompose_funcs_set_close_path_func (hb_ot_glyph_decompose_funcs_t *funcs,
hb_ot_glyph_decompose_close_path_func_t close_path); hb_ot_glyph_decompose_close_path_func_t close_path);

View File

@ -38,7 +38,6 @@ struct hb_ot_glyph_decompose_funcs_t
hb_ot_glyph_decompose_line_to_func_t line_to; hb_ot_glyph_decompose_line_to_func_t line_to;
hb_ot_glyph_decompose_conic_to_func_t conic_to; hb_ot_glyph_decompose_conic_to_func_t conic_to;
hb_ot_glyph_decompose_cubic_to_func_t cubic_to; hb_ot_glyph_decompose_cubic_to_func_t cubic_to;
hb_ot_glyph_decompose_open_path_func_t open_path;
hb_ot_glyph_decompose_close_path_func_t close_path; hb_ot_glyph_decompose_close_path_func_t close_path;
}; };

View File

@ -98,6 +98,7 @@ main (int argc, char **argv)
hb_ot_glyph_decompose_funcs_set_line_to_func (funcs, (hb_ot_glyph_decompose_line_to_func_t) line_to); hb_ot_glyph_decompose_funcs_set_line_to_func (funcs, (hb_ot_glyph_decompose_line_to_func_t) line_to);
hb_ot_glyph_decompose_funcs_set_conic_to_func (funcs, (hb_ot_glyph_decompose_conic_to_func_t) conic_to); hb_ot_glyph_decompose_funcs_set_conic_to_func (funcs, (hb_ot_glyph_decompose_conic_to_func_t) conic_to);
hb_ot_glyph_decompose_funcs_set_cubic_to_func (funcs, (hb_ot_glyph_decompose_cubic_to_func_t) cubic_to); hb_ot_glyph_decompose_funcs_set_cubic_to_func (funcs, (hb_ot_glyph_decompose_cubic_to_func_t) cubic_to);
hb_ot_glyph_decompose_funcs_set_close_path_func (funcs, (hb_ot_glyph_decompose_close_path_func_t) close_path);
for (unsigned int face_index = 0; face_index < hb_face_count (blob); face_index++) for (unsigned int face_index = 0; face_index < hb_face_count (blob); face_index++)
{ {

View File

@ -74,9 +74,6 @@ cubic_to (hb_position_t control1_x, hb_position_t control1_y,
to_x, to_y); to_x, to_y);
} }
static void
open_path (user_data_t *user_data HB_UNUSED) {}
static void static void
close_path (user_data_t *user_data) close_path (user_data_t *user_data)
{ {
@ -212,7 +209,6 @@ main (int argc, char **argv)
hb_ot_glyph_decompose_funcs_set_line_to_func (funcs, (hb_ot_glyph_decompose_line_to_func_t) line_to); hb_ot_glyph_decompose_funcs_set_line_to_func (funcs, (hb_ot_glyph_decompose_line_to_func_t) line_to);
hb_ot_glyph_decompose_funcs_set_conic_to_func (funcs, (hb_ot_glyph_decompose_conic_to_func_t) conic_to); hb_ot_glyph_decompose_funcs_set_conic_to_func (funcs, (hb_ot_glyph_decompose_conic_to_func_t) conic_to);
hb_ot_glyph_decompose_funcs_set_cubic_to_func (funcs, (hb_ot_glyph_decompose_cubic_to_func_t) cubic_to); hb_ot_glyph_decompose_funcs_set_cubic_to_func (funcs, (hb_ot_glyph_decompose_cubic_to_func_t) cubic_to);
hb_ot_glyph_decompose_funcs_set_open_path_func (funcs, (hb_ot_glyph_decompose_open_path_func_t) open_path);
hb_ot_glyph_decompose_funcs_set_close_path_func (funcs, (hb_ot_glyph_decompose_close_path_func_t) close_path); hb_ot_glyph_decompose_funcs_set_close_path_func (funcs, (hb_ot_glyph_decompose_close_path_func_t) close_path);
hb_test_init (&argc, &argv); hb_test_init (&argc, &argv);