diff --git a/src/hb-ot-cff1-table.cc b/src/hb-ot-cff1-table.cc index 5040c7462..66df28aae 100644 --- a/src/hb-ot-cff1-table.cc +++ b/src/hb-ot-cff1-table.cc @@ -574,11 +574,11 @@ bool OT::cff1::accelerator_t::get_path (hb_font_t *font, hb_codepoint_t glyph, h struct get_seac_param_t { - get_seac_param_t (const OT::cff1::accelerator_t *_cff) : cff (_cff) {} + get_seac_param_t (const OT::cff1::accelerator_subset_t *_cff) : cff (_cff) {} bool has_seac () const { return base && accent; } - const OT::cff1::accelerator_t *cff; + const OT::cff1::accelerator_subset_t *cff; hb_codepoint_t base = 0; hb_codepoint_t accent = 0; }; @@ -596,7 +596,7 @@ struct cff1_cs_opset_seac_t : cff1_cs_opset_t= num_glyphs))) return false; diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index b3bacd88e..fe2928331 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -1060,6 +1060,8 @@ struct cff1 { accelerator_templ_t (hb_face_t *face) { + if (!face) return; + topDict.init (); fontDicts.init (); privateDicts.init (); @@ -1460,7 +1462,6 @@ struct cff1 HB_INTERNAL bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const; HB_INTERNAL bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const; - HB_INTERNAL bool get_seac_components (hb_codepoint_t glyph, hb_codepoint_t *base, hb_codepoint_t *accent) const; HB_INTERNAL bool get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const; private: @@ -1499,6 +1500,7 @@ struct cff1 HB_INTERNAL bool subset (hb_subset_context_t *c) const; HB_INTERNAL bool serialize (hb_serialize_context_t *c, struct cff1_subset_plan &plan) const; + HB_INTERNAL bool get_seac_components (hb_codepoint_t glyph, hb_codepoint_t *base, hb_codepoint_t *accent) const; mutable CFF::cff_subset_accelerator_t* cff_accelerator = nullptr; diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index b62d182a0..9913cdad0 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -392,6 +392,8 @@ struct cff2 { accelerator_templ_t (hb_face_t *face) { + if (!face) return; + topDict.init (); fontDicts.init (); privateDicts.init (); diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 36d6afef7..089ca83e8 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -65,7 +65,7 @@ hb_subset_accelerator_t::~hb_subset_accelerator_t () typedef hb_hashmap_t> script_langsys_map; #ifndef HB_NO_SUBSET_CFF static inline bool -_add_cff_seac_components (const OT::cff1::accelerator_t &cff, +_add_cff_seac_components (const OT::cff1::accelerator_subset_t &cff, hb_codepoint_t gid, hb_set_t *gids_to_retain) { @@ -703,7 +703,8 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, { OT::glyf_accelerator_t glyf (plan->source); #ifndef HB_NO_SUBSET_CFF - OT::cff1::accelerator_t cff (plan->source); + OT::cff1::accelerator_subset_t stack_cff (plan->accelerator ? nullptr : plan->source); + const OT::cff1::accelerator_subset_t *cff (plan->accelerator ? plan->accelerator->cff1_accel.get () : &stack_cff); #endif plan->_glyphset_gsub.add (0); // Not-def @@ -765,9 +766,9 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, if (!plan->accelerator || plan->accelerator->has_seac) { bool has_seac = false; - if (cff.is_valid ()) + if (cff->is_valid ()) for (hb_codepoint_t gid : cur_glyphset) - if (_add_cff_seac_components (cff, gid, &plan->_glyphset)) + if (_add_cff_seac_components (*cff, gid, &plan->_glyphset)) has_seac = true; plan->has_seac = has_seac; }