fixed tabs, added inline

This commit is contained in:
Michiharu Ariza 2018-12-21 16:06:35 -08:00
parent 785408d4f7
commit 21163c30e9
14 changed files with 628 additions and 628 deletions

View File

@ -217,37 +217,37 @@ inline unsigned int OpCode_Size (op_code_t op) { return Is_OpCode_ESC (op) ? 2:
struct number_t
{
void init () { set_real (0.0); }
void fini () {}
inline void init () { set_real (0.0); }
inline void fini () {}
void set_int (int v) { value = (double) v; }
int to_int () const { return (int) value; }
inline void set_int (int v) { value = (double) v; }
inline int to_int () const { return (int) value; }
void set_fixed (int32_t v) { value = v / 65536.0; }
int32_t to_fixed () const { return (int32_t) (value * 65536.0); }
inline void set_fixed (int32_t v) { value = v / 65536.0; }
inline int32_t to_fixed () const { return (int32_t) (value * 65536.0); }
void set_real (double v) { value = v; }
double to_real () const { return value; }
inline void set_real (double v) { value = v; }
inline double to_real () const { return value; }
int ceil () const { return (int) ::ceil (value); }
int floor () const { return (int) ::floor (value); }
inline int ceil () const { return (int) ::ceil (value); }
inline int floor () const { return (int) ::floor (value); }
bool in_int_range () const
inline bool in_int_range () const
{ return ((double) (int16_t) to_int () == value); }
bool operator > (const number_t &n) const
inline bool operator > (const number_t &n) const
{ return value > n.to_real (); }
bool operator < (const number_t &n) const
inline bool operator < (const number_t &n) const
{ return n > *this; }
bool operator >= (const number_t &n) const
inline bool operator >= (const number_t &n) const
{ return !(*this < n); }
bool operator <= (const number_t &n) const
inline bool operator <= (const number_t &n) const
{ return !(*this > n); }
const number_t &operator += (const number_t &n)
inline const number_t &operator += (const number_t &n)
{
set_real (to_real () + n.to_real ());
@ -263,7 +263,7 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
{
// encode 2-byte int (Dict/CharString) or 4-byte int (Dict)
template <typename INTTYPE, int minVal, int maxVal>
static bool serialize_int (hb_serialize_context_t *c, op_code_t intOp, int value)
static inline bool serialize_int (hb_serialize_context_t *c, op_code_t intOp, int value)
{
TRACE_SERIALIZE (this);
@ -281,10 +281,10 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
return_trace (true);
}
static bool serialize_int4 (hb_serialize_context_t *c, int value)
static inline bool serialize_int4 (hb_serialize_context_t *c, int value)
{ return serialize_int<HBUINT32, 0, 0x7FFFFFFF> (c, OpCode_longintdict, value); }
static bool serialize_int2 (hb_serialize_context_t *c, int value)
static inline bool serialize_int2 (hb_serialize_context_t *c, int value)
{ return serialize_int<HBUINT16, 0, 0x7FFF> (c, OpCode_shortint, value); }
/* Defining null_size allows a Null object may be created. Should be safe because:
@ -300,49 +300,48 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
/* Holder of a section of byte string within a CFFIndex entry */
struct byte_str_t : hb_ubytes_t
{
byte_str_t ()
inline byte_str_t ()
: hb_ubytes_t () {}
byte_str_t (const UnsizedByteStr& s, unsigned int l)
inline byte_str_t (const UnsizedByteStr& s, unsigned int l)
: hb_ubytes_t ((const unsigned char*)&s, l) {}
byte_str_t (const unsigned char *s, unsigned int l)
inline byte_str_t (const unsigned char *s, unsigned int l)
: hb_ubytes_t (s, l) {}
byte_str_t (const hb_ubytes_t &ub) /* conversion from hb_ubytes_t */
inline byte_str_t (const hb_ubytes_t &ub) /* conversion from hb_ubytes_t */
: hb_ubytes_t (ub) {}
/* sub-string */
byte_str_t sub_str (unsigned int offset, unsigned int len_) const
inline byte_str_t sub_str (unsigned int offset, unsigned int len_) const
{ return byte_str_t (hb_ubytes_t::sub_array (offset, len_)); }
bool check_limit (unsigned int offset, unsigned int count) const
inline bool check_limit (unsigned int offset, unsigned int count) const
{ return (offset + count <= len); }
};
/* A byte string associated with the current offset and an error condition */
struct byte_str_ref_t
{
byte_str_ref_t ()
{ init (); }
inline byte_str_ref_t () { init (); }
void init ()
inline void init ()
{
str = byte_str_t ();
offset = 0;
error = false;
}
void fini () {}
inline void fini () {}
byte_str_ref_t (const byte_str_t &str_, unsigned int offset_ = 0)
inline byte_str_ref_t (const byte_str_t &str_, unsigned int offset_ = 0)
: str (str_), offset (offset_), error (false) {}
void reset (const byte_str_t &str_, unsigned int offset_ = 0)
inline void reset (const byte_str_t &str_, unsigned int offset_ = 0)
{
str = str_;
offset = offset_;
error = false;
}
const unsigned char& operator [] (int i) {
inline const unsigned char& operator [] (int i) {
if (unlikely ((unsigned int)(offset + i) >= str.len))
{
set_error ();
@ -353,16 +352,16 @@ struct byte_str_ref_t
}
/* Conversion to byte_str_t */
operator byte_str_t () const { return str.sub_str (offset, str.len - offset); }
inline operator byte_str_t () const { return str.sub_str (offset, str.len - offset); }
byte_str_t sub_str (unsigned int offset_, unsigned int len_) const
inline byte_str_t sub_str (unsigned int offset_, unsigned int len_) const
{ return str.sub_str (offset_, len_); }
bool avail (unsigned int count=1) const
inline bool avail (unsigned int count=1) const
{
return (!in_error () && str.check_limit (offset, count));
}
void inc (unsigned int count=1)
inline void inc (unsigned int count=1)
{
if (likely (!in_error () && (offset <= str.len) && (offset + count <= str.len)))
{
@ -375,8 +374,8 @@ struct byte_str_ref_t
}
}
void set_error () { error = true; }
bool in_error () const { return error; }
inline void set_error () { error = true; }
inline bool in_error () const { return error; }
byte_str_t str;
unsigned int offset; /* beginning of the sub-string within str */
@ -391,7 +390,7 @@ typedef hb_vector_t<byte_str_t> byte_str_array_t;
template <typename ELEM, int LIMIT>
struct stack_t
{
void init ()
inline void init ()
{
error = false;
count = 0;
@ -401,18 +400,18 @@ struct stack_t
elements[i].init ();
}
void fini ()
inline void fini ()
{
elements.fini_deep ();
}
ELEM& operator [] (unsigned int i)
inline ELEM& operator [] (unsigned int i)
{
if (unlikely (i >= count)) set_error ();
return elements[i];
}
void push (const ELEM &v)
inline void push (const ELEM &v)
{
if (likely (count < elements.len))
elements[count++] = v;
@ -420,7 +419,7 @@ struct stack_t
set_error ();
}
ELEM &push ()
inline ELEM &push ()
{
if (likely (count < elements.len))
return elements[count++];
@ -431,7 +430,7 @@ struct stack_t
}
}
ELEM& pop ()
inline ELEM& pop ()
{
if (likely (count > 0))
return elements[--count];
@ -442,7 +441,7 @@ struct stack_t
}
}
void pop (unsigned int n)
inline void pop (unsigned int n)
{
if (likely (count >= n))
count -= n;
@ -450,7 +449,7 @@ struct stack_t
set_error ();
}
const ELEM& peek ()
inline const ELEM& peek ()
{
if (likely (count > 0))
return elements[count-1];
@ -461,7 +460,7 @@ struct stack_t
}
}
void unpop ()
inline void unpop ()
{
if (likely (count < elements.len))
count++;
@ -469,13 +468,13 @@ struct stack_t
set_error ();
}
void clear () { count = 0; }
inline void clear () { count = 0; }
bool in_error () const { return (error || elements.in_error ()); }
void set_error () { error = true; }
inline bool in_error () const { return (error || elements.in_error ()); }
inline void set_error () { error = true; }
unsigned int get_count () const { return count; }
bool is_empty () const { return count == 0; }
inline unsigned int get_count () const { return count; }
inline bool is_empty () const { return count == 0; }
static const unsigned int kSizeLimit = LIMIT;
@ -489,29 +488,29 @@ struct stack_t
template <typename ARG=number_t>
struct arg_stack_t : stack_t<ARG, 513>
{
void push_int (int v)
inline void push_int (int v)
{
ARG &n = S::push ();
n.set_int (v);
}
void push_fixed (int32_t v)
inline void push_fixed (int32_t v)
{
ARG &n = S::push ();
n.set_fixed (v);
}
void push_real (double v)
inline void push_real (double v)
{
ARG &n = S::push ();
n.set_real (v);
}
ARG& pop_num () { return this->pop (); }
inline ARG& pop_num () { return this->pop (); }
int pop_int () { return this->pop ().to_int (); }
inline int pop_int () { return this->pop ().to_int (); }
unsigned int pop_uint ()
inline unsigned int pop_uint ()
{
int i = pop_int ();
if (unlikely (i < 0))
@ -522,13 +521,13 @@ struct arg_stack_t : stack_t<ARG, 513>
return (unsigned)i;
}
void push_longint_from_substr (byte_str_ref_t& str_ref)
inline void push_longint_from_substr (byte_str_ref_t& str_ref)
{
push_int ((str_ref[0] << 24) | (str_ref[1] << 16) | (str_ref[2] << 8) | (str_ref[3]));
str_ref.inc (4);
}
bool push_fixed_from_substr (byte_str_ref_t& str_ref)
inline bool push_fixed_from_substr (byte_str_ref_t& str_ref)
{
if (unlikely (!str_ref.avail (4)))
return false;
@ -537,7 +536,7 @@ struct arg_stack_t : stack_t<ARG, 513>
return true;
}
hb_array_t<const ARG> get_subarray (unsigned int start) const
inline hb_array_t<const ARG> get_subarray (unsigned int start) const
{
return S::elements.sub_array (start);
}
@ -549,8 +548,8 @@ struct arg_stack_t : stack_t<ARG, 513>
/* an operator prefixed by its operands in a byte string */
struct op_str_t
{
void init () {}
void fini () {}
inline void init () {}
inline void fini () {}
op_code_t op;
byte_str_t str;
@ -560,7 +559,7 @@ struct op_str_t
struct op_serializer_t
{
protected:
bool copy_opstr (hb_serialize_context_t *c, const op_str_t& opstr) const
inline bool copy_opstr (hb_serialize_context_t *c, const op_str_t& opstr) const
{
TRACE_SERIALIZE (this);
@ -574,14 +573,14 @@ struct op_serializer_t
template <typename VAL>
struct parsed_values_t
{
void init ()
inline void init ()
{
opStart = 0;
values.init ();
}
void fini () { values.fini_deep (); }
inline void fini () { values.fini_deep (); }
void add_op (op_code_t op, const byte_str_ref_t& str_ref = byte_str_ref_t ())
inline void add_op (op_code_t op, const byte_str_ref_t& str_ref = byte_str_ref_t ())
{
VAL *val = values.push ();
val->op = op;
@ -589,7 +588,7 @@ struct parsed_values_t
opStart = str_ref.offset;
}
void add_op (op_code_t op, const byte_str_ref_t& str_ref, const VAL &v)
inline void add_op (op_code_t op, const byte_str_ref_t& str_ref, const VAL &v)
{
VAL *val = values.push (v);
val->op = op;
@ -597,16 +596,16 @@ struct parsed_values_t
opStart = str_ref.offset;
}
bool has_op (op_code_t op) const
inline bool has_op (op_code_t op) const
{
for (unsigned int i = 0; i < get_count (); i++)
if (get_value (i).op == op) return true;
return false;
}
unsigned get_count () const { return values.len; }
const VAL &get_value (unsigned int i) const { return values[i]; }
const VAL &operator [] (unsigned int i) const { return get_value (i); }
inline unsigned get_count () const { return values.len; }
inline const VAL &get_value (unsigned int i) const { return values[i]; }
inline const VAL &operator [] (unsigned int i) const { return get_value (i); }
unsigned int opStart;
hb_vector_t<VAL> values;
@ -615,20 +614,20 @@ struct parsed_values_t
template <typename ARG=number_t>
struct interp_env_t
{
void init (const byte_str_t &str_)
inline void init (const byte_str_t &str_)
{
str_ref.reset (str_);
argStack.init ();
error = false;
}
void fini () { argStack.fini (); }
inline void fini () { argStack.fini (); }
bool in_error () const
inline bool in_error () const
{ return error || str_ref.in_error () || argStack.in_error (); }
void set_error () { error = true; }
inline void set_error () { error = true; }
op_code_t fetch_op ()
inline op_code_t fetch_op ()
{
op_code_t op = OpCode_Invalid;
if (unlikely (!str_ref.avail ()))
@ -644,22 +643,22 @@ struct interp_env_t
return op;
}
const ARG& eval_arg (unsigned int i)
inline const ARG& eval_arg (unsigned int i)
{
return argStack[i];
}
ARG& pop_arg ()
inline ARG& pop_arg ()
{
return argStack.pop ();
}
void pop_n_args (unsigned int n)
inline void pop_n_args (unsigned int n)
{
argStack.pop (n);
}
void clear_args ()
inline void clear_args ()
{
pop_n_args (argStack.get_count ());
}
@ -675,7 +674,7 @@ typedef interp_env_t<> num_interp_env_t;
template <typename ARG=number_t>
struct opset_t
{
static void process_op (op_code_t op, interp_env_t<ARG>& env)
static inline void process_op (op_code_t op, interp_env_t<ARG>& env)
{
switch (op) {
case OpCode_shortint:
@ -713,9 +712,9 @@ struct opset_t
template <typename ENV>
struct interpreter_t {
~interpreter_t() { fini (); }
inline ~interpreter_t() { fini (); }
void fini () { env.fini (); }
inline void fini () { env.fini (); }
ENV env;
};

View File

@ -41,7 +41,7 @@ enum cs_type_t {
struct call_context_t
{
void init (const byte_str_ref_t substr_=byte_str_ref_t (), cs_type_t type_=CSType_CharString, unsigned int subr_num_=0)
inline void init (const byte_str_ref_t substr_=byte_str_ref_t (), cs_type_t type_=CSType_CharString, unsigned int subr_num_=0)
{
str_ref = substr_;
type = type_;
@ -62,7 +62,7 @@ struct call_stack_t : stack_t<call_context_t, kMaxCallLimit> {};
template <typename SUBRS>
struct biased_subrs_t
{
void init (const SUBRS &subrs_)
inline void init (const SUBRS &subrs_)
{
subrs = &subrs_;
unsigned int nSubrs = get_count ();
@ -74,12 +74,12 @@ struct biased_subrs_t
bias = 32768;
}
void fini () {}
inline void fini () {}
unsigned int get_count () const { return (subrs == nullptr)? 0: subrs->count; }
unsigned int get_bias () const { return bias; }
inline unsigned int get_count () const { return (subrs == nullptr)? 0: subrs->count; }
inline unsigned int get_bias () const { return bias; }
byte_str_t operator [] (unsigned int index) const
inline byte_str_t operator [] (unsigned int index) const
{
if (unlikely ((subrs == nullptr) || index >= subrs->count))
return Null(byte_str_t);
@ -94,22 +94,22 @@ struct biased_subrs_t
struct point_t
{
void init ()
inline void init ()
{
x.init ();
y.init ();
}
void set_int (int _x, int _y)
inline void set_int (int _x, int _y)
{
x.set_int (_x);
y.set_int (_y);
}
void move_x (const number_t &dx) { x += dx; }
void move_y (const number_t &dy) { y += dy; }
void move (const number_t &dx, const number_t &dy) { move_x (dx); move_y (dy); }
void move (const point_t &d) { move_x (d.x); move_y (d.y); }
inline void move_x (const number_t &dx) { x += dx; }
inline void move_y (const number_t &dy) { y += dy; }
inline void move (const number_t &dx, const number_t &dy) { move_x (dx); move_y (dy); }
inline void move (const point_t &d) { move_x (d.x); move_y (d.y); }
number_t x;
number_t y;
@ -118,7 +118,7 @@ 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_)
inline void init (const byte_str_t &str, const SUBRS &globalSubrs_, const SUBRS &localSubrs_)
{
interp_env_t<ARG>::init (str);
@ -132,7 +132,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
globalSubrs.init (globalSubrs_);
localSubrs.init (localSubrs_);
}
void fini ()
inline void fini ()
{
interp_env_t<ARG>::fini ();
@ -141,12 +141,12 @@ struct cs_interp_env_t : interp_env_t<ARG>
localSubrs.fini ();
}
bool in_error () const
inline bool in_error () const
{
return callStack.in_error () || SUPER::in_error ();
}
bool popSubrNum (const biased_subrs_t<SUBRS>& biasedSubrs, unsigned int &subr_num)
inline bool popSubrNum (const biased_subrs_t<SUBRS>& biasedSubrs, unsigned int &subr_num)
{
int n = SUPER::argStack.pop_int ();
n += biasedSubrs.get_bias ();
@ -157,7 +157,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
return true;
}
void callSubr (const biased_subrs_t<SUBRS>& biasedSubrs, cs_type_t type)
inline void callSubr (const biased_subrs_t<SUBRS>& biasedSubrs, cs_type_t type)
{
unsigned int subr_num;
@ -174,7 +174,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
SUPER::str_ref = context.str_ref;
}
void returnFromSubr ()
inline void returnFromSubr ()
{
if (unlikely (SUPER::str_ref.in_error ()))
SUPER::set_error ();
@ -182,7 +182,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
SUPER::str_ref = context.str_ref;
}
void determine_hintmask_size ()
inline void determine_hintmask_size ()
{
if (!seen_hintmask)
{
@ -192,14 +192,14 @@ struct cs_interp_env_t : interp_env_t<ARG>
}
}
void set_endchar (bool endchar_flag_) { endchar_flag = endchar_flag_; }
bool is_endchar () const { return endchar_flag; }
inline void set_endchar (bool endchar_flag_) { endchar_flag = endchar_flag_; }
inline bool is_endchar () const { return endchar_flag; }
const number_t &get_x () const { return pt.x; }
const number_t &get_y () const { return pt.y; }
const point_t &get_pt () const { return pt; }
inline const number_t &get_x () const { return pt.x; }
inline const number_t &get_y () const { return pt.y; }
inline const point_t &get_pt () const { return pt; }
void moveto (const point_t &pt_ ) { pt = pt_; }
inline void moveto (const point_t &pt_ ) { pt = pt_; }
public:
call_context_t context;
@ -223,32 +223,32 @@ struct cs_interp_env_t : interp_env_t<ARG>
template <typename ENV, typename PARAM>
struct path_procs_null_t
{
static void rmoveto (ENV &env, PARAM& param) {}
static void hmoveto (ENV &env, PARAM& param) {}
static void vmoveto (ENV &env, PARAM& param) {}
static void rlineto (ENV &env, PARAM& param) {}
static void hlineto (ENV &env, PARAM& param) {}
static void vlineto (ENV &env, PARAM& param) {}
static void rrcurveto (ENV &env, PARAM& param) {}
static void rcurveline (ENV &env, PARAM& param) {}
static void rlinecurve (ENV &env, PARAM& param) {}
static void vvcurveto (ENV &env, PARAM& param) {}
static void hhcurveto (ENV &env, PARAM& param) {}
static void vhcurveto (ENV &env, PARAM& param) {}
static void hvcurveto (ENV &env, PARAM& param) {}
static void moveto (ENV &env, PARAM& param, const point_t &pt) {}
static void line (ENV &env, PARAM& param, const point_t &pt1) {}
static void curve (ENV &env, PARAM& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) {}
static void hflex (ENV &env, PARAM& param) {}
static void flex (ENV &env, PARAM& param) {}
static void hflex1 (ENV &env, PARAM& param) {}
static void flex1 (ENV &env, PARAM& param) {}
static inline void rmoveto (ENV &env, PARAM& param) {}
static inline void hmoveto (ENV &env, PARAM& param) {}
static inline void vmoveto (ENV &env, PARAM& param) {}
static inline void rlineto (ENV &env, PARAM& param) {}
static inline void hlineto (ENV &env, PARAM& param) {}
static inline void vlineto (ENV &env, PARAM& param) {}
static inline void rrcurveto (ENV &env, PARAM& param) {}
static inline void rcurveline (ENV &env, PARAM& param) {}
static inline void rlinecurve (ENV &env, PARAM& param) {}
static inline void vvcurveto (ENV &env, PARAM& param) {}
static inline void hhcurveto (ENV &env, PARAM& param) {}
static inline void vhcurveto (ENV &env, PARAM& param) {}
static inline void hvcurveto (ENV &env, PARAM& param) {}
static inline void moveto (ENV &env, PARAM& param, const point_t &pt) {}
static inline void line (ENV &env, PARAM& param, const point_t &pt1) {}
static inline void curve (ENV &env, PARAM& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) {}
static inline void hflex (ENV &env, PARAM& param) {}
static inline void flex (ENV &env, PARAM& param) {}
static inline void hflex1 (ENV &env, PARAM& param) {}
static inline void flex1 (ENV &env, PARAM& param) {}
};
template <typename ARG, typename OPSET, typename ENV, typename PARAM, typename PATH=path_procs_null_t<ENV, PARAM> >
struct cs_opset_t : opset_t<ARG>
{
static void process_op (op_code_t op, ENV &env, PARAM& param)
static inline void process_op (op_code_t op, ENV &env, PARAM& param)
{
switch (op) {
@ -370,19 +370,19 @@ struct cs_opset_t : opset_t<ARG>
}
}
static void process_hstem (op_code_t op, ENV &env, PARAM& param)
static inline void process_hstem (op_code_t op, ENV &env, PARAM& param)
{
env.hstem_count += env.argStack.get_count () / 2;
OPSET::flush_args_and_op (op, env, param);
}
static void process_vstem (op_code_t op, ENV &env, PARAM& param)
static inline void process_vstem (op_code_t op, ENV &env, PARAM& param)
{
env.vstem_count += env.argStack.get_count () / 2;
OPSET::flush_args_and_op (op, env, param);
}
static void process_hintmask (op_code_t op, ENV &env, PARAM& param)
static inline void process_hintmask (op_code_t op, ENV &env, PARAM& param)
{
env.determine_hintmask_size ();
if (likely (env.str_ref.avail (env.hintmask_size)))
@ -392,15 +392,15 @@ struct cs_opset_t : opset_t<ARG>
}
}
static void process_post_flex (op_code_t op, ENV &env, PARAM& param)
static inline void process_post_flex (op_code_t op, ENV &env, PARAM& param)
{
OPSET::flush_args_and_op (op, env, param);
}
static void check_width (op_code_t op, ENV &env, PARAM& param)
static inline void check_width (op_code_t op, ENV &env, PARAM& param)
{}
static void process_post_move (op_code_t op, ENV &env, PARAM& param)
static inline void process_post_move (op_code_t op, ENV &env, PARAM& param)
{
if (!env.seen_moveto)
{
@ -410,27 +410,27 @@ struct cs_opset_t : opset_t<ARG>
OPSET::flush_args_and_op (op, env, param);
}
static void process_post_path (op_code_t op, ENV &env, PARAM& param)
static inline void process_post_path (op_code_t op, ENV &env, PARAM& param)
{
OPSET::flush_args_and_op (op, env, param);
}
static void flush_args_and_op (op_code_t op, ENV &env, PARAM& param)
static inline void flush_args_and_op (op_code_t op, ENV &env, PARAM& param)
{
OPSET::flush_args (env, param);
OPSET::flush_op (op, env, param);
}
static void flush_args (ENV &env, PARAM& param)
static inline void flush_args (ENV &env, PARAM& param)
{
env.pop_n_args (env.argStack.get_count ());
}
static void flush_op (op_code_t op, ENV &env, PARAM& param)
static inline void flush_op (op_code_t op, ENV &env, PARAM& param)
{
}
static void flush_hintmask (op_code_t op, ENV &env, PARAM& param)
static inline void flush_hintmask (op_code_t op, ENV &env, PARAM& param)
{
OPSET::flush_args_and_op (op, env, param);
}
@ -460,7 +460,7 @@ struct cs_opset_t : opset_t<ARG>
template <typename PATH, typename ENV, typename PARAM>
struct path_procs_t
{
static void rmoveto (ENV &env, PARAM& param)
static inline void rmoveto (ENV &env, PARAM& param)
{
point_t pt1 = env.get_pt ();
const number_t &dy = env.pop_arg ();
@ -469,21 +469,21 @@ struct path_procs_t
PATH::moveto (env, param, pt1);
}
static void hmoveto (ENV &env, PARAM& param)
static inline void hmoveto (ENV &env, PARAM& param)
{
point_t pt1 = env.get_pt ();
pt1.move_x (env.pop_arg ());
PATH::moveto (env, param, pt1);
}
static void vmoveto (ENV &env, PARAM& param)
static inline void vmoveto (ENV &env, PARAM& param)
{
point_t pt1 = env.get_pt ();
pt1.move_y (env.pop_arg ());
PATH::moveto (env, param, pt1);
}
static void rlineto (ENV &env, PARAM& param)
static inline void rlineto (ENV &env, PARAM& param)
{
for (unsigned int i = 0; i + 2 <= env.argStack.get_count (); i += 2)
{
@ -493,7 +493,7 @@ struct path_procs_t
}
}
static void hlineto (ENV &env, PARAM& param)
static inline void hlineto (ENV &env, PARAM& param)
{
point_t pt1;
unsigned int i = 0;
@ -513,7 +513,7 @@ struct path_procs_t
}
}
static void vlineto (ENV &env, PARAM& param)
static inline void vlineto (ENV &env, PARAM& param)
{
point_t pt1;
unsigned int i = 0;
@ -533,7 +533,7 @@ struct path_procs_t
}
}
static void rrcurveto (ENV &env, PARAM& param)
static inline void rrcurveto (ENV &env, PARAM& param)
{
for (unsigned int i = 0; i + 6 <= env.argStack.get_count (); i += 6)
{
@ -547,7 +547,7 @@ struct path_procs_t
}
}
static void rcurveline (ENV &env, PARAM& param)
static inline void rcurveline (ENV &env, PARAM& param)
{
unsigned int i = 0;
for (; i + 6 <= env.argStack.get_count (); i += 6)
@ -568,7 +568,7 @@ struct path_procs_t
}
}
static void rlinecurve (ENV &env, PARAM& param)
static inline void rlinecurve (ENV &env, PARAM& param)
{
unsigned int i = 0;
unsigned int line_limit = (env.argStack.get_count () % 6);
@ -590,7 +590,7 @@ struct path_procs_t
}
}
static void vvcurveto (ENV &env, PARAM& param)
static inline void vvcurveto (ENV &env, PARAM& param)
{
unsigned int i = 0;
point_t pt1 = env.get_pt ();
@ -608,7 +608,7 @@ struct path_procs_t
}
}
static void hhcurveto (ENV &env, PARAM& param)
static inline void hhcurveto (ENV &env, PARAM& param)
{
unsigned int i = 0;
point_t pt1 = env.get_pt ();
@ -626,7 +626,7 @@ struct path_procs_t
}
}
static void vhcurveto (ENV &env, PARAM& param)
static inline void vhcurveto (ENV &env, PARAM& param)
{
point_t pt1, pt2, pt3;
unsigned int i = 0;
@ -687,7 +687,7 @@ struct path_procs_t
}
}
static void hvcurveto (ENV &env, PARAM& param)
static inline void hvcurveto (ENV &env, PARAM& param)
{
point_t pt1, pt2, pt3;
unsigned int i = 0;
@ -749,16 +749,16 @@ struct path_procs_t
}
/* default actions to be overridden */
static void moveto (ENV &env, PARAM& param, const point_t &pt)
static inline void moveto (ENV &env, PARAM& param, const point_t &pt)
{ env.moveto (pt); }
static void line (ENV &env, PARAM& param, const point_t &pt1)
static inline void line (ENV &env, PARAM& param, const point_t &pt1)
{ PATH::moveto (env, param, pt1); }
static void curve (ENV &env, PARAM& param, const point_t &pt1, const point_t &pt2, const point_t &pt3)
static inline void curve (ENV &env, PARAM& param, const point_t &pt1, const point_t &pt2, const point_t &pt3)
{ PATH::moveto (env, param, pt3); }
static void hflex (ENV &env, PARAM& param)
static inline void hflex (ENV &env, PARAM& param)
{
if (likely (env.argStack.get_count () == 7))
{
@ -782,7 +782,7 @@ struct path_procs_t
env.set_error ();
}
static void flex (ENV &env, PARAM& param)
static inline void flex (ENV &env, PARAM& param)
{
if (likely (env.argStack.get_count () == 13))
{
@ -805,7 +805,7 @@ struct path_procs_t
env.set_error ();
}
static void hflex1 (ENV &env, PARAM& param)
static inline void hflex1 (ENV &env, PARAM& param)
{
if (likely (env.argStack.get_count () == 9))
{
@ -829,7 +829,7 @@ struct path_procs_t
env.set_error ();
}
static void flex1 (ENV &env, PARAM& param)
static inline void flex1 (ENV &env, PARAM& param)
{
if (likely (env.argStack.get_count () == 11))
{
@ -868,7 +868,7 @@ struct path_procs_t
}
protected:
static void curve2 (ENV &env, PARAM& param,
static inline void curve2 (ENV &env, PARAM& param,
const point_t &pt1, const point_t &pt2, const point_t &pt3,
const point_t &pt4, const point_t &pt5, const point_t &pt6)
{
@ -880,7 +880,7 @@ struct path_procs_t
template <typename ENV, typename OPSET, typename PARAM>
struct cs_interpreter_t : interpreter_t<ENV>
{
bool interpret (PARAM& param)
inline bool interpret (PARAM& param)
{
SUPER::env.set_endchar (false);
@ -902,3 +902,4 @@ struct cs_interpreter_t : interpreter_t<ENV>
} /* namespace CFF */
#endif /* HB_CFF_INTERP_CS_COMMON_HH */

View File

@ -37,8 +37,8 @@ using namespace OT;
/* an opstr and the parsed out dict value(s) */
struct dict_val_t : op_str_t
{
void init () { single_val.set_int (0); }
void fini () {}
inline void init () { single_val.set_int (0); }
inline void fini () {}
number_t single_val;
};
@ -50,15 +50,15 @@ template <typename VAL> struct dict_values_t : parsed_values_t<VAL> {};
template <typename OPSTR=op_str_t>
struct top_dict_values_t : dict_values_t<OPSTR>
{
void init ()
inline void init ()
{
dict_values_t<OPSTR>::init ();
charStringsOffset = 0;
FDArrayOffset = 0;
}
void fini () { dict_values_t<OPSTR>::fini (); }
inline void fini () { dict_values_t<OPSTR>::fini (); }
unsigned int calculate_serialized_op_size (const OPSTR& opstr) const
inline unsigned int calculate_serialized_op_size (const OPSTR& opstr) const
{
switch (opstr.op)
{
@ -77,7 +77,7 @@ struct top_dict_values_t : dict_values_t<OPSTR>
struct dict_opset_t : opset_t<number_t>
{
static void process_op (op_code_t op, interp_env_t<number_t>& env)
static inline void process_op (op_code_t op, interp_env_t<number_t>& env)
{
switch (op) {
case OpCode_longintdict: /* 5-byte integer */
@ -220,7 +220,7 @@ struct dict_opset_t : opset_t<number_t>
return value;
}
static bool is_hint_op (op_code_t op)
static inline bool is_hint_op (op_code_t op)
{
switch (op)
{
@ -248,7 +248,7 @@ struct dict_opset_t : opset_t<number_t>
template <typename VAL=op_str_t>
struct top_dict_opset_t : dict_opset_t
{
static void process_op (op_code_t op, interp_env_t<number_t>& env, top_dict_values_t<VAL> & dictval)
static inline void process_op (op_code_t op, interp_env_t<number_t>& env, top_dict_values_t<VAL> & dictval)
{
switch (op) {
case OpCode_CharStrings:
@ -272,7 +272,7 @@ struct top_dict_opset_t : dict_opset_t
template <typename OPSET, typename PARAM, typename ENV=num_interp_env_t>
struct dict_interpreter_t : interpreter_t<ENV>
{
bool interpret (PARAM& param)
inline bool interpret (PARAM& param)
{
param.init ();
while (SUPER::env.str_ref.avail ())

View File

@ -38,7 +38,7 @@ typedef biased_subrs_t<CFF1Subrs> cff1_biased_subrs_t;
struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs>
{
template <typename ACC>
void init (const byte_str_t &str, ACC &acc, unsigned int fd)
inline void init (const byte_str_t &str, ACC &acc, unsigned int fd)
{
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
processed_width = false;
@ -47,9 +47,9 @@ struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs>
in_seac = false;
}
void fini () { SUPER::fini (); }
inline void fini () { SUPER::fini (); }
void set_width (bool has_width_)
inline void set_width (bool has_width_)
{
if (likely (!processed_width && (SUPER::argStack.get_count () > 0)))
{
@ -63,13 +63,13 @@ struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs>
processed_width = true;
}
void clear_args ()
inline void clear_args ()
{
arg_start = 0;
SUPER::clear_args ();
}
void set_in_seac (bool _in_seac) { in_seac = _in_seac; }
inline void set_in_seac (bool _in_seac) { in_seac = _in_seac; }
bool processed_width;
bool has_width;
@ -87,7 +87,7 @@ struct cff1_cs_opset_t : cs_opset_t<number_t, OPSET, cff1_cs_interp_env_t, PARAM
/* PostScript-originated legacy opcodes (OpCode_add etc) are unsupported */
/* Type 1-originated deprecated opcodes, seac behavior of endchar and dotsection are supported */
static void process_op (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param)
static inline void process_op (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param)
{
switch (op) {
case OpCode_dotsection:
@ -109,7 +109,7 @@ struct cff1_cs_opset_t : cs_opset_t<number_t, OPSET, cff1_cs_interp_env_t, PARAM
}
}
static void check_width (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param)
static inline void check_width (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param)
{
if (!env.processed_width)
{
@ -139,11 +139,11 @@ struct cff1_cs_opset_t : cs_opset_t<number_t, OPSET, cff1_cs_interp_env_t, PARAM
}
}
static void process_seac (cff1_cs_interp_env_t &env, PARAM& param)
static inline void process_seac (cff1_cs_interp_env_t &env, PARAM& param)
{
}
static void flush_args (cff1_cs_interp_env_t &env, PARAM& param)
static inline void flush_args (cff1_cs_interp_env_t &env, PARAM& param)
{
SUPER::flush_args (env, param);
env.clear_args (); /* pop off width */

View File

@ -35,23 +35,23 @@ using namespace OT;
struct blend_arg_t : number_t
{
void init ()
inline void init ()
{
number_t::init ();
deltas.init ();
}
void fini ()
inline void fini ()
{
number_t::fini ();
deltas.fini_deep ();
}
void set_int (int v) { reset_blends (); number_t::set_int (v); }
void set_fixed (int32_t v) { reset_blends (); number_t::set_fixed (v); }
void set_real (double v) { reset_blends (); number_t::set_real (v); }
inline void set_int (int v) { reset_blends (); number_t::set_int (v); }
inline void set_fixed (int32_t v) { reset_blends (); number_t::set_fixed (v); }
inline void set_real (double v) { reset_blends (); number_t::set_real (v); }
void set_blends (unsigned int numValues_, unsigned int valueIndex_,
inline void set_blends (unsigned int numValues_, unsigned int valueIndex_,
unsigned int numBlends, hb_array_t<const blend_arg_t> blends_)
{
numValues = numValues_;
@ -61,8 +61,8 @@ struct blend_arg_t : number_t
deltas[i] = blends_[i];
}
bool blending () const { return deltas.len > 0; }
void reset_blends ()
inline bool blending () const { return deltas.len > 0; }
inline void reset_blends ()
{
numValues = valueIndex = 0;
deltas.resize (0);
@ -79,7 +79,7 @@ typedef biased_subrs_t<CFF2Subrs> cff2_biased_subrs_t;
struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
{
template <typename ACC>
void init (const byte_str_t &str, ACC &acc, unsigned int fd,
inline void init (const byte_str_t &str, ACC &acc, unsigned int fd,
const int *coords_=nullptr, unsigned int num_coords_=0)
{
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
@ -90,17 +90,17 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
seen_blend = false;
seen_vsindex_ = false;
scalars.init ();
do_blend = (coords != nullptr) && num_coords && (varStore != &Null(CFF2VariationStore));
do_blend = (coords != nullptr) && num_coords && (varStore != &Null(cff2_variation_store_t));
set_ivs (acc.privateDicts[fd].ivs);
}
void fini ()
inline void fini ()
{
scalars.fini ();
SUPER::fini ();
}
op_code_t fetch_op ()
inline op_code_t fetch_op ()
{
if (this->str_ref.avail ())
return SUPER::fetch_op ();
@ -112,21 +112,21 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
return OpCode_return;
}
const blend_arg_t& eval_arg (unsigned int i)
inline const blend_arg_t& eval_arg (unsigned int i)
{
blend_arg_t &arg = argStack[i];
blend_arg (arg);
return arg;
}
const blend_arg_t& pop_arg ()
inline const blend_arg_t& pop_arg ()
{
blend_arg_t &arg = argStack.pop ();
blend_arg (arg);
return arg;
}
void process_blend ()
inline void process_blend ()
{
if (!seen_blend)
{
@ -142,7 +142,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
}
}
void process_vsindex ()
inline void process_vsindex ()
{
unsigned int index = argStack.pop_uint ();
if (unlikely (seen_vsindex () || seen_blend))
@ -156,14 +156,14 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
seen_vsindex_ = true;
}
unsigned int get_region_count () const { return region_count; }
void set_region_count (unsigned int region_count_) { region_count = region_count_; }
unsigned int get_ivs () const { return ivs; }
void set_ivs (unsigned int ivs_) { ivs = ivs_; }
bool seen_vsindex () const { return seen_vsindex_; }
inline unsigned int get_region_count () const { return region_count; }
inline void set_region_count (unsigned int region_count_) { region_count = region_count_; }
inline unsigned int get_ivs () const { return ivs; }
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
inline bool seen_vsindex () const { return seen_vsindex_; }
protected:
void blend_arg (blend_arg_t &arg)
inline void blend_arg (blend_arg_t &arg)
{
if (do_blend && arg.blending ())
{
@ -183,7 +183,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
protected:
const int *coords;
unsigned int num_coords;
const CFF2VariationStore *varStore;
const cff2_variation_store_t *varStore;
unsigned int region_count;
unsigned int ivs;
hb_vector_t<float> scalars;
@ -196,7 +196,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
template <typename OPSET, typename PARAM, typename PATH=path_procs_null_t<cff2_cs_interp_env_t, PARAM> >
struct cff2_cs_opset_t : cs_opset_t<blend_arg_t, OPSET, cff2_cs_interp_env_t, PARAM, PATH>
{
static void process_op (op_code_t op, cff2_cs_interp_env_t &env, PARAM& param)
static inline void process_op (op_code_t op, cff2_cs_interp_env_t &env, PARAM& param)
{
switch (op) {
case OpCode_callsubr:
@ -228,7 +228,7 @@ struct cff2_cs_opset_t : cs_opset_t<blend_arg_t, OPSET, cff2_cs_interp_env_t, PA
}
}
static void process_blend (cff2_cs_interp_env_t &env, PARAM& param)
static inline void process_blend (cff2_cs_interp_env_t &env, PARAM& param)
{
unsigned int n, k;
@ -253,7 +253,7 @@ struct cff2_cs_opset_t : cs_opset_t<blend_arg_t, OPSET, cff2_cs_interp_env_t, PA
env.argStack.pop (k * n);
}
static void process_vsindex (cff2_cs_interp_env_t &env, PARAM& param)
static inline void process_vsindex (cff2_cs_interp_env_t &env, PARAM& param)
{
env.process_vsindex ();
env.clear_args ();

View File

@ -64,9 +64,9 @@ struct code_pair_t
typedef hb_vector_t<unsigned char, 1> str_buff_t;
struct str_buff_vec_t : hb_vector_t<str_buff_t>
{
void fini () { SUPER::fini_deep (); }
inline void fini () { SUPER::fini_deep (); }
unsigned int total_size () const
inline unsigned int total_size () const
{
unsigned int size = 0;
for (unsigned int i = 0; i < len; i++)
@ -82,7 +82,7 @@ struct str_buff_vec_t : hb_vector_t<str_buff_t>
template <typename COUNT>
struct CFFIndex
{
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely ((count.sanitize (c) && count == 0) || /* empty INDEX */
@ -91,13 +91,13 @@ struct CFFIndex
c->check_array ((const HBUINT8*)data_base (), 1, max_offset () - 1))));
}
static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count)
static inline unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count)
{ return offSize * (count + 1); }
unsigned int offset_array_size () const
inline unsigned int offset_array_size () const
{ return calculate_offset_array_size (offSize, count); }
static unsigned int calculate_serialized_size (unsigned int offSize, unsigned int count, unsigned int dataSize)
static inline unsigned int calculate_serialized_size (unsigned int offSize, unsigned int count, unsigned int dataSize)
{
if (count == 0)
return COUNT::static_size;
@ -105,7 +105,7 @@ struct CFFIndex
return min_size + calculate_offset_array_size (offSize, count) + dataSize;
}
bool serialize (hb_serialize_context_t *c, const CFFIndex &src)
inline bool serialize (hb_serialize_context_t *c, const CFFIndex &src)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size ();
@ -115,7 +115,7 @@ struct CFFIndex
return_trace (true);
}
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const byte_str_array_t &byteArray)
{
@ -158,7 +158,7 @@ struct CFFIndex
return_trace (true);
}
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const str_buff_vec_t &buffArray)
{
@ -174,7 +174,7 @@ struct CFFIndex
return result;
}
void set_offset_at (unsigned int index, unsigned int offset)
inline void set_offset_at (unsigned int index, unsigned int offset)
{
HBUINT8 *p = offsets + offSize * index + offSize;
unsigned int size = offSize;
@ -186,7 +186,7 @@ struct CFFIndex
}
}
unsigned int offset_at (unsigned int index) const
inline unsigned int offset_at (unsigned int index) const
{
assert (index <= count);
const HBUINT8 *p = offsets + offSize * index;
@ -197,7 +197,7 @@ struct CFFIndex
return offset;
}
unsigned int length_at (unsigned int index) const
inline unsigned int length_at (unsigned int index) const
{
if (likely ((offset_at (index + 1) >= offset_at (index)) &&
(offset_at (index + 1) <= offset_at (count))))
@ -206,12 +206,12 @@ struct CFFIndex
return 0;
}
const unsigned char *data_base () const
inline const unsigned char *data_base () const
{ return (const unsigned char *)this + min_size + offset_array_size (); }
unsigned int data_size () const { return HBINT8::static_size; }
byte_str_t operator [] (unsigned int index) const
inline byte_str_t operator [] (unsigned int index) const
{
if (likely (index < count))
return byte_str_t (data_base () + offset_at (index) - 1, length_at (index));
@ -219,7 +219,7 @@ struct CFFIndex
return Null(byte_str_t);
}
unsigned int get_size () const
inline unsigned int get_size () const
{
if (this != &Null(CFFIndex))
{
@ -233,7 +233,7 @@ struct CFFIndex
}
protected:
unsigned int max_offset () const
inline unsigned int max_offset () const
{
unsigned int max = 0;
for (unsigned int i = 0; i < count + 1u; i++)
@ -256,7 +256,7 @@ struct CFFIndex
template <typename COUNT, typename TYPE>
struct CFFIndexOf : CFFIndex<COUNT>
{
const byte_str_t operator [] (unsigned int index) const
inline const byte_str_t operator [] (unsigned int index) const
{
if (likely (index < CFFIndex<COUNT>::count))
return byte_str_t (CFFIndex<COUNT>::data_base () + CFFIndex<COUNT>::offset_at (index) - 1, CFFIndex<COUNT>::length_at (index));
@ -264,7 +264,7 @@ struct CFFIndexOf : CFFIndex<COUNT>
}
template <typename DATA, typename PARAM1, typename PARAM2>
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const DATA *dataArray,
unsigned int dataArrayLen,
@ -303,7 +303,7 @@ struct CFFIndexOf : CFFIndex<COUNT>
/* in parallel to above */
template <typename DATA, typename PARAM>
static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
static inline unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const DATA *dataArray,
unsigned int dataArrayLen,
hb_vector_t<unsigned int> &dataSizeArray, /* OUT */
@ -327,7 +327,7 @@ struct CFFIndexOf : CFFIndex<COUNT>
struct Dict : UnsizedByteStr
{
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
@ -343,7 +343,7 @@ struct Dict : UnsizedByteStr
/* in parallel to above */
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
static unsigned int calculate_serialized_size (const DICTVAL &dictval,
static inline unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
{
@ -354,7 +354,7 @@ struct Dict : UnsizedByteStr
}
template <typename DICTVAL, typename OP_SERIALIZER>
static unsigned int calculate_serialized_size (const DICTVAL &dictval,
static inline unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr)
{
unsigned int size = 0;
@ -364,7 +364,7 @@ struct Dict : UnsizedByteStr
}
template <typename INTTYPE, int minVal, int maxVal>
static bool serialize_int_op (hb_serialize_context_t *c, op_code_t op, int value, op_code_t intOp)
static inline bool serialize_int_op (hb_serialize_context_t *c, op_code_t op, int value, op_code_t intOp)
{
// XXX: not sure why but LLVM fails to compile the following 'unlikely' macro invocation
if (/*unlikely*/ (!serialize_int<INTTYPE, minVal, maxVal> (c, intOp, value)))
@ -384,18 +384,18 @@ struct Dict : UnsizedByteStr
return_trace (true);
}
static bool serialize_uint4_op (hb_serialize_context_t *c, op_code_t op, int value)
static inline bool serialize_uint4_op (hb_serialize_context_t *c, op_code_t op, int value)
{ return serialize_int_op<HBUINT32, 0, 0x7FFFFFFF> (c, op, value, OpCode_longintdict); }
static bool serialize_uint2_op (hb_serialize_context_t *c, op_code_t op, int value)
static inline bool serialize_uint2_op (hb_serialize_context_t *c, op_code_t op, int value)
{ return serialize_int_op<HBUINT16, 0, 0x7FFF> (c, op, value, OpCode_shortint); }
static bool serialize_offset4_op (hb_serialize_context_t *c, op_code_t op, int value)
static inline bool serialize_offset4_op (hb_serialize_context_t *c, op_code_t op, int value)
{
return serialize_uint4_op (c, op, value);
}
static bool serialize_offset2_op (hb_serialize_context_t *c, op_code_t op, int value)
static inline bool serialize_offset2_op (hb_serialize_context_t *c, op_code_t op, int value)
{
return serialize_uint2_op (c, op, value);
}
@ -407,7 +407,7 @@ struct PrivateDict : Dict {};
struct table_info_t
{
void init () { offSize = offset = size = 0; }
inline void init () { offSize = offset = size = 0; }
unsigned int offset;
unsigned int size;
@ -418,11 +418,11 @@ struct table_info_t
* set to CFF_UNDEF_CODE if excluded from subset */
struct remap_t : hb_vector_t<hb_codepoint_t>
{
void init () { SUPER::init (); }
inline void init () { SUPER::init (); }
void fini () { SUPER::fini (); }
inline void fini () { SUPER::fini (); }
bool reset (unsigned int size)
inline bool reset (unsigned int size)
{
if (unlikely (!SUPER::resize (size)))
return false;
@ -432,7 +432,7 @@ struct remap_t : hb_vector_t<hb_codepoint_t>
return true;
}
bool identity (unsigned int size)
inline bool identity (unsigned int size)
{
if (unlikely (!SUPER::resize (size)))
return false;
@ -443,20 +443,20 @@ struct remap_t : hb_vector_t<hb_codepoint_t>
return true;
}
bool excludes (hb_codepoint_t id) const
inline bool excludes (hb_codepoint_t id) const
{ return (id < len) && ((*this)[id] == CFF_UNDEF_CODE); }
bool includes (hb_codepoint_t id) const
inline bool includes (hb_codepoint_t id) const
{ return !excludes (id); }
unsigned int add (unsigned int i)
inline unsigned int add (unsigned int i)
{
if ((*this)[i] == CFF_UNDEF_CODE)
(*this)[i] = count++;
return (*this)[i];
}
hb_codepoint_t get_count () const { return count; }
inline hb_codepoint_t get_count () const { return count; }
protected:
hb_codepoint_t count;
@ -470,7 +470,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
{
/* used by CFF1 */
template <typename DICTVAL, typename OP_SERIALIZER>
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
OP_SERIALIZER& opszr)
@ -504,7 +504,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* used by CFF2 */
template <typename DICTVAL, typename OP_SERIALIZER>
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
@ -543,7 +543,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* in parallel to above */
template <typename OP_SERIALIZER, typename DICTVAL>
static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
static inline unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const remap_t &fdmap,
@ -561,7 +561,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* FDSelect */
struct FDSelect0 {
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this))))
@ -573,12 +573,12 @@ struct FDSelect0 {
return_trace (true);
}
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
return (hb_codepoint_t)fds[glyph];
}
unsigned int get_size (unsigned int num_glyphs) const
inline unsigned int get_size (unsigned int num_glyphs) const
{ return HBUINT8::static_size * num_glyphs; }
HBUINT8 fds[VAR];
@ -588,7 +588,7 @@ struct FDSelect0 {
template <typename GID_TYPE, typename FD_TYPE>
struct FDSelect3_4_Range {
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) && (first < c->get_num_glyphs ()) && (fd < fdcount)));
@ -602,10 +602,10 @@ struct FDSelect3_4_Range {
template <typename GID_TYPE, typename FD_TYPE>
struct FDSelect3_4 {
unsigned int get_size () const
inline unsigned int get_size () const
{ return GID_TYPE::static_size * 2 + FDSelect3_4_Range<GID_TYPE, FD_TYPE>::static_size * nRanges; }
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this) && (nRanges > 0) && (ranges[0].first == 0))))
@ -624,7 +624,7 @@ struct FDSelect3_4 {
return_trace (true);
}
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
unsigned int i;
for (i = 1; i < nRanges; i++)
@ -634,8 +634,8 @@ struct FDSelect3_4 {
return (hb_codepoint_t)ranges[i - 1].fd;
}
GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
inline GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
inline const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
GID_TYPE nRanges;
FDSelect3_4_Range<GID_TYPE, FD_TYPE> ranges[VAR];
@ -648,7 +648,7 @@ typedef FDSelect3_4<HBUINT16, HBUINT8> FDSelect3;
typedef FDSelect3_4_Range<HBUINT16, HBUINT8> FDSelect3_Range;
struct FDSelect {
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
@ -658,7 +658,7 @@ struct FDSelect {
u.format3.sanitize (c, fdcount)));
}
bool serialize (hb_serialize_context_t *c, const FDSelect &src, unsigned int num_glyphs)
inline bool serialize (hb_serialize_context_t *c, const FDSelect &src, unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size (num_glyphs);
@ -668,10 +668,10 @@ struct FDSelect {
return_trace (true);
}
unsigned int calculate_serialized_size (unsigned int num_glyphs) const
inline unsigned int calculate_serialized_size (unsigned int num_glyphs) const
{ return get_size (num_glyphs); }
unsigned int get_size (unsigned int num_glyphs) const
inline unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = format.static_size;
if (format == 0)
@ -681,7 +681,7 @@ struct FDSelect {
return size;
}
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
if (this == &Null(FDSelect))
return 0;

View File

@ -163,13 +163,13 @@ hb_codepoint_t OT::cff1::lookup_standard_encoding_for_sid (hb_codepoint_t code)
struct bounds_t
{
void init ()
inline void init ()
{
min.set_int (0x7FFFFFFF, 0x7FFFFFFF);
max.set_int (-0x80000000, -0x80000000);
}
void update (const point_t &pt)
inline void update (const point_t &pt)
{
if (pt.x < min.x) min.x = pt.x;
if (pt.x > max.x) max.x = pt.x;
@ -177,7 +177,7 @@ struct bounds_t
if (pt.y > max.y) max.y = pt.y;
}
void merge (const bounds_t &b)
inline void merge (const bounds_t &b)
{
if (empty ())
*this = b;
@ -190,7 +190,7 @@ struct bounds_t
}
}
void offset (const point_t &delta)
inline void offset (const point_t &delta)
{
if (!empty ())
{
@ -199,7 +199,7 @@ struct bounds_t
}
}
bool empty () const
inline bool empty () const
{ return (min.x >= max.x) || (min.y >= max.y); }
point_t min;
@ -208,16 +208,16 @@ struct bounds_t
struct extents_param_t
{
void init (const OT::cff1::accelerator_t *_cff)
inline void init (const OT::cff1::accelerator_t *_cff)
{
path_open = false;
cff = _cff;
bounds.init ();
}
void start_path () { path_open = true; }
void end_path () { path_open = false; }
bool is_path_open () const { return path_open; }
inline void start_path () { path_open = true; }
inline void end_path () { path_open = false; }
inline bool is_path_open () const { return path_open; }
bool path_open;
bounds_t bounds;
@ -227,13 +227,13 @@ struct extents_param_t
struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_cs_interp_env_t, extents_param_t>
{
static void moveto (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt)
static inline void moveto (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt)
{
param.end_path ();
env.moveto (pt);
}
static void line (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1)
static inline void line (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1)
{
if (!param.is_path_open ())
{
@ -244,7 +244,7 @@ struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_
param.bounds.update (env.get_pt ());
}
static void curve (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3)
static inline void curve (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3)
{
if (!param.is_path_open ())
{
@ -259,11 +259,11 @@ struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_
}
};
static bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, bounds_t &bounds, bool in_seac=false);
static inline bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, bounds_t &bounds, bool in_seac=false);
struct cff1_cs_opset_extents_t : cff1_cs_opset_t<cff1_cs_opset_extents_t, extents_param_t, cff1_path_procs_extents_t>
{
static void process_seac (cff1_cs_interp_env_t &env, extents_param_t& param)
static inline void process_seac (cff1_cs_interp_env_t &env, extents_param_t& param)
{
unsigned int n = env.argStack.get_count ();
point_t delta;
@ -286,7 +286,7 @@ struct cff1_cs_opset_extents_t : cff1_cs_opset_t<cff1_cs_opset_extents_t, extent
}
};
bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, bounds_t &bounds, bool in_seac)
static inline bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, bounds_t &bounds, bool in_seac)
{
bounds.init ();
if (unlikely (!cff->is_valid () || (glyph >= cff->num_glyphs))) return false;
@ -336,14 +336,14 @@ bool OT::cff1::accelerator_t::get_extents (hb_codepoint_t glyph, hb_glyph_extent
struct get_seac_param_t
{
void init (const OT::cff1::accelerator_t *_cff)
inline void init (const OT::cff1::accelerator_t *_cff)
{
cff = _cff;
base = 0;
accent = 0;
}
bool has_seac () const { return base && accent; }
inline bool has_seac () const { return base && accent; }
const OT::cff1::accelerator_t *cff;
hb_codepoint_t base;
@ -352,7 +352,7 @@ struct get_seac_param_t
struct cff1_cs_opset_seac_t : cff1_cs_opset_t<cff1_cs_opset_seac_t, get_seac_param_t>
{
static void process_seac (cff1_cs_interp_env_t &env, get_seac_param_t& param)
static inline void process_seac (cff1_cs_interp_env_t &env, get_seac_param_t& param)
{
unsigned int n = env.argStack.get_count ();
hb_codepoint_t base_char = (hb_codepoint_t)env.argStack[n-2].to_int ();

View File

@ -56,13 +56,13 @@ struct CFF1FDSelect : FDSelect {};
/* Encoding */
struct Encoding0 {
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && codes[nCodes - 1].sanitize (c));
}
hb_codepoint_t get_code (hb_codepoint_t glyph) const
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
assert (glyph > 0);
glyph--;
@ -74,7 +74,7 @@ struct Encoding0 {
return CFF_UNDEF_CODE;
}
unsigned int get_size () const
inline unsigned int get_size () const
{ return HBUINT8::static_size * (nCodes + 1); }
HBUINT8 nCodes;
@ -84,7 +84,7 @@ struct Encoding0 {
};
struct Encoding1_Range {
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -97,16 +97,16 @@ struct Encoding1_Range {
};
struct Encoding1 {
unsigned int get_size () const
inline unsigned int get_size () const
{ return HBUINT8::static_size + Encoding1_Range::static_size * nRanges; }
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && ((nRanges == 0) || (ranges[nRanges - 1]).sanitize (c)));
}
hb_codepoint_t get_code (hb_codepoint_t glyph) const
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
assert (glyph > 0);
glyph--;
@ -128,7 +128,7 @@ struct Encoding1 {
};
struct SuppEncoding {
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -141,20 +141,20 @@ struct SuppEncoding {
};
struct CFF1SuppEncData {
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && ((nSups == 0) || (supps[nSups - 1]).sanitize (c)));
}
void get_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
inline void get_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
{
for (unsigned int i = 0; i < nSups; i++)
if (sid == supps[i].glyph)
codes.push (supps[i].code);
}
unsigned int get_size () const
inline unsigned int get_size () const
{ return HBUINT8::static_size + SuppEncoding::static_size * nSups; }
HBUINT8 nSups;
@ -164,7 +164,7 @@ struct CFF1SuppEncData {
};
struct Encoding {
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -179,7 +179,7 @@ struct Encoding {
}
/* serialize a fullset Encoding */
bool serialize (hb_serialize_context_t *c, const Encoding &src)
inline bool serialize (hb_serialize_context_t *c, const Encoding &src)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size ();
@ -190,7 +190,7 @@ struct Encoding {
}
/* serialize a subset Encoding */
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int enc_count,
const hb_vector_t<code_pair_t>& code_ranges,
@ -243,7 +243,7 @@ struct Encoding {
}
/* parallel to above: calculate the size of a subset Encoding */
static unsigned int calculate_serialized_size (uint8_t format,
static inline unsigned int calculate_serialized_size (uint8_t format,
unsigned int enc_count,
unsigned int supp_count)
{
@ -257,7 +257,7 @@ struct Encoding {
return size;
}
unsigned int get_size () const
inline unsigned int get_size () const
{
unsigned int size = min_size;
if (table_format () == 0)
@ -269,7 +269,7 @@ struct Encoding {
return size;
}
hb_codepoint_t get_code (hb_codepoint_t glyph) const
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
if (table_format () == 0)
return u.format0.get_code (glyph);
@ -277,10 +277,10 @@ struct Encoding {
return u.format1.get_code (glyph);
}
uint8_t table_format () const { return (format & 0x7F); }
bool has_supplement () const { return (format & 0x80) != 0; }
inline uint8_t table_format () const { return (format & 0x7F); }
inline bool has_supplement () const { return (format & 0x80) != 0; }
void get_supplement_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
inline void get_supplement_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
{
codes.resize (0);
if (has_supplement ())
@ -288,7 +288,7 @@ struct Encoding {
}
protected:
const CFF1SuppEncData &suppEncData () const
inline const CFF1SuppEncData &suppEncData () const
{
if ((format & 0x7F) == 0)
return StructAfter<CFF1SuppEncData> (u.format0.codes[u.format0.nCodes-1]);
@ -310,13 +310,13 @@ struct Encoding {
/* Charset */
struct Charset0 {
bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
inline bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && sids[num_glyphs - 1].sanitize (c));
}
hb_codepoint_t get_sid (hb_codepoint_t glyph) const
inline hb_codepoint_t get_sid (hb_codepoint_t glyph) const
{
if (glyph == 0)
return 0;
@ -324,7 +324,7 @@ struct Charset0 {
return sids[glyph - 1];
}
hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
inline hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
{
if (sid == 0)
return 0;
@ -337,7 +337,7 @@ struct Charset0 {
return 0;
}
unsigned int get_size (unsigned int num_glyphs) const
inline unsigned int get_size (unsigned int num_glyphs) const
{
assert (num_glyphs > 0);
return HBUINT16::static_size * (num_glyphs - 1);
@ -350,7 +350,7 @@ struct Charset0 {
template <typename TYPE>
struct Charset_Range {
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -364,7 +364,7 @@ struct Charset_Range {
template <typename TYPE>
struct Charset1_2 {
bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
inline bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this)))
@ -379,7 +379,7 @@ struct Charset1_2 {
return_trace (true);
}
hb_codepoint_t get_sid (hb_codepoint_t glyph) const
inline hb_codepoint_t get_sid (hb_codepoint_t glyph) const
{
if (glyph == 0) return 0;
glyph--;
@ -393,7 +393,7 @@ struct Charset1_2 {
return 0;
}
hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
inline hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
{
if (sid == 0) return 0;
hb_codepoint_t glyph = 1;
@ -409,7 +409,7 @@ struct Charset1_2 {
return 0;
}
unsigned int get_size (unsigned int num_glyphs) const
inline unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = HBUINT8::static_size;
int glyph = (int)num_glyphs;
@ -436,7 +436,7 @@ typedef Charset_Range<HBUINT8> Charset1_Range;
typedef Charset_Range<HBUINT16> Charset2_Range;
struct Charset {
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -453,7 +453,7 @@ struct Charset {
}
/* serialize a fullset Charset */
bool serialize (hb_serialize_context_t *c, const Charset &src, unsigned int num_glyphs)
inline bool serialize (hb_serialize_context_t *c, const Charset &src, unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size (num_glyphs);
@ -464,7 +464,7 @@ struct Charset {
}
/* serialize a subset Charset */
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int num_glyphs,
const hb_vector_t<code_pair_t>& sid_ranges)
@ -513,8 +513,7 @@ struct Charset {
}
/* parallel to above: calculate the size of a subset Charset */
static unsigned int calculate_serialized_size (
uint8_t format,
static inline unsigned int calculate_serialized_size (uint8_t format,
unsigned int count)
{
unsigned int size = min_size;
@ -528,7 +527,7 @@ struct Charset {
return size;
}
unsigned int get_size (unsigned int num_glyphs) const
inline unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = min_size;
if (format == 0)
@ -540,7 +539,7 @@ struct Charset {
return size;
}
hb_codepoint_t get_sid (hb_codepoint_t glyph) const
inline hb_codepoint_t get_sid (hb_codepoint_t glyph) const
{
if (format == 0)
return u.format0.get_sid (glyph);
@ -550,7 +549,7 @@ struct Charset {
return u.format2.get_sid (glyph);
}
hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
inline hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
{
if (format == 0)
return u.format0.get_glyph (sid, num_glyphs);
@ -572,7 +571,7 @@ struct Charset {
struct CFF1StringIndex : CFF1Index
{
bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings,
inline bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings,
unsigned int offSize_, const remap_t &sidmap)
{
TRACE_SERIALIZE (this);
@ -601,7 +600,7 @@ struct CFF1StringIndex : CFF1Index
}
/* in parallel to above */
unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const remap_t &sidmap) const
inline unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const remap_t &sidmap) const
{
offSize = 0;
if ((count == 0) || (sidmap.get_count () == 0))
@ -619,7 +618,7 @@ struct CFF1StringIndex : CFF1Index
struct cff1_top_dict_interp_env_t : num_interp_env_t
{
cff1_top_dict_interp_env_t ()
inline cff1_top_dict_interp_env_t ()
: num_interp_env_t(), prev_offset(0), last_offset(0) {}
unsigned int prev_offset;
@ -645,19 +644,19 @@ struct name_dict_values_t
ValCount
};
void init ()
inline void init ()
{
for (unsigned int i = 0; i < ValCount; i++)
values[i] = CFF_UNDEF_SID;
}
unsigned int& operator[] (unsigned int i)
inline unsigned int& operator[] (unsigned int i)
{ assert (i < ValCount); return values[i]; }
unsigned int operator[] (unsigned int i) const
inline unsigned int operator[] (unsigned int i) const
{ assert (i < ValCount); return values[i]; }
static enum name_dict_val_index_t name_op_to_index (op_code_t op)
static inline enum name_dict_val_index_t name_op_to_index (op_code_t op)
{
switch (op) {
default: // can't happen - just make some compiler happy
@ -692,7 +691,7 @@ struct cff1_top_dict_val_t : op_str_t
struct cff1_top_dict_values_t : top_dict_values_t<cff1_top_dict_val_t>
{
void init ()
inline void init ()
{
top_dict_values_t<cff1_top_dict_val_t>::init ();
@ -704,9 +703,9 @@ struct cff1_top_dict_values_t : top_dict_values_t<cff1_top_dict_val_t>
FDSelectOffset = 0;
privateDictInfo.init ();
}
void fini () { top_dict_values_t<cff1_top_dict_val_t>::fini (); }
inline void fini () { top_dict_values_t<cff1_top_dict_val_t>::fini (); }
bool is_CID () const
inline bool is_CID () const
{ return nameSIDs[name_dict_values_t::registry] != CFF_UNDEF_SID; }
name_dict_values_t nameSIDs;
@ -722,7 +721,7 @@ struct cff1_top_dict_values_t : top_dict_values_t<cff1_top_dict_val_t>
struct cff1_top_dict_opset_t : top_dict_opset_t<cff1_top_dict_val_t>
{
static void process_op (op_code_t op, cff1_top_dict_interp_env_t& env, cff1_top_dict_values_t& dictval)
static inline void process_op (op_code_t op, cff1_top_dict_interp_env_t& env, cff1_top_dict_values_t& dictval)
{
cff1_top_dict_val_t val;
val.last_arg_offset = (env.last_offset-1) - dictval.opStart; /* offset to the last argument */
@ -809,13 +808,13 @@ struct cff1_top_dict_opset_t : top_dict_opset_t<cff1_top_dict_val_t>
struct cff1_font_dict_values_t : dict_values_t<op_str_t>
{
void init ()
inline void init ()
{
dict_values_t<op_str_t>::init ();
privateDictInfo.init ();
fontName = CFF_UNDEF_SID;
}
void fini () { dict_values_t<op_str_t>::fini (); }
inline void fini () { dict_values_t<op_str_t>::fini (); }
table_info_t privateDictInfo;
unsigned int fontName;
@ -823,7 +822,7 @@ struct cff1_font_dict_values_t : dict_values_t<op_str_t>
struct cff1_font_dict_opset_t : dict_opset_t
{
static void process_op (op_code_t op, num_interp_env_t& env, cff1_font_dict_values_t& dictval)
static inline void process_op (op_code_t op, num_interp_env_t& env, cff1_font_dict_values_t& dictval)
{
switch (op) {
case OpCode_FontName:
@ -855,15 +854,15 @@ struct cff1_font_dict_opset_t : dict_opset_t
template <typename VAL>
struct cff1_private_dict_values_base_t : dict_values_t<VAL>
{
void init ()
inline void init ()
{
dict_values_t<VAL>::init ();
subrsOffset = 0;
localSubrs = &Null(CFF1Subrs);
}
void fini () { dict_values_t<VAL>::fini (); }
inline void fini () { dict_values_t<VAL>::fini (); }
unsigned int calculate_serialized_size () const
inline unsigned int calculate_serialized_size () const
{
unsigned int size = 0;
for (unsigned int i = 0; i < dict_values_t<VAL>::get_count; i++)
@ -883,7 +882,7 @@ typedef cff1_private_dict_values_base_t<num_dict_val_t> cff1_private_dict_values
struct cff1_private_dict_opset_t : dict_opset_t
{
static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_t& dictval)
static inline void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_t& dictval)
{
num_dict_val_t val;
val.init ();
@ -930,7 +929,7 @@ struct cff1_private_dict_opset_t : dict_opset_t
struct cff1_private_dict_opset_subset : dict_opset_t
{
static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_subset_t& dictval)
static inline void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_subset_t& dictval)
{
switch (op) {
case OpCode_BlueValues:
@ -986,7 +985,7 @@ struct cff1
{
static const hb_tag_t tableTag = HB_OT_TAG_cff1;
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -996,7 +995,7 @@ struct cff1
template <typename PRIVOPSET, typename PRIVDICTVAL>
struct accelerator_templ_t
{
void init (hb_face_t *face)
inline void init (hb_face_t *face)
{
topDict.init ();
fontDicts.init ();
@ -1123,7 +1122,7 @@ struct cff1
}
}
void fini ()
inline void fini ()
{
sc.end_processing ();
topDict.fini ();
@ -1133,12 +1132,12 @@ struct cff1
blob = nullptr;
}
bool is_valid () const { return blob != nullptr; }
bool is_CID () const { return topDict.is_CID (); }
inline bool is_valid () const { return blob != nullptr; }
inline bool is_CID () const { return topDict.is_CID (); }
bool is_predef_charset () const { return topDict.CharsetOffset <= ExpertSubsetCharset; }
inline bool is_predef_charset () const { return topDict.CharsetOffset <= ExpertSubsetCharset; }
unsigned int std_code_to_glyph (hb_codepoint_t code) const
inline unsigned int std_code_to_glyph (hb_codepoint_t code) const
{
hb_codepoint_t sid = lookup_standard_encoding_for_sid (code);
if (unlikely (sid == CFF_UNDEF_SID))
@ -1181,7 +1180,7 @@ struct cff1
struct accelerator_subset_t : accelerator_templ_t<cff1_private_dict_opset_subset, cff1_private_dict_values_subset_t>
{
void init (hb_face_t *face)
inline void init (hb_face_t *face)
{
SUPER::init (face);
if (blob == nullptr) return;
@ -1202,9 +1201,9 @@ struct cff1
}
}
bool is_predef_encoding () const { return topDict.EncodingOffset <= ExpertEncoding; }
inline bool is_predef_encoding () const { return topDict.EncodingOffset <= ExpertEncoding; }
hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
inline hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
{
if (encoding != &Null(Encoding))
return encoding->get_code (glyph);
@ -1228,7 +1227,7 @@ struct cff1
}
}
hb_codepoint_t glyph_to_sid (hb_codepoint_t glyph) const
inline hb_codepoint_t glyph_to_sid (hb_codepoint_t glyph) const
{
if (charset != &Null(Charset))
return charset->get_sid (glyph);
@ -1259,7 +1258,7 @@ struct cff1
typedef accelerator_templ_t<cff1_private_dict_opset_subset, cff1_private_dict_values_subset_t> SUPER;
};
bool subset (hb_subset_plan_t *plan) const
inline bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *cff_prime = nullptr;

View File

@ -31,7 +31,7 @@ using namespace CFF;
struct extents_param_t
{
void init ()
inline void init ()
{
path_open = false;
min_x.set_int (0x7FFFFFFF);
@ -40,11 +40,11 @@ struct extents_param_t
max_y.set_int (-0x80000000);
}
void start_path () { path_open = true; }
void end_path () { path_open = false; }
bool is_path_open () const { return path_open; }
inline void start_path () { path_open = true; }
inline void end_path () { path_open = false; }
inline bool is_path_open () const { return path_open; }
void update_bounds (const point_t &pt)
inline void update_bounds (const point_t &pt)
{
if (pt.x < min_x) min_x = pt.x;
if (pt.x > max_x) max_x = pt.x;
@ -61,13 +61,13 @@ struct extents_param_t
struct cff2_path_procs_extents_t : path_procs_t<cff2_path_procs_extents_t, cff2_cs_interp_env_t, extents_param_t>
{
static void moveto (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt)
static inline void moveto (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt)
{
param.end_path ();
env.moveto (pt);
}
static void line (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1)
static inline void line (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1)
{
if (!param.is_path_open ())
{
@ -78,7 +78,7 @@ struct cff2_path_procs_extents_t : path_procs_t<cff2_path_procs_extents_t, cff2_
param.update_bounds (env.get_pt ());
}
static void curve (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3)
static inline void curve (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3)
{
if (!param.is_path_open ())
{

View File

@ -51,7 +51,7 @@ typedef FDSelect3_4_Range<HBUINT32, HBUINT16> FDSelect4_Range;
struct CFF2FDSelect
{
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
@ -63,7 +63,7 @@ struct CFF2FDSelect
u.format4.sanitize (c, fdcount))));
}
bool serialize (hb_serialize_context_t *c, const CFF2FDSelect &src, unsigned int num_glyphs)
inline bool serialize (hb_serialize_context_t *c, const CFF2FDSelect &src, unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size (num_glyphs);
@ -73,10 +73,10 @@ struct CFF2FDSelect
return_trace (true);
}
unsigned int calculate_serialized_size (unsigned int num_glyphs) const
inline unsigned int calculate_serialized_size (unsigned int num_glyphs) const
{ return get_size (num_glyphs); }
unsigned int get_size (unsigned int num_glyphs) const
inline unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = format.static_size;
if (format == 0)
@ -88,7 +88,7 @@ struct CFF2FDSelect
return size;
}
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
if (this == &Null(CFF2FDSelect))
return 0;
@ -110,25 +110,25 @@ struct CFF2FDSelect
DEFINE_SIZE_MIN (2);
};
struct CFF2VariationStore
struct cff2_variation_store_t
{
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)) && c->check_range (&varStore, size) && varStore.sanitize (c));
}
bool serialize (hb_serialize_context_t *c, const CFF2VariationStore *varStore)
inline bool serialize (hb_serialize_context_t *c, const cff2_variation_store_t *varStore)
{
TRACE_SERIALIZE (this);
unsigned int size_ = varStore->get_size ();
CFF2VariationStore *dest = c->allocate_size<CFF2VariationStore> (size_);
cff2_variation_store_t *dest = c->allocate_size<cff2_variation_store_t> (size_);
if (unlikely (dest == nullptr)) return_trace (false);
memcpy (dest, varStore, size_);
return_trace (true);
}
unsigned int get_size () const { return HBUINT16::static_size + size; }
inline unsigned int get_size () const { return HBUINT16::static_size + size; }
HBUINT16 size;
VariationStore varStore;
@ -138,15 +138,15 @@ struct CFF2VariationStore
struct cff2_top_dict_values_t : top_dict_values_t<>
{
void init ()
inline void init ()
{
top_dict_values_t<>::init ();
vstoreOffset = 0;
FDSelectOffset = 0;
}
void fini () { top_dict_values_t<>::fini (); }
inline void fini () { top_dict_values_t<>::fini (); }
unsigned int calculate_serialized_size () const
inline unsigned int calculate_serialized_size () const
{
unsigned int size = 0;
for (unsigned int i = 0; i < get_count (); i++)
@ -172,7 +172,7 @@ struct cff2_top_dict_values_t : top_dict_values_t<>
struct cff2_top_dict_opset_t : top_dict_opset_t<>
{
static void process_op (op_code_t op, num_interp_env_t& env, cff2_top_dict_values_t& dictval)
static inline void process_op (op_code_t op, num_interp_env_t& env, cff2_top_dict_values_t& dictval)
{
switch (op) {
case OpCode_FontMatrix:
@ -221,7 +221,7 @@ struct cff2_font_dict_values_t : dict_values_t<op_str_t>
struct cff2_font_dict_opset_t : dict_opset_t
{
static void process_op (op_code_t op, num_interp_env_t& env, cff2_font_dict_values_t& dictval)
static inline void process_op (op_code_t op, num_interp_env_t& env, cff2_font_dict_values_t& dictval)
{
switch (op) {
case OpCode_Private:
@ -304,7 +304,7 @@ struct cff2_priv_dict_interp_env_t : num_interp_env_t
struct cff2_private_dict_opset_t : dict_opset_t
{
static void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_t& dictval)
static inline void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_t& dictval)
{
num_dict_val_t val;
val.init ();
@ -354,7 +354,7 @@ struct cff2_private_dict_opset_t : dict_opset_t
struct cff2_private_dict_opset_subset_t : dict_opset_t
{
static void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_subset_t& dictval)
static inline void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_subset_t& dictval)
{
switch (op) {
case OpCode_BlueValues:
@ -410,7 +410,7 @@ struct cff2
{
static const hb_tag_t tableTag = HB_OT_TAG_cff2;
bool sanitize (hb_sanitize_context_t *c) const
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -420,7 +420,7 @@ struct cff2
template <typename PRIVOPSET, typename PRIVDICTVAL>
struct accelerator_templ_t
{
void init (hb_face_t *face)
inline void init (hb_face_t *face)
{
topDict.init ();
fontDicts.init ();
@ -447,12 +447,12 @@ struct cff2
}
globalSubrs = &StructAtOffset<CFF2Subrs> (cff2, cff2->topDict + cff2->topDictSize);
varStore = &StructAtOffsetOrNull<CFF2VariationStore> (cff2, topDict.vstoreOffset);
varStore = &StructAtOffsetOrNull<cff2_variation_store_t> (cff2, topDict.vstoreOffset);
charStrings = &StructAtOffsetOrNull<CFF2CharStrings> (cff2, topDict.charStringsOffset);
fdArray = &StructAtOffsetOrNull<CFF2FDArray> (cff2, topDict.FDArrayOffset);
fdSelect = &StructAtOffsetOrNull<CFF2FDSelect> (cff2, topDict.FDSelectOffset);
if (((varStore != &Null(CFF2VariationStore)) && unlikely (!varStore->sanitize (&sc))) ||
if (((varStore != &Null(cff2_variation_store_t)) && unlikely (!varStore->sanitize (&sc))) ||
(charStrings == &Null(CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) ||
(globalSubrs == &Null(CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) ||
(fdArray == &Null(CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) ||
@ -493,7 +493,7 @@ struct cff2
}
}
void fini ()
inline void fini ()
{
sc.end_processing ();
fontDicts.fini_deep ();
@ -502,7 +502,7 @@ struct cff2
blob = nullptr;
}
bool is_valid () const { return blob != nullptr; }
inline bool is_valid () const { return blob != nullptr; }
protected:
hb_blob_t *blob;
@ -511,7 +511,7 @@ struct cff2
public:
cff2_top_dict_values_t topDict;
const CFF2Subrs *globalSubrs;
const CFF2VariationStore *varStore;
const cff2_variation_store_t *varStore;
const CFF2CharStrings *charStrings;
const CFF2FDArray *fdArray;
const CFF2FDSelect *fdSelect;
@ -532,7 +532,7 @@ struct cff2
typedef accelerator_templ_t<cff2_private_dict_opset_subset_t, cff2_private_dict_values_subset_t> accelerator_subset_t;
bool subset (hb_subset_plan_t *plan) const
inline bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *cff2_prime = nullptr;

View File

@ -37,18 +37,18 @@ namespace CFF {
/* Used for writing a temporary charstring */
struct str_encoder_t
{
str_encoder_t (str_buff_t &buff_)
inline str_encoder_t (str_buff_t &buff_)
: buff (buff_), error (false) {}
void reset () { buff.resize (0); }
inline void reset () { buff.resize (0); }
void encode_byte (unsigned char b)
inline void encode_byte (unsigned char b)
{
if (unlikely (buff.push (b) == &Crap(unsigned char)))
set_error ();
}
void encode_int (int v)
inline void encode_int (int v)
{
if ((-1131 <= v) && (v <= 1131))
{
@ -79,7 +79,7 @@ struct str_encoder_t
}
}
void encode_num (const number_t& n)
inline void encode_num (const number_t& n)
{
if (n.in_int_range ())
{
@ -96,7 +96,7 @@ struct str_encoder_t
}
}
void encode_op (op_code_t op)
inline void encode_op (op_code_t op)
{
if (Is_OpCode_ESC (op))
{
@ -107,7 +107,7 @@ struct str_encoder_t
encode_byte (op);
}
void copy_str (const byte_str_t &str)
inline void copy_str (const byte_str_t &str)
{
unsigned int offset = buff.len;
buff.resize (offset + str.len);
@ -119,17 +119,17 @@ struct str_encoder_t
memcpy (&buff[offset], &str[0], str.len);
}
bool is_error () const { return error; }
inline bool is_error () const { return error; }
protected:
void set_error () { error = true; }
inline void set_error () { error = true; }
str_buff_t &buff;
bool error;
};
struct cff_sub_table_offsets_t {
cff_sub_table_offsets_t () : privateDictsOffset (0)
inline cff_sub_table_offsets_t () : privateDictsOffset (0)
{
topDictInfo.init ();
FDSelectInfo.init ();
@ -139,7 +139,7 @@ struct cff_sub_table_offsets_t {
localSubrsInfos.init ();
}
~cff_sub_table_offsets_t () { localSubrsInfos.fini (); }
inline ~cff_sub_table_offsets_t () { localSubrsInfos.fini (); }
table_info_t topDictInfo;
table_info_t FDSelectInfo;
@ -153,7 +153,7 @@ struct cff_sub_table_offsets_t {
template <typename OPSTR=op_str_t>
struct cff_top_dict_op_serializer_t : op_serializer_t
{
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
const OPSTR &opstr,
const cff_sub_table_offsets_t &offsets) const
{
@ -176,7 +176,7 @@ struct cff_top_dict_op_serializer_t : op_serializer_t
return_trace (true);
}
unsigned int calculate_serialized_size (const OPSTR &opstr) const
inline unsigned int calculate_serialized_size (const OPSTR &opstr) const
{
switch (opstr.op)
{
@ -193,7 +193,7 @@ struct cff_top_dict_op_serializer_t : op_serializer_t
struct cff_font_dict_op_serializer_t : op_serializer_t
{
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
const op_str_t &opstr,
const table_info_t &privateDictInfo) const
{
@ -222,7 +222,7 @@ struct cff_font_dict_op_serializer_t : op_serializer_t
return_trace (true);
}
unsigned int calculate_serialized_size (const op_str_t &opstr) const
inline unsigned int calculate_serialized_size (const op_str_t &opstr) const
{
if (opstr.op == OpCode_Private)
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Private);
@ -233,10 +233,10 @@ struct cff_font_dict_op_serializer_t : op_serializer_t
struct cff_private_dict_op_serializer_t : op_serializer_t
{
cff_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_)
inline cff_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_)
: desubroutinize (desubroutinize_), drop_hints (drop_hints_) {}
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
const op_str_t &opstr,
const unsigned int subrsOffset) const
{
@ -255,7 +255,7 @@ struct cff_private_dict_op_serializer_t : op_serializer_t
return_trace (copy_opstr (c, opstr));
}
unsigned int calculate_serialized_size (const op_str_t &opstr,
inline unsigned int calculate_serialized_size (const op_str_t &opstr,
bool has_localsubr=true) const
{
if (drop_hints && dict_opset_t::is_hint_op (opstr.op))
@ -285,7 +285,7 @@ struct flatten_param_t
template <typename ACC, typename ENV, typename OPSET>
struct subr_flattener_t
{
subr_flattener_t (const ACC &acc_,
inline subr_flattener_t (const ACC &acc_,
const hb_vector_t<hb_codepoint_t> &glyphs_,
bool drop_hints_)
: acc (acc_),
@ -293,7 +293,7 @@ struct subr_flattener_t
drop_hints (drop_hints_)
{}
bool flatten (str_buff_vec_t &flat_charstrings)
inline bool flatten (str_buff_vec_t &flat_charstrings)
{
if (!flat_charstrings.resize (glyphs.len))
return false;
@ -322,10 +322,10 @@ struct subr_flattener_t
struct subr_closures_t
{
subr_closures_t () : valid (false), global_closure (nullptr)
inline subr_closures_t () : valid (false), global_closure (nullptr)
{ local_closures.init (); }
void init (unsigned int fd_count)
inline void init (unsigned int fd_count)
{
valid = true;
global_closure = hb_set_create ();
@ -342,7 +342,7 @@ struct subr_closures_t
}
}
void fini ()
inline void fini ()
{
hb_set_destroy (global_closure);
for (unsigned int i = 0; i < local_closures.len; i++)
@ -365,7 +365,7 @@ struct subr_closures_t
struct parsed_cs_op_t : op_str_t
{
void init (unsigned int subr_num_ = 0)
inline void init (unsigned int subr_num_ = 0)
{
op_str_t::init ();
subr_num = subr_num_;
@ -374,16 +374,16 @@ struct parsed_cs_op_t : op_str_t
skip_flag = false;
}
void fini () { op_str_t::fini (); }
inline void fini () { op_str_t::fini (); }
bool for_drop () const { return drop_flag; }
void set_drop () { if (!for_keep ()) drop_flag = true; }
inline bool for_drop () const { return drop_flag; }
inline void set_drop () { if (!for_keep ()) drop_flag = true; }
bool for_keep () const { return keep_flag; }
void set_keep () { keep_flag = true; }
inline bool for_keep () const { return keep_flag; }
inline void set_keep () { keep_flag = true; }
bool for_skip () const { return skip_flag; }
void set_skip () { skip_flag = true; }
inline bool for_skip () const { return skip_flag; }
inline void set_skip () { skip_flag = true; }
unsigned int subr_num;

View File

@ -36,7 +36,7 @@ using namespace CFF;
struct remap_sid_t : remap_t
{
unsigned int add (unsigned int sid)
inline unsigned int add (unsigned int sid)
{
if ((sid != CFF_UNDEF_SID) && !is_std_std (sid))
return offset_sid (remap_t::add (unoffset_sid (sid)));
@ -44,7 +44,7 @@ struct remap_sid_t : remap_t
return sid;
}
unsigned int operator[] (unsigned int sid) const
inline unsigned int operator[] (unsigned int sid) const
{
if (is_std_std (sid) || (sid == CFF_UNDEF_SID))
return sid;
@ -54,14 +54,14 @@ struct remap_sid_t : remap_t
static const unsigned int num_std_strings = 391;
static bool is_std_std (unsigned int sid) { return sid < num_std_strings; }
static unsigned int offset_sid (unsigned int sid) { return sid + num_std_strings; }
static unsigned int unoffset_sid (unsigned int sid) { return sid - num_std_strings; }
static inline bool is_std_std (unsigned int sid) { return sid < num_std_strings; }
static inline unsigned int offset_sid (unsigned int sid) { return sid + num_std_strings; }
static inline unsigned int unoffset_sid (unsigned int sid) { return sid - num_std_strings; }
};
struct cff1_sub_table_offsets_t : cff_sub_table_offsets_t
{
cff1_sub_table_offsets_t ()
inline cff1_sub_table_offsets_t ()
: cff_sub_table_offsets_t (),
nameIndexOffset (0),
encodingOffset (0)
@ -81,25 +81,25 @@ struct cff1_sub_table_offsets_t : cff_sub_table_offsets_t
/* a copy of a parsed out cff1_top_dict_values_t augmented with additional operators */
struct cff1_top_dict_values_mod_t : cff1_top_dict_values_t
{
void init (const cff1_top_dict_values_t *base_= &Null(cff1_top_dict_values_t))
inline void init (const cff1_top_dict_values_t *base_= &Null(cff1_top_dict_values_t))
{
SUPER::init ();
base = base_;
}
void fini () { SUPER::fini (); }
inline void fini () { SUPER::fini (); }
unsigned get_count () const { return base->get_count () + SUPER::get_count (); }
const cff1_top_dict_val_t &get_value (unsigned int i) const
inline unsigned get_count () const { return base->get_count () + SUPER::get_count (); }
inline const cff1_top_dict_val_t &get_value (unsigned int i) const
{
if (i < base->get_count ())
return (*base)[i];
else
return SUPER::values[i - base->get_count ()];
}
const cff1_top_dict_val_t &operator [] (unsigned int i) const { return get_value (i); }
inline const cff1_top_dict_val_t &operator [] (unsigned int i) const { return get_value (i); }
void reassignSIDs (const remap_sid_t& sidmap)
inline void reassignSIDs (const remap_sid_t& sidmap)
{
for (unsigned int i = 0; i < name_dict_values_t::ValCount; i++)
nameSIDs[i] = sidmap[base->nameSIDs[i]];
@ -124,7 +124,7 @@ struct top_dict_modifiers_t
struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dict_val_t>
{
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
const cff1_top_dict_val_t &opstr,
const top_dict_modifiers_t &mod) const
{
@ -181,7 +181,7 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dic
return_trace (true);
}
unsigned int calculate_serialized_size (const cff1_top_dict_val_t &opstr) const
inline unsigned int calculate_serialized_size (const cff1_top_dict_val_t &opstr) const
{
op_code_t op = opstr.op;
switch (op)
@ -215,7 +215,7 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dic
struct font_dict_values_mod_t
{
void init (const cff1_font_dict_values_t *base_,
inline void init (const cff1_font_dict_values_t *base_,
unsigned int fontName_,
const table_info_t &privateDictInfo_)
{
@ -224,9 +224,9 @@ struct font_dict_values_mod_t
privateDictInfo = privateDictInfo_;
}
unsigned get_count () const { return base->get_count (); }
inline unsigned get_count () const { return base->get_count (); }
const op_str_t &operator [] (unsigned int i) const { return (*base)[i]; }
inline const op_str_t &operator [] (unsigned int i) const { return (*base)[i]; }
const cff1_font_dict_values_t *base;
table_info_t privateDictInfo;
@ -235,7 +235,7 @@ struct font_dict_values_mod_t
struct cff1_font_dict_op_serializer_t : cff_font_dict_op_serializer_t
{
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
const op_str_t &opstr,
const font_dict_values_mod_t &mod) const
{
@ -247,7 +247,7 @@ struct cff1_font_dict_op_serializer_t : cff_font_dict_op_serializer_t
return_trace (SUPER::serialize (c, opstr, mod.privateDictInfo));
}
unsigned int calculate_serialized_size (const op_str_t &opstr) const
inline unsigned int calculate_serialized_size (const op_str_t &opstr) const
{
if (opstr.op == OpCode_FontName)
return OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_FontName);
@ -261,7 +261,7 @@ struct cff1_font_dict_op_serializer_t : cff_font_dict_op_serializer_t
struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatten_param_t>
{
static void flush_args_and_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_args_and_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
{
if (env.arg_start > 0)
flush_width (env, param);
@ -287,7 +287,8 @@ struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatte
break;
}
}
static void flush_args (cff1_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_args (cff1_cs_interp_env_t &env, flatten_param_t& param)
{
str_encoder_t encoder (param.flatStr);
for (unsigned int i = env.arg_start; i < env.argStack.get_count (); i++)
@ -295,20 +296,20 @@ struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatte
SUPER::flush_args (env, param);
}
static void flush_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
{
str_encoder_t encoder (param.flatStr);
encoder.encode_op (op);
}
static void flush_width (cff1_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_width (cff1_cs_interp_env_t &env, flatten_param_t& param)
{
assert (env.has_width);
str_encoder_t encoder (param.flatStr);
encoder.encode_num (env.width);
}
static void flush_hintmask (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_hintmask (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
{
SUPER::flush_hintmask (op, env, param);
if (!param.drop_hints)
@ -326,7 +327,7 @@ struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatte
struct range_list_t : hb_vector_t<code_pair_t>
{
/* replace the first glyph ID in the "glyph" field each range with a nLeft value */
bool finalize (unsigned int last_glyph)
inline bool finalize (unsigned int last_glyph)
{
bool two_byte = false;
for (unsigned int i = (*this).len; i > 0; i--)
@ -344,7 +345,7 @@ struct range_list_t : hb_vector_t<code_pair_t>
struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t, subr_subset_param_t>
{
static void process_op (op_code_t op, cff1_cs_interp_env_t &env, subr_subset_param_t& param)
static inline void process_op (op_code_t op, cff1_cs_interp_env_t &env, subr_subset_param_t& param)
{
switch (op) {
@ -377,7 +378,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t
}
protected:
static void process_call_subr (op_code_t op, cs_type_t type,
static inline void process_call_subr (op_code_t op, cs_type_t type,
cff1_cs_interp_env_t &env, subr_subset_param_t& param,
cff1_biased_subrs_t& subrs, hb_set_t *closure)
{
@ -394,7 +395,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t
struct cff1_subr_subsetter_t : subr_subsetter_t<cff1_subr_subsetter_t, CFF1Subrs, const OT::cff1::accelerator_subset_t, cff1_cs_interp_env_t, cff1_cs_opset_subr_subset_t>
{
static void finalize_parsed_str (cff1_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring)
static inline void finalize_parsed_str (cff1_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring)
{
/* insert width at the beginning of the charstring as necessary */
if (env.has_width)
@ -416,7 +417,7 @@ struct cff1_subr_subsetter_t : subr_subsetter_t<cff1_subr_subsetter_t, CFF1Subrs
};
struct cff_subset_plan {
cff_subset_plan ()
inline cff_subset_plan ()
: final_size (0),
offsets (),
orig_fdcount (0),
@ -442,7 +443,7 @@ struct cff_subset_plan {
topDictModSIDs[i] = CFF_UNDEF_SID;
}
~cff_subset_plan ()
inline ~cff_subset_plan ()
{
topdict_sizes.fini ();
topdict_mod.fini ();
@ -459,7 +460,7 @@ struct cff_subset_plan {
fontdicts_mod.fini ();
}
unsigned int plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
inline unsigned int plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
{
const Encoding *encoding = acc.encoding;
unsigned int size0, size1, supp_size;
@ -520,7 +521,7 @@ struct cff_subset_plan {
subset_enc_supp_codes.len);
}
unsigned int plan_subset_charset (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
inline unsigned int plan_subset_charset (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
{
unsigned int size0, size_ranges;
hb_codepoint_t sid, last_sid = CFF_UNDEF_CODE;
@ -563,7 +564,7 @@ struct cff_subset_plan {
subset_charset_format? subset_charset_ranges.len: plan->glyphs.len);
}
bool collect_sids_in_dicts (const OT::cff1::accelerator_subset_t &acc)
inline bool collect_sids_in_dicts (const OT::cff1::accelerator_subset_t &acc)
{
if (unlikely (!sidmap.reset (acc.stringIndex->count)))
return false;
@ -586,7 +587,7 @@ struct cff_subset_plan {
return true;
}
bool create (const OT::cff1::accelerator_subset_t &acc,
inline bool create (const OT::cff1::accelerator_subset_t &acc,
hb_subset_plan_t *plan)
{
/* make sure notdef is first */
@ -821,7 +822,7 @@ struct cff_subset_plan {
&& (fontdicts_mod.len == subset_fdcount));
}
unsigned int get_final_size () const { return final_size; }
inline unsigned int get_final_size () const { return final_size; }
unsigned int final_size;
hb_vector_t<unsigned int> topdict_sizes;

View File

@ -36,7 +36,7 @@ using namespace CFF;
struct cff2_sub_table_offsets_t : cff_sub_table_offsets_t
{
cff2_sub_table_offsets_t ()
inline cff2_sub_table_offsets_t ()
: cff_sub_table_offsets_t (),
varStoreOffset (0)
{}
@ -46,7 +46,7 @@ struct cff2_sub_table_offsets_t : cff_sub_table_offsets_t
struct cff2_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<>
{
bool serialize (hb_serialize_context_t *c,
inline bool serialize (hb_serialize_context_t *c,
const op_str_t &opstr,
const cff2_sub_table_offsets_t &offsets) const
{
@ -77,7 +77,7 @@ struct cff2_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<>
struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatten_param_t>
{
static void flush_args_and_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_args_and_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param)
{
switch (op)
{
@ -105,7 +105,7 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte
}
}
static void flush_args (cff2_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_args (cff2_cs_interp_env_t &env, flatten_param_t& param)
{
for (unsigned int i = 0; i < env.argStack.get_count ();)
{
@ -130,7 +130,7 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte
SUPER::flush_args (env, param);
}
static void flatten_blends (const blend_arg_t &arg, unsigned int i, cff2_cs_interp_env_t &env, flatten_param_t& param)
static inline void flatten_blends (const blend_arg_t &arg, unsigned int i, cff2_cs_interp_env_t &env, flatten_param_t& param)
{
/* flatten the default values */
str_encoder_t encoder (param.flatStr);
@ -157,7 +157,7 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte
encoder.encode_op (OpCode_blendcs);
}
static void flush_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param)
static inline void flush_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param)
{
switch (op)
{
@ -177,7 +177,7 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte
struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t, subr_subset_param_t>
{
static void process_op (op_code_t op, cff2_cs_interp_env_t &env, subr_subset_param_t& param)
static inline void process_op (op_code_t op, cff2_cs_interp_env_t &env, subr_subset_param_t& param)
{
switch (op) {
@ -208,7 +208,7 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t
}
protected:
static void process_call_subr (op_code_t op, cs_type_t type,
static inline void process_call_subr (op_code_t op, cs_type_t type,
cff2_cs_interp_env_t &env, subr_subset_param_t& param,
cff2_biased_subrs_t& subrs, hb_set_t *closure)
{
@ -225,7 +225,7 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t
struct cff2_subr_subsetter_t : subr_subsetter_t<cff2_subr_subsetter_t, CFF2Subrs, const OT::cff2::accelerator_subset_t, cff2_cs_interp_env_t, cff2_cs_opset_subr_subset_t>
{
static void finalize_parsed_str (cff2_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring)
static inline void finalize_parsed_str (cff2_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring)
{
/* vsindex is inserted at the beginning of the charstring as necessary */
if (env.seen_vsindex ())
@ -238,7 +238,7 @@ struct cff2_subr_subsetter_t : subr_subsetter_t<cff2_subr_subsetter_t, CFF2Subrs
};
struct cff2_subset_plan {
cff2_subset_plan ()
inline cff2_subset_plan ()
: final_size (0),
orig_fdcount (0),
subset_fdcount(1),
@ -254,7 +254,7 @@ struct cff2_subset_plan {
privateDictInfos.init ();
}
~cff2_subset_plan ()
inline ~cff2_subset_plan ()
{
subset_fdselect_ranges.fini ();
fdmap.fini ();
@ -264,7 +264,7 @@ struct cff2_subset_plan {
privateDictInfos.fini ();
}
bool create (const OT::cff2::accelerator_subset_t &acc,
inline bool create (const OT::cff2::accelerator_subset_t &acc,
hb_subset_plan_t *plan)
{
final_size = 0;
@ -342,7 +342,7 @@ struct cff2_subset_plan {
final_size += offsets.globalSubrsInfo.size;
/* variation store */
if (acc.varStore != &Null(CFF2VariationStore))
if (acc.varStore != &Null(cff2_variation_store_t))
{
offsets.varStoreOffset = final_size;
final_size += acc.varStore->get_size ();
@ -412,7 +412,7 @@ struct cff2_subset_plan {
return true;
}
unsigned int get_final_size () const { return final_size; }
inline unsigned int get_final_size () const { return final_size; }
unsigned int final_size;
cff2_sub_table_offsets_t offsets;
@ -477,10 +477,10 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
}
/* variation store */
if (acc.varStore != &Null(CFF2VariationStore))
if (acc.varStore != &Null(cff2_variation_store_t))
{
assert (plan.offsets.varStoreOffset == c.head - c.start);
CFF2VariationStore *dest = c.start_embed<CFF2VariationStore> ();
cff2_variation_store_t *dest = c.start_embed<cff2_variation_store_t> ();
if (unlikely (!dest->serialize (&c, acc.varStore)))
{
DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 Variation Store");