[draw] Add a private bit field instead null-checking quad-to callback
This doesn't imply the the design is good or stable just is better to not fail due to null quad-to callback so as our quad-cubic curves translation is currently table limited which can be revisited anytime.
This commit is contained in:
parent
79b2b8a91f
commit
da37880e17
|
@ -81,6 +81,7 @@ hb_draw_funcs_set_quadratic_to_func (hb_draw_funcs_t *funcs,
|
|||
{
|
||||
if (unlikely (hb_object_is_immutable (funcs))) return;
|
||||
funcs->quadratic_to = quadratic_to;
|
||||
funcs->is_quadratic_to_set = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,6 +124,11 @@ _move_to_nil (hb_position_t to_x HB_UNUSED, hb_position_t to_y HB_UNUSED, void *
|
|||
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
|
||||
_quadratic_to_nil (hb_position_t control_x HB_UNUSED, hb_position_t control_y HB_UNUSED,
|
||||
hb_position_t to_x HB_UNUSED, hb_position_t to_y HB_UNUSED,
|
||||
void *user_data HB_UNUSED) {}
|
||||
|
||||
static void
|
||||
_cubic_to_nil (hb_position_t control1_x HB_UNUSED, hb_position_t control1_y HB_UNUSED,
|
||||
hb_position_t control2_x HB_UNUSED, hb_position_t control2_y HB_UNUSED,
|
||||
|
@ -148,7 +154,8 @@ hb_draw_funcs_create ()
|
|||
|
||||
funcs->move_to = (hb_draw_move_to_func_t) _move_to_nil;
|
||||
funcs->line_to = (hb_draw_line_to_func_t) _line_to_nil;
|
||||
funcs->quadratic_to = nullptr;
|
||||
funcs->quadratic_to = (hb_draw_quadratic_to_func_t) _quadratic_to_nil;
|
||||
funcs->is_quadratic_to_set = false;
|
||||
funcs->cubic_to = (hb_draw_cubic_to_func_t) _cubic_to_nil;
|
||||
funcs->close_path = (hb_draw_close_path_func_t) _close_path_nil;
|
||||
return funcs;
|
||||
|
|
|
@ -34,6 +34,7 @@ struct hb_draw_funcs_t
|
|||
hb_draw_move_to_func_t move_to;
|
||||
hb_draw_line_to_func_t line_to;
|
||||
hb_draw_quadratic_to_func_t quadratic_to;
|
||||
bool is_quadratic_to_set;
|
||||
hb_draw_cubic_to_func_t cubic_to;
|
||||
hb_draw_close_path_func_t close_path;
|
||||
};
|
||||
|
|
|
@ -151,7 +151,7 @@ struct glyf
|
|||
TRACE_SERIALIZE (this);
|
||||
unsigned init_len = c->length ();
|
||||
for (const auto &_ : it) _.serialize (c, plan);
|
||||
|
||||
|
||||
/* As a special case when all glyph in the font are empty, add a zero byte
|
||||
* to the table, so that OTS doesn’t reject it, and to make the table work
|
||||
* on Windows as well.
|
||||
|
@ -1073,7 +1073,7 @@ struct glyf
|
|||
font = font_;
|
||||
funcs = funcs_;
|
||||
user_data = user_data_;
|
||||
quad_to = funcs->quadratic_to
|
||||
quad_to = funcs->is_quadratic_to_set
|
||||
? _normal_quadratic_to_call
|
||||
: _translate_quadratic_to_cubic;
|
||||
end_of_contour ();
|
||||
|
|
Loading…
Reference in New Issue