diff options
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-cff-interp-cs-common.hh')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-cff-interp-cs-common.hh | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-cff-interp-cs-common.hh b/src/3rdparty/harfbuzz-ng/src/hb-cff-interp-cs-common.hh index 52d778ffe2..28a777eb0d 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-cff-interp-cs-common.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-cff-interp-cs-common.hh @@ -79,10 +79,10 @@ struct biased_subrs_t unsigned int get_count () const { return subrs ? subrs->count : 0; } unsigned int get_bias () const { return bias; } - byte_str_t operator [] (unsigned int index) const + hb_ubytes_t operator [] (unsigned int index) const { if (unlikely (!subrs || index >= subrs->count)) - return Null (byte_str_t); + return hb_ubytes_t (); else return (*subrs)[index]; } @@ -94,12 +94,6 @@ struct biased_subrs_t struct point_t { - void init () - { - x.init (); - y.init (); - } - void set_int (int _x, int _y) { x.set_int (_x); @@ -118,26 +112,21 @@ struct point_t template <typename ARG, typename SUBRS> struct cs_interp_env_t : interp_env_t<ARG> { - void init (const byte_str_t &str, const SUBRS *globalSubrs_, const SUBRS *localSubrs_) + cs_interp_env_t (const hb_ubytes_t &str, const SUBRS *globalSubrs_, const SUBRS *localSubrs_) : + interp_env_t<ARG> (str) { - interp_env_t<ARG>::init (str); - context.init (str, CSType_CharString); seen_moveto = true; seen_hintmask = false; hstem_count = 0; vstem_count = 0; hintmask_size = 0; - pt.init (); - callStack.init (); + pt.set_int (0, 0); globalSubrs.init (globalSubrs_); localSubrs.init (localSubrs_); } - void fini () + ~cs_interp_env_t () { - interp_env_t<ARG>::fini (); - - callStack.fini (); globalSubrs.fini (); localSubrs.fini (); } @@ -841,7 +830,6 @@ struct path_procs_t if (likely (env.argStack.get_count () == 11)) { point_t d; - d.init (); for (unsigned int i = 0; i < 10; i += 2) d.move (env.eval_arg (i), env.eval_arg (i+1)); @@ -887,14 +875,20 @@ struct path_procs_t template <typename ENV, typename OPSET, typename PARAM> struct cs_interpreter_t : interpreter_t<ENV> { + cs_interpreter_t (ENV& env_) : interpreter_t<ENV> (env_) {} + bool interpret (PARAM& param) { SUPER::env.set_endchar (false); + unsigned max_ops = HB_CFF_MAX_OPS; for (;;) { OPSET::process_op (SUPER::env.fetch_op (), SUPER::env, param); - if (unlikely (SUPER::env.in_error ())) + if (unlikely (SUPER::env.in_error () || !--max_ops)) + { + SUPER::env.set_error (); return false; + } if (SUPER::env.is_endchar ()) break; } |