2 * Copyright © 2018 Adobe Inc.
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 * Adobe Author(s): Michiharu Ariza
27 #ifndef HB_SUBSET_CFF_COMMON_HH
28 #define HB_SUBSET_CFF_COMMON_HH
32 #include "hb-subset-plan.hh"
33 #include "hb-cff-interp-cs-common.hh"
37 /* Used for writing a temporary charstring */
40 str_encoder_t (str_buff_t &buff_)
41 : buff (buff_), error (false) {}
43 void reset () { buff.resize (0); }
45 void encode_byte (unsigned char b)
47 if (unlikely (buff.push (b) == &Crap (unsigned char)))
51 void encode_int (int v)
53 if ((-1131 <= v) && (v <= 1131))
55 if ((-107 <= v) && (v <= 107))
56 encode_byte (v + 139);
60 encode_byte ((v >> 8) + OpCode_TwoBytePosInt0);
61 encode_byte (v & 0xFF);
66 encode_byte ((v >> 8) + OpCode_TwoByteNegInt0);
67 encode_byte (v & 0xFF);
72 if (unlikely (v < -32768))
74 else if (unlikely (v > 32767))
76 encode_byte (OpCode_shortint);
77 encode_byte ((v >> 8) & 0xFF);
78 encode_byte (v & 0xFF);
82 void encode_num (const number_t& n)
84 if (n.in_int_range ())
86 encode_int (n.to_int ());
90 int32_t v = n.to_fixed ();
91 encode_byte (OpCode_fixedcs);
92 encode_byte ((v >> 24) & 0xFF);
93 encode_byte ((v >> 16) & 0xFF);
94 encode_byte ((v >> 8) & 0xFF);
95 encode_byte (v & 0xFF);
99 void encode_op (op_code_t op)
101 if (Is_OpCode_ESC (op))
103 encode_byte (OpCode_escape);
104 encode_byte (Unmake_OpCode_ESC (op));
110 void copy_str (const byte_str_t &str)
112 unsigned int offset = buff.length;
113 buff.resize (offset + str.length);
114 if (unlikely (buff.length < offset + str.length))
119 memcpy (&buff[offset], &str[0], str.length);
122 bool is_error () const { return error; }
125 void set_error () { error = true; }
131 struct cff_sub_table_info_t {
132 cff_sub_table_info_t ()
134 char_strings_link (0)
139 table_info_t fd_select;
140 objidx_t fd_array_link;
141 objidx_t char_strings_link;
144 template <typename OPSTR=op_str_t>
145 struct cff_top_dict_op_serializer_t : op_serializer_t
147 bool serialize (hb_serialize_context_t *c,
149 const cff_sub_table_info_t &info) const
151 TRACE_SERIALIZE (this);
155 case OpCode_CharStrings:
156 return_trace (FontDict::serialize_link4_op(c, opstr.op, info.char_strings_link, whence_t::Absolute));
159 return_trace (FontDict::serialize_link4_op(c, opstr.op, info.fd_array_link, whence_t::Absolute));
161 case OpCode_FDSelect:
162 return_trace (FontDict::serialize_link4_op(c, opstr.op, info.fd_select.link, whence_t::Absolute));
165 return_trace (copy_opstr (c, opstr));
171 struct cff_font_dict_op_serializer_t : op_serializer_t
173 bool serialize (hb_serialize_context_t *c,
174 const op_str_t &opstr,
175 const table_info_t &privateDictInfo) const
177 TRACE_SERIALIZE (this);
179 if (opstr.op == OpCode_Private)
181 /* serialize the private dict size & offset as 2-byte & 4-byte integers */
182 return_trace (UnsizedByteStr::serialize_int2 (c, privateDictInfo.size) &&
183 Dict::serialize_link4_op (c, opstr.op, privateDictInfo.link, whence_t::Absolute));
187 HBUINT8 *d = c->allocate_size<HBUINT8> (opstr.str.length);
188 if (unlikely (!d)) return_trace (false);
189 memcpy (d, &opstr.str[0], opstr.str.length);
195 struct cff_private_dict_op_serializer_t : op_serializer_t
197 cff_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_)
198 : desubroutinize (desubroutinize_), drop_hints (drop_hints_) {}
200 bool serialize (hb_serialize_context_t *c,
201 const op_str_t &opstr,
202 objidx_t subrs_link) const
204 TRACE_SERIALIZE (this);
206 if (drop_hints && dict_opset_t::is_hint_op (opstr.op))
208 if (opstr.op == OpCode_Subrs)
210 if (desubroutinize || !subrs_link)
213 return_trace (FontDict::serialize_link2_op (c, opstr.op, subrs_link));
216 return_trace (copy_opstr (c, opstr));
220 const bool desubroutinize;
221 const bool drop_hints;
224 struct flatten_param_t
230 template <typename ACC, typename ENV, typename OPSET, op_code_t endchar_op=OpCode_Invalid>
231 struct subr_flattener_t
233 subr_flattener_t (const ACC &acc_,
234 const hb_subset_plan_t *plan_)
235 : acc (acc_), plan (plan_) {}
237 bool flatten (str_buff_vec_t &flat_charstrings)
239 if (!flat_charstrings.resize (plan->num_output_glyphs ()))
241 for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
242 flat_charstrings[i].init ();
243 for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
245 hb_codepoint_t glyph;
246 if (!plan->old_gid_for_new_gid (i, &glyph))
248 /* add an endchar only charstring for a missing glyph if CFF1 */
249 if (endchar_op != OpCode_Invalid) flat_charstrings[i].push (endchar_op);
252 const byte_str_t str = (*acc.charStrings)[glyph];
253 unsigned int fd = acc.fdSelect->get_fd (glyph);
254 if (unlikely (fd >= acc.fdCount))
256 cs_interpreter_t<ENV, OPSET, flatten_param_t> interp;
257 interp.env.init (str, acc, fd);
258 flatten_param_t param = { flat_charstrings[i], plan->drop_hints };
259 if (unlikely (!interp.interpret (param)))
266 const hb_subset_plan_t *plan;
269 struct subr_closures_t
271 subr_closures_t () : valid (false), global_closure (nullptr)
272 { local_closures.init (); }
274 void init (unsigned int fd_count)
277 global_closure = hb_set_create ();
278 if (global_closure == hb_set_get_empty ())
280 if (!local_closures.resize (fd_count))
283 for (unsigned int i = 0; i < local_closures.length; i++)
285 local_closures[i] = hb_set_create ();
286 if (local_closures[i] == hb_set_get_empty ())
293 hb_set_destroy (global_closure);
294 for (unsigned int i = 0; i < local_closures.length; i++)
295 hb_set_destroy (local_closures[i]);
296 local_closures.fini ();
301 hb_set_clear (global_closure);
302 for (unsigned int i = 0; i < local_closures.length; i++)
303 hb_set_clear (local_closures[i]);
306 bool is_valid () const { return valid; }
308 hb_set_t *global_closure;
309 hb_vector_t<hb_set_t *> local_closures;
312 struct parsed_cs_op_t : op_str_t
314 void init (unsigned int subr_num_ = 0)
317 subr_num = subr_num_;
323 void fini () { op_str_t::fini (); }
325 bool for_drop () const { return drop_flag; }
326 void set_drop () { if (!for_keep ()) drop_flag = true; }
328 bool for_keep () const { return keep_flag; }
329 void set_keep () { keep_flag = true; }
331 bool for_skip () const { return skip_flag; }
332 void set_skip () { skip_flag = true; }
334 unsigned int subr_num;
342 struct parsed_cs_str_t : parsed_values_t<parsed_cs_op_t>
348 hint_dropped = false;
352 void add_op (op_code_t op, const byte_str_ref_t& str_ref)
355 SUPER::add_op (op, str_ref);
358 void add_call_op (op_code_t op, const byte_str_ref_t& str_ref, unsigned int subr_num)
362 unsigned int parsed_len = get_count ();
363 if (likely (parsed_len > 0))
364 values[parsed_len-1].set_skip ();
368 SUPER::add_op (op, str_ref, val);
372 void set_prefix (const number_t &num, op_code_t op = OpCode_Invalid)
379 bool at_end (unsigned int pos) const
381 return ((pos + 1 >= values.length) /* CFF2 */
382 || (values[pos + 1].op == OpCode_return));
385 bool is_parsed () const { return parsed; }
386 void set_parsed () { parsed = true; }
388 bool is_hint_dropped () const { return hint_dropped; }
389 void set_hint_dropped () { hint_dropped = true; }
391 bool is_vsindex_dropped () const { return vsindex_dropped; }
392 void set_vsindex_dropped () { vsindex_dropped = true; }
394 bool has_prefix () const { return has_prefix_; }
395 op_code_t prefix_op () const { return prefix_op_; }
396 const number_t &prefix_num () const { return prefix_num_; }
401 bool vsindex_dropped;
403 op_code_t prefix_op_;
404 number_t prefix_num_;
407 typedef parsed_values_t<parsed_cs_op_t> SUPER;
410 struct parsed_cs_str_vec_t : hb_vector_t<parsed_cs_str_t>
412 void init (unsigned int len_ = 0)
416 for (unsigned int i = 0; i < length; i++)
419 void fini () { SUPER::fini_deep (); }
422 typedef hb_vector_t<parsed_cs_str_t> SUPER;
425 struct subr_subset_param_t
427 void init (parsed_cs_str_t *parsed_charstring_,
428 parsed_cs_str_vec_t *parsed_global_subrs_, parsed_cs_str_vec_t *parsed_local_subrs_,
429 hb_set_t *global_closure_, hb_set_t *local_closure_,
432 parsed_charstring = parsed_charstring_;
433 current_parsed_str = parsed_charstring;
434 parsed_global_subrs = parsed_global_subrs_;
435 parsed_local_subrs = parsed_local_subrs_;
436 global_closure = global_closure_;
437 local_closure = local_closure_;
438 drop_hints = drop_hints_;
441 parsed_cs_str_t *get_parsed_str_for_context (call_context_t &context)
443 switch (context.type)
445 case CSType_CharString:
446 return parsed_charstring;
448 case CSType_LocalSubr:
449 if (likely (context.subr_num < parsed_local_subrs->length))
450 return &(*parsed_local_subrs)[context.subr_num];
453 case CSType_GlobalSubr:
454 if (likely (context.subr_num < parsed_global_subrs->length))
455 return &(*parsed_global_subrs)[context.subr_num];
461 template <typename ENV>
462 void set_current_str (ENV &env, bool calling)
464 parsed_cs_str_t *parsed_str = get_parsed_str_for_context (env.context);
465 if (unlikely (!parsed_str))
470 /* If the called subroutine is parsed partially but not completely yet,
471 * it must be because we are calling it recursively.
472 * Handle it as an error. */
473 if (unlikely (calling && !parsed_str->is_parsed () && (parsed_str->values.length > 0)))
476 current_parsed_str = parsed_str;
479 parsed_cs_str_t *current_parsed_str;
481 parsed_cs_str_t *parsed_charstring;
482 parsed_cs_str_vec_t *parsed_global_subrs;
483 parsed_cs_str_vec_t *parsed_local_subrs;
484 hb_set_t *global_closure;
485 hb_set_t *local_closure;
489 struct subr_remap_t : hb_inc_bimap_t
491 void create (hb_set_t *closure)
493 /* create a remapping of subroutine numbers from old to new.
494 * no optimization based on usage counts. fonttools doesn't appear doing that either.
497 hb_codepoint_t old_num = HB_SET_VALUE_INVALID;
498 while (hb_set_next (closure, &old_num))
501 if (get_population () < 1240)
503 else if (get_population () < 33900)
509 int biased_num (unsigned int old_num) const
511 hb_codepoint_t new_num = get (old_num);
512 return (int)new_num - bias;
523 global_remap.init ();
524 local_remaps.init ();
527 ~subr_remaps_t () { fini (); }
529 void init (unsigned int fdCount)
531 local_remaps.resize (fdCount);
532 for (unsigned int i = 0; i < fdCount; i++)
533 local_remaps[i].init ();
536 void create (subr_closures_t& closures)
538 global_remap.create (closures.global_closure);
539 for (unsigned int i = 0; i < local_remaps.length; i++)
540 local_remaps[i].create (closures.local_closures[i]);
545 global_remap.fini ();
546 local_remaps.fini_deep ();
549 subr_remap_t global_remap;
550 hb_vector_t<subr_remap_t> local_remaps;
553 template <typename SUBSETTER, typename SUBRS, typename ACC, typename ENV, typename OPSET, op_code_t endchar_op=OpCode_Invalid>
554 struct subr_subsetter_t
556 subr_subsetter_t (ACC &acc_, const hb_subset_plan_t *plan_)
557 : acc (acc_), plan (plan_)
559 parsed_charstrings.init ();
560 parsed_global_subrs.init ();
561 parsed_local_subrs.init ();
568 parsed_charstrings.fini_deep ();
569 parsed_global_subrs.fini_deep ();
570 parsed_local_subrs.fini_deep ();
573 /* Subroutine subsetting with --no-desubroutinize runs in phases:
575 * 1. execute charstrings/subroutines to determine subroutine closures
576 * 2. parse out all operators and numbers
577 * 3. mark hint operators and operands for removal if --no-hinting
578 * 4. re-encode all charstrings and subroutines with new subroutine numbers
580 * Phases #1 and #2 are done at the same time in collect_subrs ().
581 * Phase #3 walks charstrings/subroutines forward then backward (hence parsing required),
582 * because we can't tell if a number belongs to a hint op until we see the first moveto.
584 * Assumption: a callsubr/callgsubr operator must immediately follow a (biased) subroutine number
585 * within the same charstring/subroutine, e.g., not split across a charstring and a subroutine.
589 closures.init (acc.fdCount);
590 remaps.init (acc.fdCount);
592 parsed_charstrings.init (plan->num_output_glyphs ());
593 parsed_global_subrs.init (acc.globalSubrs->count);
594 parsed_local_subrs.resize (acc.fdCount);
595 for (unsigned int i = 0; i < acc.fdCount; i++)
597 parsed_local_subrs[i].init (acc.privateDicts[i].localSubrs->count);
599 if (unlikely (!closures.valid))
603 for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
605 hb_codepoint_t glyph;
606 if (!plan->old_gid_for_new_gid (i, &glyph))
608 const byte_str_t str = (*acc.charStrings)[glyph];
609 unsigned int fd = acc.fdSelect->get_fd (glyph);
610 if (unlikely (fd >= acc.fdCount))
613 cs_interpreter_t<ENV, OPSET, subr_subset_param_t> interp;
614 interp.env.init (str, acc, fd);
616 subr_subset_param_t param;
617 param.init (&parsed_charstrings[i],
618 &parsed_global_subrs, &parsed_local_subrs[fd],
619 closures.global_closure, closures.local_closures[fd],
622 if (unlikely (!interp.interpret (param)))
625 /* complete parsed string esp. copy CFF1 width or CFF2 vsindex to the parsed charstring for encoding */
626 SUBSETTER::complete_parsed_str (interp.env, param, parsed_charstrings[i]);
629 if (plan->drop_hints)
631 /* mark hint ops and arguments for drop */
632 for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
634 hb_codepoint_t glyph;
635 if (!plan->old_gid_for_new_gid (i, &glyph))
637 unsigned int fd = acc.fdSelect->get_fd (glyph);
638 if (unlikely (fd >= acc.fdCount))
640 subr_subset_param_t param;
641 param.init (&parsed_charstrings[i],
642 &parsed_global_subrs, &parsed_local_subrs[fd],
643 closures.global_closure, closures.local_closures[fd],
646 drop_hints_param_t drop;
647 if (drop_hints_in_str (parsed_charstrings[i], param, drop))
649 parsed_charstrings[i].set_hint_dropped ();
650 if (drop.vsindex_dropped)
651 parsed_charstrings[i].set_vsindex_dropped ();
655 /* after dropping hints recreate closures of actually used subrs */
657 for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
659 hb_codepoint_t glyph;
660 if (!plan->old_gid_for_new_gid (i, &glyph))
662 unsigned int fd = acc.fdSelect->get_fd (glyph);
663 if (unlikely (fd >= acc.fdCount))
665 subr_subset_param_t param;
666 param.init (&parsed_charstrings[i],
667 &parsed_global_subrs, &parsed_local_subrs[fd],
668 closures.global_closure, closures.local_closures[fd],
670 collect_subr_refs_in_str (parsed_charstrings[i], param);
674 remaps.create (closures);
679 bool encode_charstrings (str_buff_vec_t &buffArray) const
681 if (unlikely (!buffArray.resize (plan->num_output_glyphs ())))
683 for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
685 hb_codepoint_t glyph;
686 if (!plan->old_gid_for_new_gid (i, &glyph))
688 /* add an endchar only charstring for a missing glyph if CFF1 */
689 if (endchar_op != OpCode_Invalid) buffArray[i].push (endchar_op);
692 unsigned int fd = acc.fdSelect->get_fd (glyph);
693 if (unlikely (fd >= acc.fdCount))
695 if (unlikely (!encode_str (parsed_charstrings[i], fd, buffArray[i])))
701 bool encode_subrs (const parsed_cs_str_vec_t &subrs, const subr_remap_t& remap, unsigned int fd, str_buff_vec_t &buffArray) const
703 unsigned int count = remap.get_population ();
705 if (unlikely (!buffArray.resize (count)))
707 for (unsigned int old_num = 0; old_num < subrs.length; old_num++)
709 hb_codepoint_t new_num = remap[old_num];
710 if (new_num != CFF_UNDEF_CODE)
712 if (unlikely (!encode_str (subrs[old_num], fd, buffArray[new_num])))
719 bool encode_globalsubrs (str_buff_vec_t &buffArray)
721 return encode_subrs (parsed_global_subrs, remaps.global_remap, 0, buffArray);
724 bool encode_localsubrs (unsigned int fd, str_buff_vec_t &buffArray) const
726 return encode_subrs (parsed_local_subrs[fd], remaps.local_remaps[fd], fd, buffArray);
730 struct drop_hints_param_t
732 drop_hints_param_t ()
733 : seen_moveto (false),
734 ends_in_hint (false),
736 vsindex_dropped (false) {}
741 bool vsindex_dropped;
744 bool drop_hints_in_subr (parsed_cs_str_t &str, unsigned int pos,
745 parsed_cs_str_vec_t &subrs, unsigned int subr_num,
746 const subr_subset_param_t ¶m, drop_hints_param_t &drop)
748 drop.ends_in_hint = false;
749 bool has_hint = drop_hints_in_str (subrs[subr_num], param, drop);
751 /* if this subr ends with a stem hint (i.e., not a number; potential argument for moveto),
752 * then this entire subroutine must be a hint. drop its call. */
753 if (drop.ends_in_hint)
755 str.values[pos].set_drop ();
756 /* if this subr call is at the end of the parent subr, propagate the flag
757 * otherwise reset the flag */
758 if (!str.at_end (pos))
759 drop.ends_in_hint = false;
761 else if (drop.all_dropped)
763 str.values[pos].set_drop ();
769 /* returns true if it sees a hint op before the first moveto */
770 bool drop_hints_in_str (parsed_cs_str_t &str, const subr_subset_param_t ¶m, drop_hints_param_t &drop)
772 bool seen_hint = false;
774 for (unsigned int pos = 0; pos < str.values.length; pos++)
776 bool has_hint = false;
777 switch (str.values[pos].op)
779 case OpCode_callsubr:
780 has_hint = drop_hints_in_subr (str, pos,
781 *param.parsed_local_subrs, str.values[pos].subr_num,
785 case OpCode_callgsubr:
786 has_hint = drop_hints_in_subr (str, pos,
787 *param.parsed_global_subrs, str.values[pos].subr_num,
794 drop.seen_moveto = true;
797 case OpCode_hintmask:
798 case OpCode_cntrmask:
799 if (drop.seen_moveto)
801 str.values[pos].set_drop ();
811 str.values[pos].set_drop ();
812 if (str.at_end (pos))
813 drop.ends_in_hint = true;
816 case OpCode_dotsection:
817 str.values[pos].set_drop ();
826 for (int i = pos - 1; i >= 0; i--)
828 parsed_cs_op_t &csop = str.values[(unsigned)i];
829 if (csop.for_drop ())
832 if (csop.op == OpCode_vsindexcs)
833 drop.vsindex_dropped = true;
835 seen_hint |= has_hint;
839 /* Raise all_dropped flag if all operators except return are dropped from a subr.
840 * It may happen even after seeing the first moveto if a subr contains
841 * only (usually one) hintmask operator, then calls to this subr can be dropped.
843 drop.all_dropped = true;
844 for (unsigned int pos = 0; pos < str.values.length; pos++)
846 parsed_cs_op_t &csop = str.values[pos];
847 if (csop.op == OpCode_return)
849 if (!csop.for_drop ())
851 drop.all_dropped = false;
859 void collect_subr_refs_in_subr (parsed_cs_str_t &str, unsigned int pos,
860 unsigned int subr_num, parsed_cs_str_vec_t &subrs,
862 const subr_subset_param_t ¶m)
864 closure->add (subr_num);
865 collect_subr_refs_in_str (subrs[subr_num], param);
868 void collect_subr_refs_in_str (parsed_cs_str_t &str, const subr_subset_param_t ¶m)
870 for (unsigned int pos = 0; pos < str.values.length; pos++)
872 if (!str.values[pos].for_drop ())
874 switch (str.values[pos].op)
876 case OpCode_callsubr:
877 collect_subr_refs_in_subr (str, pos,
878 str.values[pos].subr_num, *param.parsed_local_subrs,
879 param.local_closure, param);
882 case OpCode_callgsubr:
883 collect_subr_refs_in_subr (str, pos,
884 str.values[pos].subr_num, *param.parsed_global_subrs,
885 param.global_closure, param);
894 bool encode_str (const parsed_cs_str_t &str, const unsigned int fd, str_buff_t &buff) const
897 str_encoder_t encoder (buff);
899 /* if a prefix (CFF1 width or CFF2 vsindex) has been removed along with hints,
900 * re-insert it at the beginning of charstreing */
901 if (str.has_prefix () && str.is_hint_dropped ())
903 encoder.encode_num (str.prefix_num ());
904 if (str.prefix_op () != OpCode_Invalid)
905 encoder.encode_op (str.prefix_op ());
907 for (unsigned int i = 0; i < str.get_count(); i++)
909 const parsed_cs_op_t &opstr = str.values[i];
910 if (!opstr.for_drop () && !opstr.for_skip ())
914 case OpCode_callsubr:
915 encoder.encode_int (remaps.local_remaps[fd].biased_num (opstr.subr_num));
916 encoder.encode_op (OpCode_callsubr);
919 case OpCode_callgsubr:
920 encoder.encode_int (remaps.global_remap.biased_num (opstr.subr_num));
921 encoder.encode_op (OpCode_callgsubr);
925 encoder.copy_str (opstr.str);
930 return !encoder.is_error ();
935 const hb_subset_plan_t *plan;
937 subr_closures_t closures;
939 parsed_cs_str_vec_t parsed_charstrings;
940 parsed_cs_str_vec_t parsed_global_subrs;
941 hb_vector_t<parsed_cs_str_vec_t> parsed_local_subrs;
943 subr_remaps_t remaps;
946 typedef typename SUBRS::count_type subr_count_type;
949 } /* namespace CFF */
952 hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan,
953 unsigned int fdCount,
954 const CFF::FDSelect &src, /* IN */
955 unsigned int &subset_fd_count /* OUT */,
956 unsigned int &subset_fdselect_size /* OUT */,
957 unsigned int &subset_fdselect_format /* OUT */,
958 hb_vector_t<CFF::code_pair_t> &fdselect_ranges /* OUT */,
959 hb_inc_bimap_t &fdmap /* OUT */);
962 hb_serialize_cff_fdselect (hb_serialize_context_t *c,
963 unsigned int num_glyphs,
964 const CFF::FDSelect &src,
965 unsigned int fd_count,
966 unsigned int fdselect_format,
968 const hb_vector_t<CFF::code_pair_t> &fdselect_ranges);
970 #endif /* HB_SUBSET_CFF_COMMON_HH */