fixed tabs, added inline
This commit is contained in:
parent
785408d4f7
commit
21163c30e9
|
@ -217,37 +217,37 @@ inline unsigned int OpCode_Size (op_code_t op) { return Is_OpCode_ESC (op) ? 2:
|
||||||
|
|
||||||
struct number_t
|
struct number_t
|
||||||
{
|
{
|
||||||
void init () { set_real (0.0); }
|
inline void init () { set_real (0.0); }
|
||||||
void fini () {}
|
inline void fini () {}
|
||||||
|
|
||||||
void set_int (int v) { value = (double) v; }
|
inline void set_int (int v) { value = (double) v; }
|
||||||
int to_int () const { return (int) value; }
|
inline int to_int () const { return (int) value; }
|
||||||
|
|
||||||
void set_fixed (int32_t v) { value = v / 65536.0; }
|
inline void set_fixed (int32_t v) { value = v / 65536.0; }
|
||||||
int32_t to_fixed () const { return (int32_t) (value * 65536.0); }
|
inline int32_t to_fixed () const { return (int32_t) (value * 65536.0); }
|
||||||
|
|
||||||
void set_real (double v) { value = v; }
|
inline void set_real (double v) { value = v; }
|
||||||
double to_real () const { return value; }
|
inline double to_real () const { return value; }
|
||||||
|
|
||||||
int ceil () const { return (int) ::ceil (value); }
|
inline int ceil () const { return (int) ::ceil (value); }
|
||||||
int floor () const { return (int) ::floor (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); }
|
{ 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 (); }
|
{ return value > n.to_real (); }
|
||||||
|
|
||||||
bool operator < (const number_t &n) const
|
inline bool operator < (const number_t &n) const
|
||||||
{ return n > *this; }
|
{ return n > *this; }
|
||||||
|
|
||||||
bool operator >= (const number_t &n) const
|
inline bool operator >= (const number_t &n) const
|
||||||
{ return !(*this < n); }
|
{ return !(*this < n); }
|
||||||
|
|
||||||
bool operator <= (const number_t &n) const
|
inline bool operator <= (const number_t &n) const
|
||||||
{ return !(*this > n); }
|
{ 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 ());
|
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)
|
// encode 2-byte int (Dict/CharString) or 4-byte int (Dict)
|
||||||
template <typename INTTYPE, int minVal, int maxVal>
|
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);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -281,10 +281,10 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
|
||||||
return_trace (true);
|
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); }
|
{ 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); }
|
{ return serialize_int<HBUINT16, 0, 0x7FFF> (c, OpCode_shortint, value); }
|
||||||
|
|
||||||
/* Defining null_size allows a Null object may be created. Should be safe because:
|
/* 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 */
|
/* Holder of a section of byte string within a CFFIndex entry */
|
||||||
struct byte_str_t : hb_ubytes_t
|
struct byte_str_t : hb_ubytes_t
|
||||||
{
|
{
|
||||||
byte_str_t ()
|
inline byte_str_t ()
|
||||||
: hb_ubytes_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) {}
|
: 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) {}
|
: 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) {}
|
: hb_ubytes_t (ub) {}
|
||||||
|
|
||||||
/* sub-string */
|
/* 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_)); }
|
{ 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); }
|
{ return (offset + count <= len); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A byte string associated with the current offset and an error condition */
|
/* A byte string associated with the current offset and an error condition */
|
||||||
struct byte_str_ref_t
|
struct byte_str_ref_t
|
||||||
{
|
{
|
||||||
byte_str_ref_t ()
|
inline byte_str_ref_t () { init (); }
|
||||||
{ init (); }
|
|
||||||
|
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
str = byte_str_t ();
|
str = byte_str_t ();
|
||||||
offset = 0;
|
offset = 0;
|
||||||
error = false;
|
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) {}
|
: 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_;
|
str = str_;
|
||||||
offset = offset_;
|
offset = offset_;
|
||||||
error = false;
|
error = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char& operator [] (int i) {
|
inline const unsigned char& operator [] (int i) {
|
||||||
if (unlikely ((unsigned int)(offset + i) >= str.len))
|
if (unlikely ((unsigned int)(offset + i) >= str.len))
|
||||||
{
|
{
|
||||||
set_error ();
|
set_error ();
|
||||||
|
@ -353,16 +352,16 @@ struct byte_str_ref_t
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Conversion to byte_str_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_); }
|
{ 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));
|
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)))
|
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; }
|
inline void set_error () { error = true; }
|
||||||
bool in_error () const { return error; }
|
inline bool in_error () const { return error; }
|
||||||
|
|
||||||
byte_str_t str;
|
byte_str_t str;
|
||||||
unsigned int offset; /* beginning of the sub-string within 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>
|
template <typename ELEM, int LIMIT>
|
||||||
struct stack_t
|
struct stack_t
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
error = false;
|
error = false;
|
||||||
count = 0;
|
count = 0;
|
||||||
|
@ -401,18 +400,18 @@ struct stack_t
|
||||||
elements[i].init ();
|
elements[i].init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini ()
|
inline void fini ()
|
||||||
{
|
{
|
||||||
elements.fini_deep ();
|
elements.fini_deep ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ELEM& operator [] (unsigned int i)
|
inline ELEM& operator [] (unsigned int i)
|
||||||
{
|
{
|
||||||
if (unlikely (i >= count)) set_error ();
|
if (unlikely (i >= count)) set_error ();
|
||||||
return elements[i];
|
return elements[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void push (const ELEM &v)
|
inline void push (const ELEM &v)
|
||||||
{
|
{
|
||||||
if (likely (count < elements.len))
|
if (likely (count < elements.len))
|
||||||
elements[count++] = v;
|
elements[count++] = v;
|
||||||
|
@ -420,7 +419,7 @@ struct stack_t
|
||||||
set_error ();
|
set_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ELEM &push ()
|
inline ELEM &push ()
|
||||||
{
|
{
|
||||||
if (likely (count < elements.len))
|
if (likely (count < elements.len))
|
||||||
return elements[count++];
|
return elements[count++];
|
||||||
|
@ -431,7 +430,7 @@ struct stack_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ELEM& pop ()
|
inline ELEM& pop ()
|
||||||
{
|
{
|
||||||
if (likely (count > 0))
|
if (likely (count > 0))
|
||||||
return elements[--count];
|
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))
|
if (likely (count >= n))
|
||||||
count -= n;
|
count -= n;
|
||||||
|
@ -450,7 +449,7 @@ struct stack_t
|
||||||
set_error ();
|
set_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ELEM& peek ()
|
inline const ELEM& peek ()
|
||||||
{
|
{
|
||||||
if (likely (count > 0))
|
if (likely (count > 0))
|
||||||
return elements[count-1];
|
return elements[count-1];
|
||||||
|
@ -461,7 +460,7 @@ struct stack_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpop ()
|
inline void unpop ()
|
||||||
{
|
{
|
||||||
if (likely (count < elements.len))
|
if (likely (count < elements.len))
|
||||||
count++;
|
count++;
|
||||||
|
@ -469,13 +468,13 @@ struct stack_t
|
||||||
set_error ();
|
set_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear () { count = 0; }
|
inline void clear () { count = 0; }
|
||||||
|
|
||||||
bool in_error () const { return (error || elements.in_error ()); }
|
inline bool in_error () const { return (error || elements.in_error ()); }
|
||||||
void set_error () { error = true; }
|
inline void set_error () { error = true; }
|
||||||
|
|
||||||
unsigned int get_count () const { return count; }
|
inline unsigned int get_count () const { return count; }
|
||||||
bool is_empty () const { return count == 0; }
|
inline bool is_empty () const { return count == 0; }
|
||||||
|
|
||||||
static const unsigned int kSizeLimit = LIMIT;
|
static const unsigned int kSizeLimit = LIMIT;
|
||||||
|
|
||||||
|
@ -489,29 +488,29 @@ struct stack_t
|
||||||
template <typename ARG=number_t>
|
template <typename ARG=number_t>
|
||||||
struct arg_stack_t : stack_t<ARG, 513>
|
struct arg_stack_t : stack_t<ARG, 513>
|
||||||
{
|
{
|
||||||
void push_int (int v)
|
inline void push_int (int v)
|
||||||
{
|
{
|
||||||
ARG &n = S::push ();
|
ARG &n = S::push ();
|
||||||
n.set_int (v);
|
n.set_int (v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_fixed (int32_t v)
|
inline void push_fixed (int32_t v)
|
||||||
{
|
{
|
||||||
ARG &n = S::push ();
|
ARG &n = S::push ();
|
||||||
n.set_fixed (v);
|
n.set_fixed (v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_real (double v)
|
inline void push_real (double v)
|
||||||
{
|
{
|
||||||
ARG &n = S::push ();
|
ARG &n = S::push ();
|
||||||
n.set_real (v);
|
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 ();
|
int i = pop_int ();
|
||||||
if (unlikely (i < 0))
|
if (unlikely (i < 0))
|
||||||
|
@ -522,13 +521,13 @@ struct arg_stack_t : stack_t<ARG, 513>
|
||||||
return (unsigned)i;
|
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]));
|
push_int ((str_ref[0] << 24) | (str_ref[1] << 16) | (str_ref[2] << 8) | (str_ref[3]));
|
||||||
str_ref.inc (4);
|
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)))
|
if (unlikely (!str_ref.avail (4)))
|
||||||
return false;
|
return false;
|
||||||
|
@ -537,7 +536,7 @@ struct arg_stack_t : stack_t<ARG, 513>
|
||||||
return true;
|
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);
|
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 */
|
/* an operator prefixed by its operands in a byte string */
|
||||||
struct op_str_t
|
struct op_str_t
|
||||||
{
|
{
|
||||||
void init () {}
|
inline void init () {}
|
||||||
void fini () {}
|
inline void fini () {}
|
||||||
|
|
||||||
op_code_t op;
|
op_code_t op;
|
||||||
byte_str_t str;
|
byte_str_t str;
|
||||||
|
@ -560,7 +559,7 @@ struct op_str_t
|
||||||
struct op_serializer_t
|
struct op_serializer_t
|
||||||
{
|
{
|
||||||
protected:
|
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);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -574,14 +573,14 @@ struct op_serializer_t
|
||||||
template <typename VAL>
|
template <typename VAL>
|
||||||
struct parsed_values_t
|
struct parsed_values_t
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
opStart = 0;
|
opStart = 0;
|
||||||
values.init ();
|
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 *val = values.push ();
|
||||||
val->op = op;
|
val->op = op;
|
||||||
|
@ -589,7 +588,7 @@ struct parsed_values_t
|
||||||
opStart = str_ref.offset;
|
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 *val = values.push (v);
|
||||||
val->op = op;
|
val->op = op;
|
||||||
|
@ -597,16 +596,16 @@ struct parsed_values_t
|
||||||
opStart = str_ref.offset;
|
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++)
|
for (unsigned int i = 0; i < get_count (); i++)
|
||||||
if (get_value (i).op == op) return true;
|
if (get_value (i).op == op) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned get_count () const { return values.len; }
|
inline unsigned get_count () const { return values.len; }
|
||||||
const VAL &get_value (unsigned int i) const { return values[i]; }
|
inline const VAL &get_value (unsigned int i) const { return values[i]; }
|
||||||
const VAL &operator [] (unsigned int i) const { return get_value (i); }
|
inline const VAL &operator [] (unsigned int i) const { return get_value (i); }
|
||||||
|
|
||||||
unsigned int opStart;
|
unsigned int opStart;
|
||||||
hb_vector_t<VAL> values;
|
hb_vector_t<VAL> values;
|
||||||
|
@ -615,20 +614,20 @@ struct parsed_values_t
|
||||||
template <typename ARG=number_t>
|
template <typename ARG=number_t>
|
||||||
struct interp_env_t
|
struct interp_env_t
|
||||||
{
|
{
|
||||||
void init (const byte_str_t &str_)
|
inline void init (const byte_str_t &str_)
|
||||||
{
|
{
|
||||||
str_ref.reset (str_);
|
str_ref.reset (str_);
|
||||||
argStack.init ();
|
argStack.init ();
|
||||||
error = false;
|
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 (); }
|
{ 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;
|
op_code_t op = OpCode_Invalid;
|
||||||
if (unlikely (!str_ref.avail ()))
|
if (unlikely (!str_ref.avail ()))
|
||||||
|
@ -644,22 +643,22 @@ struct interp_env_t
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ARG& eval_arg (unsigned int i)
|
inline const ARG& eval_arg (unsigned int i)
|
||||||
{
|
{
|
||||||
return argStack[i];
|
return argStack[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
ARG& pop_arg ()
|
inline ARG& pop_arg ()
|
||||||
{
|
{
|
||||||
return argStack.pop ();
|
return argStack.pop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop_n_args (unsigned int n)
|
inline void pop_n_args (unsigned int n)
|
||||||
{
|
{
|
||||||
argStack.pop (n);
|
argStack.pop (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_args ()
|
inline void clear_args ()
|
||||||
{
|
{
|
||||||
pop_n_args (argStack.get_count ());
|
pop_n_args (argStack.get_count ());
|
||||||
}
|
}
|
||||||
|
@ -675,7 +674,7 @@ typedef interp_env_t<> num_interp_env_t;
|
||||||
template <typename ARG=number_t>
|
template <typename ARG=number_t>
|
||||||
struct opset_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) {
|
switch (op) {
|
||||||
case OpCode_shortint:
|
case OpCode_shortint:
|
||||||
|
@ -713,9 +712,9 @@ struct opset_t
|
||||||
template <typename ENV>
|
template <typename ENV>
|
||||||
struct interpreter_t {
|
struct interpreter_t {
|
||||||
|
|
||||||
~interpreter_t() { fini (); }
|
inline ~interpreter_t() { fini (); }
|
||||||
|
|
||||||
void fini () { env.fini (); }
|
inline void fini () { env.fini (); }
|
||||||
|
|
||||||
ENV env;
|
ENV env;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@ enum cs_type_t {
|
||||||
|
|
||||||
struct call_context_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_;
|
str_ref = substr_;
|
||||||
type = type_;
|
type = type_;
|
||||||
|
@ -62,7 +62,7 @@ struct call_stack_t : stack_t<call_context_t, kMaxCallLimit> {};
|
||||||
template <typename SUBRS>
|
template <typename SUBRS>
|
||||||
struct biased_subrs_t
|
struct biased_subrs_t
|
||||||
{
|
{
|
||||||
void init (const SUBRS &subrs_)
|
inline void init (const SUBRS &subrs_)
|
||||||
{
|
{
|
||||||
subrs = &subrs_;
|
subrs = &subrs_;
|
||||||
unsigned int nSubrs = get_count ();
|
unsigned int nSubrs = get_count ();
|
||||||
|
@ -74,12 +74,12 @@ struct biased_subrs_t
|
||||||
bias = 32768;
|
bias = 32768;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini () {}
|
inline void fini () {}
|
||||||
|
|
||||||
unsigned int get_count () const { return (subrs == nullptr)? 0: subrs->count; }
|
inline unsigned int get_count () const { return (subrs == nullptr)? 0: subrs->count; }
|
||||||
unsigned int get_bias () const { return bias; }
|
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))
|
if (unlikely ((subrs == nullptr) || index >= subrs->count))
|
||||||
return Null(byte_str_t);
|
return Null(byte_str_t);
|
||||||
|
@ -94,22 +94,22 @@ struct biased_subrs_t
|
||||||
|
|
||||||
struct point_t
|
struct point_t
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
x.init ();
|
x.init ();
|
||||||
y.init ();
|
y.init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_int (int _x, int _y)
|
inline void set_int (int _x, int _y)
|
||||||
{
|
{
|
||||||
x.set_int (_x);
|
x.set_int (_x);
|
||||||
y.set_int (_y);
|
y.set_int (_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_x (const number_t &dx) { x += dx; }
|
inline void move_x (const number_t &dx) { x += dx; }
|
||||||
void move_y (const number_t &dy) { y += dy; }
|
inline 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); }
|
inline 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 (const point_t &d) { move_x (d.x); move_y (d.y); }
|
||||||
|
|
||||||
number_t x;
|
number_t x;
|
||||||
number_t y;
|
number_t y;
|
||||||
|
@ -118,7 +118,7 @@ struct point_t
|
||||||
template <typename ARG, typename SUBRS>
|
template <typename ARG, typename SUBRS>
|
||||||
struct cs_interp_env_t : interp_env_t<ARG>
|
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);
|
interp_env_t<ARG>::init (str);
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
|
||||||
globalSubrs.init (globalSubrs_);
|
globalSubrs.init (globalSubrs_);
|
||||||
localSubrs.init (localSubrs_);
|
localSubrs.init (localSubrs_);
|
||||||
}
|
}
|
||||||
void fini ()
|
inline void fini ()
|
||||||
{
|
{
|
||||||
interp_env_t<ARG>::fini ();
|
interp_env_t<ARG>::fini ();
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ struct cs_interp_env_t : interp_env_t<ARG>
|
||||||
localSubrs.fini ();
|
localSubrs.fini ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool in_error () const
|
inline bool in_error () const
|
||||||
{
|
{
|
||||||
return callStack.in_error () || SUPER::in_error ();
|
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 ();
|
int n = SUPER::argStack.pop_int ();
|
||||||
n += biasedSubrs.get_bias ();
|
n += biasedSubrs.get_bias ();
|
||||||
|
@ -157,7 +157,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
|
||||||
return true;
|
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;
|
unsigned int subr_num;
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
|
||||||
SUPER::str_ref = context.str_ref;
|
SUPER::str_ref = context.str_ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
void returnFromSubr ()
|
inline void returnFromSubr ()
|
||||||
{
|
{
|
||||||
if (unlikely (SUPER::str_ref.in_error ()))
|
if (unlikely (SUPER::str_ref.in_error ()))
|
||||||
SUPER::set_error ();
|
SUPER::set_error ();
|
||||||
|
@ -182,7 +182,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
|
||||||
SUPER::str_ref = context.str_ref;
|
SUPER::str_ref = context.str_ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
void determine_hintmask_size ()
|
inline void determine_hintmask_size ()
|
||||||
{
|
{
|
||||||
if (!seen_hintmask)
|
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_; }
|
inline void set_endchar (bool endchar_flag_) { endchar_flag = endchar_flag_; }
|
||||||
bool is_endchar () const { return endchar_flag; }
|
inline bool is_endchar () const { return endchar_flag; }
|
||||||
|
|
||||||
const number_t &get_x () const { return pt.x; }
|
inline const number_t &get_x () const { return pt.x; }
|
||||||
const number_t &get_y () const { return pt.y; }
|
inline const number_t &get_y () const { return pt.y; }
|
||||||
const point_t &get_pt () const { return pt; }
|
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:
|
public:
|
||||||
call_context_t context;
|
call_context_t context;
|
||||||
|
@ -210,7 +210,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
|
||||||
unsigned int hstem_count;
|
unsigned int hstem_count;
|
||||||
unsigned int vstem_count;
|
unsigned int vstem_count;
|
||||||
unsigned int hintmask_size;
|
unsigned int hintmask_size;
|
||||||
call_stack_t callStack;
|
call_stack_t callStack;
|
||||||
biased_subrs_t<SUBRS> globalSubrs;
|
biased_subrs_t<SUBRS> globalSubrs;
|
||||||
biased_subrs_t<SUBRS> localSubrs;
|
biased_subrs_t<SUBRS> localSubrs;
|
||||||
|
|
||||||
|
@ -223,32 +223,32 @@ struct cs_interp_env_t : interp_env_t<ARG>
|
||||||
template <typename ENV, typename PARAM>
|
template <typename ENV, typename PARAM>
|
||||||
struct path_procs_null_t
|
struct path_procs_null_t
|
||||||
{
|
{
|
||||||
static void rmoveto (ENV &env, PARAM& param) {}
|
static inline void rmoveto (ENV &env, PARAM& param) {}
|
||||||
static void hmoveto (ENV &env, PARAM& param) {}
|
static inline void hmoveto (ENV &env, PARAM& param) {}
|
||||||
static void vmoveto (ENV &env, PARAM& param) {}
|
static inline void vmoveto (ENV &env, PARAM& param) {}
|
||||||
static void rlineto (ENV &env, PARAM& param) {}
|
static inline void rlineto (ENV &env, PARAM& param) {}
|
||||||
static void hlineto (ENV &env, PARAM& param) {}
|
static inline void hlineto (ENV &env, PARAM& param) {}
|
||||||
static void vlineto (ENV &env, PARAM& param) {}
|
static inline void vlineto (ENV &env, PARAM& param) {}
|
||||||
static void rrcurveto (ENV &env, PARAM& param) {}
|
static inline void rrcurveto (ENV &env, PARAM& param) {}
|
||||||
static void rcurveline (ENV &env, PARAM& param) {}
|
static inline void rcurveline (ENV &env, PARAM& param) {}
|
||||||
static void rlinecurve (ENV &env, PARAM& param) {}
|
static inline void rlinecurve (ENV &env, PARAM& param) {}
|
||||||
static void vvcurveto (ENV &env, PARAM& param) {}
|
static inline void vvcurveto (ENV &env, PARAM& param) {}
|
||||||
static void hhcurveto (ENV &env, PARAM& param) {}
|
static inline void hhcurveto (ENV &env, PARAM& param) {}
|
||||||
static void vhcurveto (ENV &env, PARAM& param) {}
|
static inline void vhcurveto (ENV &env, PARAM& param) {}
|
||||||
static void hvcurveto (ENV &env, PARAM& param) {}
|
static inline void hvcurveto (ENV &env, PARAM& param) {}
|
||||||
static void moveto (ENV &env, PARAM& param, const point_t &pt) {}
|
static inline void moveto (ENV &env, PARAM& param, const point_t &pt) {}
|
||||||
static void line (ENV &env, PARAM& param, const point_t &pt1) {}
|
static inline 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 inline 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 inline void hflex (ENV &env, PARAM& param) {}
|
||||||
static void flex (ENV &env, PARAM& param) {}
|
static inline void flex (ENV &env, PARAM& param) {}
|
||||||
static void hflex1 (ENV &env, PARAM& param) {}
|
static inline void hflex1 (ENV &env, PARAM& param) {}
|
||||||
static void flex1 (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> >
|
template <typename ARG, typename OPSET, typename ENV, typename PARAM, typename PATH=path_procs_null_t<ENV, PARAM> >
|
||||||
struct cs_opset_t : opset_t<ARG>
|
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) {
|
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;
|
env.hstem_count += env.argStack.get_count () / 2;
|
||||||
OPSET::flush_args_and_op (op, env, param);
|
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;
|
env.vstem_count += env.argStack.get_count () / 2;
|
||||||
OPSET::flush_args_and_op (op, env, param);
|
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 ();
|
env.determine_hintmask_size ();
|
||||||
if (likely (env.str_ref.avail (env.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);
|
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)
|
if (!env.seen_moveto)
|
||||||
{
|
{
|
||||||
|
@ -410,27 +410,27 @@ struct cs_opset_t : opset_t<ARG>
|
||||||
OPSET::flush_args_and_op (op, env, param);
|
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);
|
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_args (env, param);
|
||||||
OPSET::flush_op (op, 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 ());
|
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);
|
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>
|
template <typename PATH, typename ENV, typename PARAM>
|
||||||
struct path_procs_t
|
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 ();
|
point_t pt1 = env.get_pt ();
|
||||||
const number_t &dy = env.pop_arg ();
|
const number_t &dy = env.pop_arg ();
|
||||||
|
@ -469,21 +469,21 @@ struct path_procs_t
|
||||||
PATH::moveto (env, param, pt1);
|
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 ();
|
point_t pt1 = env.get_pt ();
|
||||||
pt1.move_x (env.pop_arg ());
|
pt1.move_x (env.pop_arg ());
|
||||||
PATH::moveto (env, param, pt1);
|
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 ();
|
point_t pt1 = env.get_pt ();
|
||||||
pt1.move_y (env.pop_arg ());
|
pt1.move_y (env.pop_arg ());
|
||||||
PATH::moveto (env, param, pt1);
|
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)
|
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;
|
point_t pt1;
|
||||||
unsigned int i = 0;
|
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;
|
point_t pt1;
|
||||||
unsigned int i = 0;
|
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)
|
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;
|
unsigned int i = 0;
|
||||||
for (; i + 6 <= env.argStack.get_count (); i += 6)
|
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 i = 0;
|
||||||
unsigned int line_limit = (env.argStack.get_count () % 6);
|
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;
|
unsigned int i = 0;
|
||||||
point_t pt1 = env.get_pt ();
|
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;
|
unsigned int i = 0;
|
||||||
point_t pt1 = env.get_pt ();
|
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;
|
point_t pt1, pt2, pt3;
|
||||||
unsigned int i = 0;
|
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;
|
point_t pt1, pt2, pt3;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
@ -749,16 +749,16 @@ struct path_procs_t
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default actions to be overridden */
|
/* 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); }
|
{ 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); }
|
{ 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); }
|
{ 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))
|
if (likely (env.argStack.get_count () == 7))
|
||||||
{
|
{
|
||||||
|
@ -782,7 +782,7 @@ struct path_procs_t
|
||||||
env.set_error ();
|
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))
|
if (likely (env.argStack.get_count () == 13))
|
||||||
{
|
{
|
||||||
|
@ -805,7 +805,7 @@ struct path_procs_t
|
||||||
env.set_error ();
|
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))
|
if (likely (env.argStack.get_count () == 9))
|
||||||
{
|
{
|
||||||
|
@ -829,7 +829,7 @@ struct path_procs_t
|
||||||
env.set_error ();
|
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))
|
if (likely (env.argStack.get_count () == 11))
|
||||||
{
|
{
|
||||||
|
@ -868,7 +868,7 @@ struct path_procs_t
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
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 &pt1, const point_t &pt2, const point_t &pt3,
|
||||||
const point_t &pt4, const point_t &pt5, const point_t &pt6)
|
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>
|
template <typename ENV, typename OPSET, typename PARAM>
|
||||||
struct cs_interpreter_t : interpreter_t<ENV>
|
struct cs_interpreter_t : interpreter_t<ENV>
|
||||||
{
|
{
|
||||||
bool interpret (PARAM& param)
|
inline bool interpret (PARAM& param)
|
||||||
{
|
{
|
||||||
SUPER::env.set_endchar (false);
|
SUPER::env.set_endchar (false);
|
||||||
|
|
||||||
|
@ -902,3 +902,4 @@ struct cs_interpreter_t : interpreter_t<ENV>
|
||||||
} /* namespace CFF */
|
} /* namespace CFF */
|
||||||
|
|
||||||
#endif /* HB_CFF_INTERP_CS_COMMON_HH */
|
#endif /* HB_CFF_INTERP_CS_COMMON_HH */
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ using namespace OT;
|
||||||
/* an opstr and the parsed out dict value(s) */
|
/* an opstr and the parsed out dict value(s) */
|
||||||
struct dict_val_t : op_str_t
|
struct dict_val_t : op_str_t
|
||||||
{
|
{
|
||||||
void init () { single_val.set_int (0); }
|
inline void init () { single_val.set_int (0); }
|
||||||
void fini () {}
|
inline void fini () {}
|
||||||
|
|
||||||
number_t single_val;
|
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>
|
template <typename OPSTR=op_str_t>
|
||||||
struct top_dict_values_t : dict_values_t<OPSTR>
|
struct top_dict_values_t : dict_values_t<OPSTR>
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
dict_values_t<OPSTR>::init ();
|
dict_values_t<OPSTR>::init ();
|
||||||
charStringsOffset = 0;
|
charStringsOffset = 0;
|
||||||
FDArrayOffset = 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)
|
switch (opstr.op)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ struct top_dict_values_t : dict_values_t<OPSTR>
|
||||||
|
|
||||||
struct dict_opset_t : opset_t<number_t>
|
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) {
|
switch (op) {
|
||||||
case OpCode_longintdict: /* 5-byte integer */
|
case OpCode_longintdict: /* 5-byte integer */
|
||||||
|
@ -96,19 +96,19 @@ struct dict_opset_t : opset_t<number_t>
|
||||||
|
|
||||||
static double parse_bcd (byte_str_ref_t& str_ref)
|
static double parse_bcd (byte_str_ref_t& str_ref)
|
||||||
{
|
{
|
||||||
bool neg = false;
|
bool neg = false;
|
||||||
double int_part = 0;
|
double int_part = 0;
|
||||||
uint64_t frac_part = 0;
|
uint64_t frac_part = 0;
|
||||||
uint32_t frac_count = 0;
|
uint32_t frac_count = 0;
|
||||||
bool exp_neg = false;
|
bool exp_neg = false;
|
||||||
uint32_t exp_part = 0;
|
uint32_t exp_part = 0;
|
||||||
bool exp_overflow = false;
|
bool exp_overflow = false;
|
||||||
enum Part { INT_PART=0, FRAC_PART, EXP_PART } part = INT_PART;
|
enum Part { INT_PART=0, FRAC_PART, EXP_PART } part = INT_PART;
|
||||||
enum Nibble { DECIMAL=10, EXP_POS, EXP_NEG, RESERVED, NEG, END };
|
enum Nibble { DECIMAL=10, EXP_POS, EXP_NEG, RESERVED, NEG, END };
|
||||||
const uint64_t MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 1^52-1 */
|
const uint64_t MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 1^52-1 */
|
||||||
const uint32_t MAX_EXP = 0x7FFu; /* 1^11-1 */
|
const uint32_t MAX_EXP = 0x7FFu; /* 1^11-1 */
|
||||||
|
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
unsigned char byte = 0;
|
unsigned char byte = 0;
|
||||||
for (uint32_t i = 0;; i++)
|
for (uint32_t i = 0;; i++)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ struct dict_opset_t : opset_t<number_t>
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_hint_op (op_code_t op)
|
static inline bool is_hint_op (op_code_t op)
|
||||||
{
|
{
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +248,7 @@ struct dict_opset_t : opset_t<number_t>
|
||||||
template <typename VAL=op_str_t>
|
template <typename VAL=op_str_t>
|
||||||
struct top_dict_opset_t : dict_opset_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) {
|
switch (op) {
|
||||||
case OpCode_CharStrings:
|
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>
|
template <typename OPSET, typename PARAM, typename ENV=num_interp_env_t>
|
||||||
struct dict_interpreter_t : interpreter_t<ENV>
|
struct dict_interpreter_t : interpreter_t<ENV>
|
||||||
{
|
{
|
||||||
bool interpret (PARAM& param)
|
inline bool interpret (PARAM& param)
|
||||||
{
|
{
|
||||||
param.init ();
|
param.init ();
|
||||||
while (SUPER::env.str_ref.avail ())
|
while (SUPER::env.str_ref.avail ())
|
||||||
|
|
|
@ -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>
|
struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs>
|
||||||
{
|
{
|
||||||
template <typename ACC>
|
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);
|
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
|
||||||
processed_width = false;
|
processed_width = false;
|
||||||
|
@ -47,9 +47,9 @@ struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs>
|
||||||
in_seac = false;
|
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)))
|
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;
|
processed_width = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_args ()
|
inline void clear_args ()
|
||||||
{
|
{
|
||||||
arg_start = 0;
|
arg_start = 0;
|
||||||
SUPER::clear_args ();
|
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 processed_width;
|
||||||
bool has_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 */
|
/* PostScript-originated legacy opcodes (OpCode_add etc) are unsupported */
|
||||||
/* Type 1-originated deprecated opcodes, seac behavior of endchar and dotsection are supported */
|
/* 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) {
|
switch (op) {
|
||||||
case OpCode_dotsection:
|
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)
|
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);
|
SUPER::flush_args (env, param);
|
||||||
env.clear_args (); /* pop off width */
|
env.clear_args (); /* pop off width */
|
||||||
|
|
|
@ -35,23 +35,23 @@ using namespace OT;
|
||||||
|
|
||||||
struct blend_arg_t : number_t
|
struct blend_arg_t : number_t
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
number_t::init ();
|
number_t::init ();
|
||||||
deltas.init ();
|
deltas.init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini ()
|
inline void fini ()
|
||||||
{
|
{
|
||||||
number_t::fini ();
|
number_t::fini ();
|
||||||
deltas.fini_deep ();
|
deltas.fini_deep ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_int (int v) { reset_blends (); number_t::set_int (v); }
|
inline 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); }
|
inline 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_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_)
|
unsigned int numBlends, hb_array_t<const blend_arg_t> blends_)
|
||||||
{
|
{
|
||||||
numValues = numValues_;
|
numValues = numValues_;
|
||||||
|
@ -61,8 +61,8 @@ struct blend_arg_t : number_t
|
||||||
deltas[i] = blends_[i];
|
deltas[i] = blends_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool blending () const { return deltas.len > 0; }
|
inline bool blending () const { return deltas.len > 0; }
|
||||||
void reset_blends ()
|
inline void reset_blends ()
|
||||||
{
|
{
|
||||||
numValues = valueIndex = 0;
|
numValues = valueIndex = 0;
|
||||||
deltas.resize (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>
|
struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
|
||||||
{
|
{
|
||||||
template <typename ACC>
|
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)
|
const int *coords_=nullptr, unsigned int num_coords_=0)
|
||||||
{
|
{
|
||||||
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
|
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_blend = false;
|
||||||
seen_vsindex_ = false;
|
seen_vsindex_ = false;
|
||||||
scalars.init ();
|
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);
|
set_ivs (acc.privateDicts[fd].ivs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini ()
|
inline void fini ()
|
||||||
{
|
{
|
||||||
scalars.fini ();
|
scalars.fini ();
|
||||||
SUPER::fini ();
|
SUPER::fini ();
|
||||||
}
|
}
|
||||||
|
|
||||||
op_code_t fetch_op ()
|
inline op_code_t fetch_op ()
|
||||||
{
|
{
|
||||||
if (this->str_ref.avail ())
|
if (this->str_ref.avail ())
|
||||||
return SUPER::fetch_op ();
|
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;
|
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_t &arg = argStack[i];
|
||||||
blend_arg (arg);
|
blend_arg (arg);
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
const blend_arg_t& pop_arg ()
|
inline const blend_arg_t& pop_arg ()
|
||||||
{
|
{
|
||||||
blend_arg_t &arg = argStack.pop ();
|
blend_arg_t &arg = argStack.pop ();
|
||||||
blend_arg (arg);
|
blend_arg (arg);
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_blend ()
|
inline void process_blend ()
|
||||||
{
|
{
|
||||||
if (!seen_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 ();
|
unsigned int index = argStack.pop_uint ();
|
||||||
if (unlikely (seen_vsindex () || seen_blend))
|
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;
|
seen_vsindex_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_region_count () const { return region_count; }
|
inline unsigned int get_region_count () const { return region_count; }
|
||||||
void set_region_count (unsigned int region_count_) { region_count = region_count_; }
|
inline void set_region_count (unsigned int region_count_) { region_count = region_count_; }
|
||||||
unsigned int get_ivs () const { return ivs; }
|
inline unsigned int get_ivs () const { return ivs; }
|
||||||
void set_ivs (unsigned int ivs_) { ivs = ivs_; }
|
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
|
||||||
bool seen_vsindex () const { return seen_vsindex_; }
|
inline bool seen_vsindex () const { return seen_vsindex_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void blend_arg (blend_arg_t &arg)
|
inline void blend_arg (blend_arg_t &arg)
|
||||||
{
|
{
|
||||||
if (do_blend && arg.blending ())
|
if (do_blend && arg.blending ())
|
||||||
{
|
{
|
||||||
|
@ -183,7 +183,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
|
||||||
protected:
|
protected:
|
||||||
const int *coords;
|
const int *coords;
|
||||||
unsigned int num_coords;
|
unsigned int num_coords;
|
||||||
const CFF2VariationStore *varStore;
|
const cff2_variation_store_t *varStore;
|
||||||
unsigned int region_count;
|
unsigned int region_count;
|
||||||
unsigned int ivs;
|
unsigned int ivs;
|
||||||
hb_vector_t<float> scalars;
|
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> >
|
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>
|
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) {
|
switch (op) {
|
||||||
case OpCode_callsubr:
|
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;
|
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);
|
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.process_vsindex ();
|
||||||
env.clear_args ();
|
env.clear_args ();
|
||||||
|
|
|
@ -64,9 +64,9 @@ struct code_pair_t
|
||||||
typedef hb_vector_t<unsigned char, 1> str_buff_t;
|
typedef hb_vector_t<unsigned char, 1> str_buff_t;
|
||||||
struct str_buff_vec_t : hb_vector_t<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;
|
unsigned int size = 0;
|
||||||
for (unsigned int i = 0; i < len; i++)
|
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>
|
template <typename COUNT>
|
||||||
struct CFFIndex
|
struct CFFIndex
|
||||||
{
|
{
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (likely ((count.sanitize (c) && count == 0) || /* empty INDEX */
|
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))));
|
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); }
|
{ return offSize * (count + 1); }
|
||||||
|
|
||||||
unsigned int offset_array_size () const
|
inline unsigned int offset_array_size () const
|
||||||
{ return calculate_offset_array_size (offSize, count); }
|
{ 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)
|
if (count == 0)
|
||||||
return COUNT::static_size;
|
return COUNT::static_size;
|
||||||
|
@ -105,7 +105,7 @@ struct CFFIndex
|
||||||
return min_size + calculate_offset_array_size (offSize, count) + dataSize;
|
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);
|
TRACE_SERIALIZE (this);
|
||||||
unsigned int size = src.get_size ();
|
unsigned int size = src.get_size ();
|
||||||
|
@ -115,9 +115,9 @@ struct CFFIndex
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool serialize (hb_serialize_context_t *c,
|
inline bool serialize (hb_serialize_context_t *c,
|
||||||
unsigned int offSize_,
|
unsigned int offSize_,
|
||||||
const byte_str_array_t &byteArray)
|
const byte_str_array_t &byteArray)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (byteArray.len == 0)
|
if (byteArray.len == 0)
|
||||||
|
@ -158,9 +158,9 @@ struct CFFIndex
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool serialize (hb_serialize_context_t *c,
|
inline bool serialize (hb_serialize_context_t *c,
|
||||||
unsigned int offSize_,
|
unsigned int offSize_,
|
||||||
const str_buff_vec_t &buffArray)
|
const str_buff_vec_t &buffArray)
|
||||||
{
|
{
|
||||||
byte_str_array_t byteArray;
|
byte_str_array_t byteArray;
|
||||||
byteArray.init ();
|
byteArray.init ();
|
||||||
|
@ -174,7 +174,7 @@ struct CFFIndex
|
||||||
return result;
|
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;
|
HBUINT8 *p = offsets + offSize * index + offSize;
|
||||||
unsigned int size = 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);
|
assert (index <= count);
|
||||||
const HBUINT8 *p = offsets + offSize * index;
|
const HBUINT8 *p = offsets + offSize * index;
|
||||||
|
@ -197,7 +197,7 @@ struct CFFIndex
|
||||||
return offset;
|
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)) &&
|
if (likely ((offset_at (index + 1) >= offset_at (index)) &&
|
||||||
(offset_at (index + 1) <= offset_at (count))))
|
(offset_at (index + 1) <= offset_at (count))))
|
||||||
|
@ -206,12 +206,12 @@ struct CFFIndex
|
||||||
return 0;
|
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 (); }
|
{ return (const unsigned char *)this + min_size + offset_array_size (); }
|
||||||
|
|
||||||
unsigned int data_size () const { return HBINT8::static_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))
|
if (likely (index < count))
|
||||||
return byte_str_t (data_base () + offset_at (index) - 1, length_at (index));
|
return byte_str_t (data_base () + offset_at (index) - 1, length_at (index));
|
||||||
|
@ -219,7 +219,7 @@ struct CFFIndex
|
||||||
return Null(byte_str_t);
|
return Null(byte_str_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_size () const
|
inline unsigned int get_size () const
|
||||||
{
|
{
|
||||||
if (this != &Null(CFFIndex))
|
if (this != &Null(CFFIndex))
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,7 @@ struct CFFIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int max_offset () const
|
inline unsigned int max_offset () const
|
||||||
{
|
{
|
||||||
unsigned int max = 0;
|
unsigned int max = 0;
|
||||||
for (unsigned int i = 0; i < count + 1u; i++)
|
for (unsigned int i = 0; i < count + 1u; i++)
|
||||||
|
@ -256,7 +256,7 @@ struct CFFIndex
|
||||||
template <typename COUNT, typename TYPE>
|
template <typename COUNT, typename TYPE>
|
||||||
struct CFFIndexOf : CFFIndex<COUNT>
|
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))
|
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));
|
return byte_str_t (CFFIndex<COUNT>::data_base () + CFFIndex<COUNT>::offset_at (index) - 1, CFFIndex<COUNT>::length_at (index));
|
||||||
|
@ -264,13 +264,13 @@ struct CFFIndexOf : CFFIndex<COUNT>
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DATA, typename PARAM1, typename PARAM2>
|
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_,
|
unsigned int offSize_,
|
||||||
const DATA *dataArray,
|
const DATA *dataArray,
|
||||||
unsigned int dataArrayLen,
|
unsigned int dataArrayLen,
|
||||||
const hb_vector_t<unsigned int> &dataSizeArray,
|
const hb_vector_t<unsigned int> &dataSizeArray,
|
||||||
const PARAM1 ¶m1,
|
const PARAM1 ¶m1,
|
||||||
const PARAM2 ¶m2)
|
const PARAM2 ¶m2)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
/* serialize CFFIndex header */
|
/* serialize CFFIndex header */
|
||||||
|
@ -303,11 +303,11 @@ struct CFFIndexOf : CFFIndex<COUNT>
|
||||||
|
|
||||||
/* in parallel to above */
|
/* in parallel to above */
|
||||||
template <typename DATA, typename PARAM>
|
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,
|
const DATA *dataArray,
|
||||||
unsigned int dataArrayLen,
|
unsigned int dataArrayLen,
|
||||||
hb_vector_t<unsigned int> &dataSizeArray, /* OUT */
|
hb_vector_t<unsigned int> &dataSizeArray, /* OUT */
|
||||||
const PARAM ¶m)
|
const PARAM ¶m)
|
||||||
{
|
{
|
||||||
/* determine offset size */
|
/* determine offset size */
|
||||||
unsigned int totalDataSize = 0;
|
unsigned int totalDataSize = 0;
|
||||||
|
@ -327,10 +327,10 @@ struct CFFIndexOf : CFFIndex<COUNT>
|
||||||
struct Dict : UnsizedByteStr
|
struct Dict : UnsizedByteStr
|
||||||
{
|
{
|
||||||
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
|
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,
|
const DICTVAL &dictval,
|
||||||
OP_SERIALIZER& opszr,
|
OP_SERIALIZER& opszr,
|
||||||
PARAM& param)
|
PARAM& param)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
for (unsigned int i = 0; i < dictval.get_count (); i++)
|
for (unsigned int i = 0; i < dictval.get_count (); i++)
|
||||||
|
@ -343,9 +343,9 @@ struct Dict : UnsizedByteStr
|
||||||
|
|
||||||
/* in parallel to above */
|
/* in parallel to above */
|
||||||
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
|
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,
|
OP_SERIALIZER& opszr,
|
||||||
PARAM& param)
|
PARAM& param)
|
||||||
{
|
{
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
for (unsigned int i = 0; i < dictval.get_count (); i++)
|
for (unsigned int i = 0; i < dictval.get_count (); i++)
|
||||||
|
@ -354,8 +354,8 @@ struct Dict : UnsizedByteStr
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DICTVAL, typename OP_SERIALIZER>
|
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)
|
OP_SERIALIZER& opszr)
|
||||||
{
|
{
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
for (unsigned int i = 0; i < dictval.get_count (); i++)
|
for (unsigned int i = 0; i < dictval.get_count (); i++)
|
||||||
|
@ -364,7 +364,7 @@ struct Dict : UnsizedByteStr
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename INTTYPE, int minVal, int maxVal>
|
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
|
// XXX: not sure why but LLVM fails to compile the following 'unlikely' macro invocation
|
||||||
if (/*unlikely*/ (!serialize_int<INTTYPE, minVal, maxVal> (c, intOp, value)))
|
if (/*unlikely*/ (!serialize_int<INTTYPE, minVal, maxVal> (c, intOp, value)))
|
||||||
|
@ -384,18 +384,18 @@ struct Dict : UnsizedByteStr
|
||||||
return_trace (true);
|
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); }
|
{ 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); }
|
{ 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);
|
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);
|
return serialize_uint2_op (c, op, value);
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ struct PrivateDict : Dict {};
|
||||||
|
|
||||||
struct table_info_t
|
struct table_info_t
|
||||||
{
|
{
|
||||||
void init () { offSize = offset = size = 0; }
|
inline void init () { offSize = offset = size = 0; }
|
||||||
|
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
@ -418,11 +418,11 @@ struct table_info_t
|
||||||
* set to CFF_UNDEF_CODE if excluded from subset */
|
* set to CFF_UNDEF_CODE if excluded from subset */
|
||||||
struct remap_t : hb_vector_t<hb_codepoint_t>
|
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)))
|
if (unlikely (!SUPER::resize (size)))
|
||||||
return false;
|
return false;
|
||||||
|
@ -432,7 +432,7 @@ struct remap_t : hb_vector_t<hb_codepoint_t>
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool identity (unsigned int size)
|
inline bool identity (unsigned int size)
|
||||||
{
|
{
|
||||||
if (unlikely (!SUPER::resize (size)))
|
if (unlikely (!SUPER::resize (size)))
|
||||||
return false;
|
return false;
|
||||||
|
@ -443,20 +443,20 @@ struct remap_t : hb_vector_t<hb_codepoint_t>
|
||||||
return true;
|
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); }
|
{ 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); }
|
{ return !excludes (id); }
|
||||||
|
|
||||||
unsigned int add (unsigned int i)
|
inline unsigned int add (unsigned int i)
|
||||||
{
|
{
|
||||||
if ((*this)[i] == CFF_UNDEF_CODE)
|
if ((*this)[i] == CFF_UNDEF_CODE)
|
||||||
(*this)[i] = count++;
|
(*this)[i] = count++;
|
||||||
return (*this)[i];
|
return (*this)[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_codepoint_t get_count () const { return count; }
|
inline hb_codepoint_t get_count () const { return count; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
hb_codepoint_t count;
|
hb_codepoint_t count;
|
||||||
|
@ -470,10 +470,10 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
|
||||||
{
|
{
|
||||||
/* used by CFF1 */
|
/* used by CFF1 */
|
||||||
template <typename DICTVAL, typename OP_SERIALIZER>
|
template <typename DICTVAL, typename OP_SERIALIZER>
|
||||||
bool serialize (hb_serialize_context_t *c,
|
inline bool serialize (hb_serialize_context_t *c,
|
||||||
unsigned int offSize_,
|
unsigned int offSize_,
|
||||||
const hb_vector_t<DICTVAL> &fontDicts,
|
const hb_vector_t<DICTVAL> &fontDicts,
|
||||||
OP_SERIALIZER& opszr)
|
OP_SERIALIZER& opszr)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
|
@ -504,13 +504,13 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
|
||||||
|
|
||||||
/* used by CFF2 */
|
/* used by CFF2 */
|
||||||
template <typename DICTVAL, typename OP_SERIALIZER>
|
template <typename DICTVAL, typename OP_SERIALIZER>
|
||||||
bool serialize (hb_serialize_context_t *c,
|
inline bool serialize (hb_serialize_context_t *c,
|
||||||
unsigned int offSize_,
|
unsigned int offSize_,
|
||||||
const hb_vector_t<DICTVAL> &fontDicts,
|
const hb_vector_t<DICTVAL> &fontDicts,
|
||||||
unsigned int fdCount,
|
unsigned int fdCount,
|
||||||
const remap_t &fdmap,
|
const remap_t &fdmap,
|
||||||
OP_SERIALIZER& opszr,
|
OP_SERIALIZER& opszr,
|
||||||
const hb_vector_t<table_info_t> &privateInfos)
|
const hb_vector_t<table_info_t> &privateInfos)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
|
@ -543,11 +543,11 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
|
||||||
|
|
||||||
/* in parallel to above */
|
/* in parallel to above */
|
||||||
template <typename OP_SERIALIZER, typename DICTVAL>
|
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,
|
const hb_vector_t<DICTVAL> &fontDicts,
|
||||||
unsigned int fdCount,
|
unsigned int fdCount,
|
||||||
const remap_t &fdmap,
|
const remap_t &fdmap,
|
||||||
OP_SERIALIZER& opszr)
|
OP_SERIALIZER& opszr)
|
||||||
{
|
{
|
||||||
unsigned int dictsSize = 0;
|
unsigned int dictsSize = 0;
|
||||||
for (unsigned int i = 0; i < fontDicts.len; i++)
|
for (unsigned int i = 0; i < fontDicts.len; i++)
|
||||||
|
@ -561,7 +561,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
|
||||||
|
|
||||||
/* FDSelect */
|
/* FDSelect */
|
||||||
struct FDSelect0 {
|
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);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!(c->check_struct (this))))
|
if (unlikely (!(c->check_struct (this))))
|
||||||
|
@ -573,12 +573,12 @@ struct FDSelect0 {
|
||||||
return_trace (true);
|
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];
|
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; }
|
{ return HBUINT8::static_size * num_glyphs; }
|
||||||
|
|
||||||
HBUINT8 fds[VAR];
|
HBUINT8 fds[VAR];
|
||||||
|
@ -588,7 +588,7 @@ struct FDSelect0 {
|
||||||
|
|
||||||
template <typename GID_TYPE, typename FD_TYPE>
|
template <typename GID_TYPE, typename FD_TYPE>
|
||||||
struct FDSelect3_4_Range {
|
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);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (likely (c->check_struct (this) && (first < c->get_num_glyphs ()) && (fd < fdcount)));
|
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>
|
template <typename GID_TYPE, typename FD_TYPE>
|
||||||
struct FDSelect3_4 {
|
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; }
|
{ 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);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!(c->check_struct (this) && (nRanges > 0) && (ranges[0].first == 0))))
|
if (unlikely (!(c->check_struct (this) && (nRanges > 0) && (ranges[0].first == 0))))
|
||||||
|
@ -624,7 +624,7 @@ struct FDSelect3_4 {
|
||||||
return_trace (true);
|
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;
|
unsigned int i;
|
||||||
for (i = 1; i < nRanges; i++)
|
for (i = 1; i < nRanges; i++)
|
||||||
|
@ -634,8 +634,8 @@ struct FDSelect3_4 {
|
||||||
return (hb_codepoint_t)ranges[i - 1].fd;
|
return (hb_codepoint_t)ranges[i - 1].fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
|
inline GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
|
||||||
const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
|
inline const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
|
||||||
|
|
||||||
GID_TYPE nRanges;
|
GID_TYPE nRanges;
|
||||||
FDSelect3_4_Range<GID_TYPE, FD_TYPE> ranges[VAR];
|
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;
|
typedef FDSelect3_4_Range<HBUINT16, HBUINT8> FDSelect3_Range;
|
||||||
|
|
||||||
struct FDSelect {
|
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);
|
TRACE_SANITIZE (this);
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ struct FDSelect {
|
||||||
u.format3.sanitize (c, fdcount)));
|
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);
|
TRACE_SERIALIZE (this);
|
||||||
unsigned int size = src.get_size (num_glyphs);
|
unsigned int size = src.get_size (num_glyphs);
|
||||||
|
@ -668,10 +668,10 @@ struct FDSelect {
|
||||||
return_trace (true);
|
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); }
|
{ 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;
|
unsigned int size = format.static_size;
|
||||||
if (format == 0)
|
if (format == 0)
|
||||||
|
@ -681,7 +681,7 @@ struct FDSelect {
|
||||||
return size;
|
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))
|
if (this == &Null(FDSelect))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -163,13 +163,13 @@ hb_codepoint_t OT::cff1::lookup_standard_encoding_for_sid (hb_codepoint_t code)
|
||||||
|
|
||||||
struct bounds_t
|
struct bounds_t
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
min.set_int (0x7FFFFFFF, 0x7FFFFFFF);
|
min.set_int (0x7FFFFFFF, 0x7FFFFFFF);
|
||||||
max.set_int (-0x80000000, -0x80000000);
|
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 < min.x) min.x = pt.x;
|
||||||
if (pt.x > max.x) max.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;
|
if (pt.y > max.y) max.y = pt.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void merge (const bounds_t &b)
|
inline void merge (const bounds_t &b)
|
||||||
{
|
{
|
||||||
if (empty ())
|
if (empty ())
|
||||||
*this = b;
|
*this = b;
|
||||||
|
@ -190,7 +190,7 @@ struct bounds_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void offset (const point_t &delta)
|
inline void offset (const point_t &delta)
|
||||||
{
|
{
|
||||||
if (!empty ())
|
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); }
|
{ return (min.x >= max.x) || (min.y >= max.y); }
|
||||||
|
|
||||||
point_t min;
|
point_t min;
|
||||||
|
@ -208,32 +208,32 @@ struct bounds_t
|
||||||
|
|
||||||
struct extents_param_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;
|
path_open = false;
|
||||||
cff = _cff;
|
cff = _cff;
|
||||||
bounds.init ();
|
bounds.init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_path () { path_open = true; }
|
inline void start_path () { path_open = true; }
|
||||||
void end_path () { path_open = false; }
|
inline void end_path () { path_open = false; }
|
||||||
bool is_path_open () const { return path_open; }
|
inline bool is_path_open () const { return path_open; }
|
||||||
|
|
||||||
bool path_open;
|
bool path_open;
|
||||||
bounds_t bounds;
|
bounds_t bounds;
|
||||||
|
|
||||||
const OT::cff1::accelerator_t *cff;
|
const OT::cff1::accelerator_t *cff;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_cs_interp_env_t, 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 ();
|
param.end_path ();
|
||||||
env.moveto (pt);
|
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 ())
|
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 ());
|
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 ())
|
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>
|
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 ();
|
unsigned int n = env.argStack.get_count ();
|
||||||
point_t delta;
|
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 ();
|
bounds.init ();
|
||||||
if (unlikely (!cff->is_valid () || (glyph >= cff->num_glyphs))) return false;
|
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
|
struct get_seac_param_t
|
||||||
{
|
{
|
||||||
void init (const OT::cff1::accelerator_t *_cff)
|
inline void init (const OT::cff1::accelerator_t *_cff)
|
||||||
{
|
{
|
||||||
cff = _cff;
|
cff = _cff;
|
||||||
base = 0;
|
base = 0;
|
||||||
accent = 0;
|
accent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_seac () const { return base && accent; }
|
inline bool has_seac () const { return base && accent; }
|
||||||
|
|
||||||
const OT::cff1::accelerator_t *cff;
|
const OT::cff1::accelerator_t *cff;
|
||||||
hb_codepoint_t base;
|
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>
|
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 ();
|
unsigned int n = env.argStack.get_count ();
|
||||||
hb_codepoint_t base_char = (hb_codepoint_t)env.argStack[n-2].to_int ();
|
hb_codepoint_t base_char = (hb_codepoint_t)env.argStack[n-2].to_int ();
|
||||||
|
|
|
@ -56,13 +56,13 @@ struct CFF1FDSelect : FDSelect {};
|
||||||
|
|
||||||
/* Encoding */
|
/* Encoding */
|
||||||
struct Encoding0 {
|
struct Encoding0 {
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this) && codes[nCodes - 1].sanitize (c));
|
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);
|
assert (glyph > 0);
|
||||||
glyph--;
|
glyph--;
|
||||||
|
@ -74,7 +74,7 @@ struct Encoding0 {
|
||||||
return CFF_UNDEF_CODE;
|
return CFF_UNDEF_CODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_size () const
|
inline unsigned int get_size () const
|
||||||
{ return HBUINT8::static_size * (nCodes + 1); }
|
{ return HBUINT8::static_size * (nCodes + 1); }
|
||||||
|
|
||||||
HBUINT8 nCodes;
|
HBUINT8 nCodes;
|
||||||
|
@ -84,7 +84,7 @@ struct Encoding0 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Encoding1_Range {
|
struct Encoding1_Range {
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this));
|
return_trace (c->check_struct (this));
|
||||||
|
@ -97,16 +97,16 @@ struct Encoding1_Range {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Encoding1 {
|
struct Encoding1 {
|
||||||
unsigned int get_size () const
|
inline unsigned int get_size () const
|
||||||
{ return HBUINT8::static_size + Encoding1_Range::static_size * nRanges; }
|
{ 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);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this) && ((nRanges == 0) || (ranges[nRanges - 1]).sanitize (c)));
|
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);
|
assert (glyph > 0);
|
||||||
glyph--;
|
glyph--;
|
||||||
|
@ -128,7 +128,7 @@ struct Encoding1 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SuppEncoding {
|
struct SuppEncoding {
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this));
|
return_trace (c->check_struct (this));
|
||||||
|
@ -141,20 +141,20 @@ struct SuppEncoding {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CFF1SuppEncData {
|
struct CFF1SuppEncData {
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this) && ((nSups == 0) || (supps[nSups - 1]).sanitize (c)));
|
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++)
|
for (unsigned int i = 0; i < nSups; i++)
|
||||||
if (sid == supps[i].glyph)
|
if (sid == supps[i].glyph)
|
||||||
codes.push (supps[i].code);
|
codes.push (supps[i].code);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_size () const
|
inline unsigned int get_size () const
|
||||||
{ return HBUINT8::static_size + SuppEncoding::static_size * nSups; }
|
{ return HBUINT8::static_size + SuppEncoding::static_size * nSups; }
|
||||||
|
|
||||||
HBUINT8 nSups;
|
HBUINT8 nSups;
|
||||||
|
@ -164,7 +164,7 @@ struct CFF1SuppEncData {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Encoding {
|
struct Encoding {
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ struct Encoding {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* serialize a fullset 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);
|
TRACE_SERIALIZE (this);
|
||||||
unsigned int size = src.get_size ();
|
unsigned int size = src.get_size ();
|
||||||
|
@ -190,11 +190,11 @@ struct Encoding {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* serialize a subset Encoding */
|
/* serialize a subset Encoding */
|
||||||
bool serialize (hb_serialize_context_t *c,
|
inline bool serialize (hb_serialize_context_t *c,
|
||||||
uint8_t format,
|
uint8_t format,
|
||||||
unsigned int enc_count,
|
unsigned int enc_count,
|
||||||
const hb_vector_t<code_pair_t>& code_ranges,
|
const hb_vector_t<code_pair_t>& code_ranges,
|
||||||
const hb_vector_t<code_pair_t>& supp_codes)
|
const hb_vector_t<code_pair_t>& supp_codes)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
Encoding *dest = c->extend_min (*this);
|
Encoding *dest = c->extend_min (*this);
|
||||||
|
@ -243,9 +243,9 @@ struct Encoding {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parallel to above: calculate the size of a subset 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 enc_count,
|
||||||
unsigned int supp_count)
|
unsigned int supp_count)
|
||||||
{
|
{
|
||||||
unsigned int size = min_size;
|
unsigned int size = min_size;
|
||||||
if (format == 0)
|
if (format == 0)
|
||||||
|
@ -257,7 +257,7 @@ struct Encoding {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_size () const
|
inline unsigned int get_size () const
|
||||||
{
|
{
|
||||||
unsigned int size = min_size;
|
unsigned int size = min_size;
|
||||||
if (table_format () == 0)
|
if (table_format () == 0)
|
||||||
|
@ -269,7 +269,7 @@ struct Encoding {
|
||||||
return size;
|
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)
|
if (table_format () == 0)
|
||||||
return u.format0.get_code (glyph);
|
return u.format0.get_code (glyph);
|
||||||
|
@ -277,10 +277,10 @@ struct Encoding {
|
||||||
return u.format1.get_code (glyph);
|
return u.format1.get_code (glyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t table_format () const { return (format & 0x7F); }
|
inline uint8_t table_format () const { return (format & 0x7F); }
|
||||||
bool has_supplement () const { return (format & 0x80) != 0; }
|
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);
|
codes.resize (0);
|
||||||
if (has_supplement ())
|
if (has_supplement ())
|
||||||
|
@ -288,7 +288,7 @@ struct Encoding {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const CFF1SuppEncData &suppEncData () const
|
inline const CFF1SuppEncData &suppEncData () const
|
||||||
{
|
{
|
||||||
if ((format & 0x7F) == 0)
|
if ((format & 0x7F) == 0)
|
||||||
return StructAfter<CFF1SuppEncData> (u.format0.codes[u.format0.nCodes-1]);
|
return StructAfter<CFF1SuppEncData> (u.format0.codes[u.format0.nCodes-1]);
|
||||||
|
@ -310,13 +310,13 @@ struct Encoding {
|
||||||
|
|
||||||
/* Charset */
|
/* Charset */
|
||||||
struct Charset0 {
|
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);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this) && sids[num_glyphs - 1].sanitize (c));
|
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)
|
if (glyph == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -324,7 +324,7 @@ struct Charset0 {
|
||||||
return sids[glyph - 1];
|
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)
|
if (sid == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -337,7 +337,7 @@ struct Charset0 {
|
||||||
return 0;
|
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);
|
assert (num_glyphs > 0);
|
||||||
return HBUINT16::static_size * (num_glyphs - 1);
|
return HBUINT16::static_size * (num_glyphs - 1);
|
||||||
|
@ -350,7 +350,7 @@ struct Charset0 {
|
||||||
|
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
struct Charset_Range {
|
struct Charset_Range {
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this));
|
return_trace (c->check_struct (this));
|
||||||
|
@ -364,7 +364,7 @@ struct Charset_Range {
|
||||||
|
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
struct Charset1_2 {
|
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);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!c->check_struct (this)))
|
if (unlikely (!c->check_struct (this)))
|
||||||
|
@ -379,7 +379,7 @@ struct Charset1_2 {
|
||||||
return_trace (true);
|
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;
|
if (glyph == 0) return 0;
|
||||||
glyph--;
|
glyph--;
|
||||||
|
@ -393,7 +393,7 @@ struct Charset1_2 {
|
||||||
return 0;
|
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;
|
if (sid == 0) return 0;
|
||||||
hb_codepoint_t glyph = 1;
|
hb_codepoint_t glyph = 1;
|
||||||
|
@ -409,7 +409,7 @@ struct Charset1_2 {
|
||||||
return 0;
|
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;
|
unsigned int size = HBUINT8::static_size;
|
||||||
int glyph = (int)num_glyphs;
|
int glyph = (int)num_glyphs;
|
||||||
|
@ -436,7 +436,7 @@ typedef Charset_Range<HBUINT8> Charset1_Range;
|
||||||
typedef Charset_Range<HBUINT16> Charset2_Range;
|
typedef Charset_Range<HBUINT16> Charset2_Range;
|
||||||
|
|
||||||
struct Charset {
|
struct Charset {
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ struct Charset {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* serialize a fullset 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);
|
TRACE_SERIALIZE (this);
|
||||||
unsigned int size = src.get_size (num_glyphs);
|
unsigned int size = src.get_size (num_glyphs);
|
||||||
|
@ -464,7 +464,7 @@ struct Charset {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* serialize a subset Charset */
|
/* serialize a subset Charset */
|
||||||
bool serialize (hb_serialize_context_t *c,
|
inline bool serialize (hb_serialize_context_t *c,
|
||||||
uint8_t format,
|
uint8_t format,
|
||||||
unsigned int num_glyphs,
|
unsigned int num_glyphs,
|
||||||
const hb_vector_t<code_pair_t>& sid_ranges)
|
const hb_vector_t<code_pair_t>& sid_ranges)
|
||||||
|
@ -513,9 +513,8 @@ struct Charset {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parallel to above: calculate the size of a subset Charset */
|
/* parallel to above: calculate the size of a subset Charset */
|
||||||
static unsigned int calculate_serialized_size (
|
static inline unsigned int calculate_serialized_size (uint8_t format,
|
||||||
uint8_t format,
|
unsigned int count)
|
||||||
unsigned int count)
|
|
||||||
{
|
{
|
||||||
unsigned int size = min_size;
|
unsigned int size = min_size;
|
||||||
if (format == 0)
|
if (format == 0)
|
||||||
|
@ -528,7 +527,7 @@ struct Charset {
|
||||||
return size;
|
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;
|
unsigned int size = min_size;
|
||||||
if (format == 0)
|
if (format == 0)
|
||||||
|
@ -540,7 +539,7 @@ struct Charset {
|
||||||
return size;
|
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)
|
if (format == 0)
|
||||||
return u.format0.get_sid (glyph);
|
return u.format0.get_sid (glyph);
|
||||||
|
@ -550,7 +549,7 @@ struct Charset {
|
||||||
return u.format2.get_sid (glyph);
|
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)
|
if (format == 0)
|
||||||
return u.format0.get_glyph (sid, num_glyphs);
|
return u.format0.get_glyph (sid, num_glyphs);
|
||||||
|
@ -572,8 +571,8 @@ struct Charset {
|
||||||
|
|
||||||
struct CFF1StringIndex : CFF1Index
|
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)
|
unsigned int offSize_, const remap_t &sidmap)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
if (unlikely ((strings.count == 0) || (sidmap.get_count () == 0)))
|
if (unlikely ((strings.count == 0) || (sidmap.get_count () == 0)))
|
||||||
|
@ -601,7 +600,7 @@ struct CFF1StringIndex : CFF1Index
|
||||||
}
|
}
|
||||||
|
|
||||||
/* in parallel to above */
|
/* 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;
|
offSize = 0;
|
||||||
if ((count == 0) || (sidmap.get_count () == 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
|
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) {}
|
: num_interp_env_t(), prev_offset(0), last_offset(0) {}
|
||||||
|
|
||||||
unsigned int prev_offset;
|
unsigned int prev_offset;
|
||||||
|
@ -645,19 +644,19 @@ struct name_dict_values_t
|
||||||
ValCount
|
ValCount
|
||||||
};
|
};
|
||||||
|
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < ValCount; i++)
|
for (unsigned int i = 0; i < ValCount; i++)
|
||||||
values[i] = CFF_UNDEF_SID;
|
values[i] = CFF_UNDEF_SID;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int& operator[] (unsigned int i)
|
inline unsigned int& operator[] (unsigned int i)
|
||||||
{ assert (i < ValCount); return values[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]; }
|
{ 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) {
|
switch (op) {
|
||||||
default: // can't happen - just make some compiler happy
|
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>
|
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 ();
|
top_dict_values_t<cff1_top_dict_val_t>::init ();
|
||||||
|
|
||||||
|
@ -704,25 +703,25 @@ struct cff1_top_dict_values_t : top_dict_values_t<cff1_top_dict_val_t>
|
||||||
FDSelectOffset = 0;
|
FDSelectOffset = 0;
|
||||||
privateDictInfo.init ();
|
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; }
|
{ return nameSIDs[name_dict_values_t::registry] != CFF_UNDEF_SID; }
|
||||||
|
|
||||||
name_dict_values_t nameSIDs;
|
name_dict_values_t nameSIDs;
|
||||||
unsigned int ros_supplement_offset;
|
unsigned int ros_supplement_offset;
|
||||||
unsigned int ros_supplement;
|
unsigned int ros_supplement;
|
||||||
unsigned int cidCount;
|
unsigned int cidCount;
|
||||||
|
|
||||||
unsigned int EncodingOffset;
|
unsigned int EncodingOffset;
|
||||||
unsigned int CharsetOffset;
|
unsigned int CharsetOffset;
|
||||||
unsigned int FDSelectOffset;
|
unsigned int FDSelectOffset;
|
||||||
table_info_t privateDictInfo;
|
table_info_t privateDictInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cff1_top_dict_opset_t : top_dict_opset_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;
|
cff1_top_dict_val_t val;
|
||||||
val.last_arg_offset = (env.last_offset-1) - dictval.opStart; /* offset to the last argument */
|
val.last_arg_offset = (env.last_offset-1) - dictval.opStart; /* offset to the last argument */
|
||||||
|
@ -809,21 +808,21 @@ 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>
|
struct cff1_font_dict_values_t : dict_values_t<op_str_t>
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
dict_values_t<op_str_t>::init ();
|
dict_values_t<op_str_t>::init ();
|
||||||
privateDictInfo.init ();
|
privateDictInfo.init ();
|
||||||
fontName = CFF_UNDEF_SID;
|
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;
|
table_info_t privateDictInfo;
|
||||||
unsigned int fontName;
|
unsigned int fontName;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cff1_font_dict_opset_t : dict_opset_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) {
|
switch (op) {
|
||||||
case OpCode_FontName:
|
case OpCode_FontName:
|
||||||
|
@ -855,15 +854,15 @@ struct cff1_font_dict_opset_t : dict_opset_t
|
||||||
template <typename VAL>
|
template <typename VAL>
|
||||||
struct cff1_private_dict_values_base_t : dict_values_t<VAL>
|
struct cff1_private_dict_values_base_t : dict_values_t<VAL>
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
dict_values_t<VAL>::init ();
|
dict_values_t<VAL>::init ();
|
||||||
subrsOffset = 0;
|
subrsOffset = 0;
|
||||||
localSubrs = &Null(CFF1Subrs);
|
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;
|
unsigned int size = 0;
|
||||||
for (unsigned int i = 0; i < dict_values_t<VAL>::get_count; i++)
|
for (unsigned int i = 0; i < dict_values_t<VAL>::get_count; i++)
|
||||||
|
@ -874,8 +873,8 @@ struct cff1_private_dict_values_base_t : dict_values_t<VAL>
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int subrsOffset;
|
unsigned int subrsOffset;
|
||||||
const CFF1Subrs *localSubrs;
|
const CFF1Subrs *localSubrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef cff1_private_dict_values_base_t<op_str_t> cff1_private_dict_values_subset_t;
|
typedef cff1_private_dict_values_base_t<op_str_t> cff1_private_dict_values_subset_t;
|
||||||
|
@ -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
|
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;
|
num_dict_val_t val;
|
||||||
val.init ();
|
val.init ();
|
||||||
|
@ -930,7 +929,7 @@ struct cff1_private_dict_opset_t : dict_opset_t
|
||||||
|
|
||||||
struct cff1_private_dict_opset_subset : 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) {
|
switch (op) {
|
||||||
case OpCode_BlueValues:
|
case OpCode_BlueValues:
|
||||||
|
@ -986,7 +985,7 @@ struct cff1
|
||||||
{
|
{
|
||||||
static const hb_tag_t tableTag = HB_OT_TAG_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);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this) &&
|
return_trace (c->check_struct (this) &&
|
||||||
|
@ -996,7 +995,7 @@ struct cff1
|
||||||
template <typename PRIVOPSET, typename PRIVDICTVAL>
|
template <typename PRIVOPSET, typename PRIVDICTVAL>
|
||||||
struct accelerator_templ_t
|
struct accelerator_templ_t
|
||||||
{
|
{
|
||||||
void init (hb_face_t *face)
|
inline void init (hb_face_t *face)
|
||||||
{
|
{
|
||||||
topDict.init ();
|
topDict.init ();
|
||||||
fontDicts.init ();
|
fontDicts.init ();
|
||||||
|
@ -1123,7 +1122,7 @@ struct cff1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini ()
|
inline void fini ()
|
||||||
{
|
{
|
||||||
sc.end_processing ();
|
sc.end_processing ();
|
||||||
topDict.fini ();
|
topDict.fini ();
|
||||||
|
@ -1133,12 +1132,12 @@ struct cff1
|
||||||
blob = nullptr;
|
blob = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_valid () const { return blob != nullptr; }
|
inline bool is_valid () const { return blob != nullptr; }
|
||||||
bool is_CID () const { return topDict.is_CID (); }
|
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);
|
hb_codepoint_t sid = lookup_standard_encoding_for_sid (code);
|
||||||
if (unlikely (sid == CFF_UNDEF_SID))
|
if (unlikely (sid == CFF_UNDEF_SID))
|
||||||
|
@ -1152,23 +1151,23 @@ struct cff1
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
hb_blob_t *blob;
|
hb_blob_t *blob;
|
||||||
hb_sanitize_context_t sc;
|
hb_sanitize_context_t sc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const Charset *charset;
|
const Charset *charset;
|
||||||
const CFF1NameIndex *nameIndex;
|
const CFF1NameIndex *nameIndex;
|
||||||
const CFF1TopDictIndex *topDictIndex;
|
const CFF1TopDictIndex *topDictIndex;
|
||||||
const CFF1StringIndex *stringIndex;
|
const CFF1StringIndex *stringIndex;
|
||||||
const CFF1Subrs *globalSubrs;
|
const CFF1Subrs *globalSubrs;
|
||||||
const CFF1CharStrings *charStrings;
|
const CFF1CharStrings *charStrings;
|
||||||
const CFF1FDArray *fdArray;
|
const CFF1FDArray *fdArray;
|
||||||
const CFF1FDSelect *fdSelect;
|
const CFF1FDSelect *fdSelect;
|
||||||
unsigned int fdCount;
|
unsigned int fdCount;
|
||||||
|
|
||||||
cff1_top_dict_values_t topDict;
|
cff1_top_dict_values_t topDict;
|
||||||
hb_vector_t<cff1_font_dict_values_t> fontDicts;
|
hb_vector_t<cff1_font_dict_values_t> fontDicts;
|
||||||
hb_vector_t<PRIVDICTVAL> privateDicts;
|
hb_vector_t<PRIVDICTVAL> privateDicts;
|
||||||
|
|
||||||
unsigned int num_glyphs;
|
unsigned int num_glyphs;
|
||||||
};
|
};
|
||||||
|
@ -1181,7 +1180,7 @@ struct cff1
|
||||||
|
|
||||||
struct accelerator_subset_t : accelerator_templ_t<cff1_private_dict_opset_subset, cff1_private_dict_values_subset_t>
|
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);
|
SUPER::init (face);
|
||||||
if (blob == nullptr) return;
|
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))
|
if (encoding != &Null(Encoding))
|
||||||
return encoding->get_code (glyph);
|
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))
|
if (charset != &Null(Charset))
|
||||||
return charset->get_sid (glyph);
|
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;
|
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;
|
hb_blob_t *cff_prime = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ using namespace CFF;
|
||||||
|
|
||||||
struct extents_param_t
|
struct extents_param_t
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
path_open = false;
|
path_open = false;
|
||||||
min_x.set_int (0x7FFFFFFF);
|
min_x.set_int (0x7FFFFFFF);
|
||||||
|
@ -40,11 +40,11 @@ struct extents_param_t
|
||||||
max_y.set_int (-0x80000000);
|
max_y.set_int (-0x80000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_path () { path_open = true; }
|
inline void start_path () { path_open = true; }
|
||||||
void end_path () { path_open = false; }
|
inline void end_path () { path_open = false; }
|
||||||
bool is_path_open () const { return path_open; }
|
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 < min_x) min_x = pt.x;
|
||||||
if (pt.x > max_x) max_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>
|
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 ();
|
param.end_path ();
|
||||||
env.moveto (pt);
|
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 ())
|
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 ());
|
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 ())
|
if (!param.is_path_open ())
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,7 @@ typedef FDSelect3_4_Range<HBUINT32, HBUINT16> FDSelect4_Range;
|
||||||
|
|
||||||
struct CFF2FDSelect
|
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);
|
TRACE_SANITIZE (this);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ struct CFF2FDSelect
|
||||||
u.format4.sanitize (c, fdcount))));
|
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);
|
TRACE_SERIALIZE (this);
|
||||||
unsigned int size = src.get_size (num_glyphs);
|
unsigned int size = src.get_size (num_glyphs);
|
||||||
|
@ -73,10 +73,10 @@ struct CFF2FDSelect
|
||||||
return_trace (true);
|
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); }
|
{ 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;
|
unsigned int size = format.static_size;
|
||||||
if (format == 0)
|
if (format == 0)
|
||||||
|
@ -88,7 +88,7 @@ struct CFF2FDSelect
|
||||||
return size;
|
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))
|
if (this == &Null(CFF2FDSelect))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -110,43 +110,43 @@ struct CFF2FDSelect
|
||||||
DEFINE_SIZE_MIN (2);
|
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);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (likely (c->check_struct (this)) && c->check_range (&varStore, size) && varStore.sanitize (c));
|
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);
|
TRACE_SERIALIZE (this);
|
||||||
unsigned int size_ = varStore->get_size ();
|
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);
|
if (unlikely (dest == nullptr)) return_trace (false);
|
||||||
memcpy (dest, varStore, size_);
|
memcpy (dest, varStore, size_);
|
||||||
return_trace (true);
|
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;
|
HBUINT16 size;
|
||||||
VariationStore varStore;
|
VariationStore varStore;
|
||||||
|
|
||||||
DEFINE_SIZE_MIN (2 + VariationStore::min_size);
|
DEFINE_SIZE_MIN (2 + VariationStore::min_size);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cff2_top_dict_values_t : top_dict_values_t<>
|
struct cff2_top_dict_values_t : top_dict_values_t<>
|
||||||
{
|
{
|
||||||
void init ()
|
inline void init ()
|
||||||
{
|
{
|
||||||
top_dict_values_t<>::init ();
|
top_dict_values_t<>::init ();
|
||||||
vstoreOffset = 0;
|
vstoreOffset = 0;
|
||||||
FDSelectOffset = 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;
|
unsigned int size = 0;
|
||||||
for (unsigned int i = 0; i < get_count (); i++)
|
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<>
|
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) {
|
switch (op) {
|
||||||
case OpCode_FontMatrix:
|
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
|
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) {
|
switch (op) {
|
||||||
case OpCode_Private:
|
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
|
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;
|
num_dict_val_t val;
|
||||||
val.init ();
|
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
|
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) {
|
switch (op) {
|
||||||
case OpCode_BlueValues:
|
case OpCode_BlueValues:
|
||||||
|
@ -410,7 +410,7 @@ struct cff2
|
||||||
{
|
{
|
||||||
static const hb_tag_t tableTag = HB_OT_TAG_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);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this) &&
|
return_trace (c->check_struct (this) &&
|
||||||
|
@ -420,7 +420,7 @@ struct cff2
|
||||||
template <typename PRIVOPSET, typename PRIVDICTVAL>
|
template <typename PRIVOPSET, typename PRIVDICTVAL>
|
||||||
struct accelerator_templ_t
|
struct accelerator_templ_t
|
||||||
{
|
{
|
||||||
void init (hb_face_t *face)
|
inline void init (hb_face_t *face)
|
||||||
{
|
{
|
||||||
topDict.init ();
|
topDict.init ();
|
||||||
fontDicts.init ();
|
fontDicts.init ();
|
||||||
|
@ -447,12 +447,12 @@ struct cff2
|
||||||
}
|
}
|
||||||
|
|
||||||
globalSubrs = &StructAtOffset<CFF2Subrs> (cff2, cff2->topDict + cff2->topDictSize);
|
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);
|
charStrings = &StructAtOffsetOrNull<CFF2CharStrings> (cff2, topDict.charStringsOffset);
|
||||||
fdArray = &StructAtOffsetOrNull<CFF2FDArray> (cff2, topDict.FDArrayOffset);
|
fdArray = &StructAtOffsetOrNull<CFF2FDArray> (cff2, topDict.FDArrayOffset);
|
||||||
fdSelect = &StructAtOffsetOrNull<CFF2FDSelect> (cff2, topDict.FDSelectOffset);
|
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)) ||
|
(charStrings == &Null(CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) ||
|
||||||
(globalSubrs == &Null(CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) ||
|
(globalSubrs == &Null(CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) ||
|
||||||
(fdArray == &Null(CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) ||
|
(fdArray == &Null(CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) ||
|
||||||
|
@ -493,7 +493,7 @@ struct cff2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini ()
|
inline void fini ()
|
||||||
{
|
{
|
||||||
sc.end_processing ();
|
sc.end_processing ();
|
||||||
fontDicts.fini_deep ();
|
fontDicts.fini_deep ();
|
||||||
|
@ -502,25 +502,25 @@ struct cff2
|
||||||
blob = nullptr;
|
blob = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_valid () const { return blob != nullptr; }
|
inline bool is_valid () const { return blob != nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
hb_blob_t *blob;
|
hb_blob_t *blob;
|
||||||
hb_sanitize_context_t sc;
|
hb_sanitize_context_t sc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cff2_top_dict_values_t topDict;
|
cff2_top_dict_values_t topDict;
|
||||||
const CFF2Subrs *globalSubrs;
|
const CFF2Subrs *globalSubrs;
|
||||||
const CFF2VariationStore *varStore;
|
const cff2_variation_store_t *varStore;
|
||||||
const CFF2CharStrings *charStrings;
|
const CFF2CharStrings *charStrings;
|
||||||
const CFF2FDArray *fdArray;
|
const CFF2FDArray *fdArray;
|
||||||
const CFF2FDSelect *fdSelect;
|
const CFF2FDSelect *fdSelect;
|
||||||
unsigned int fdCount;
|
unsigned int fdCount;
|
||||||
|
|
||||||
hb_vector_t<cff2_font_dict_values_t> fontDicts;
|
hb_vector_t<cff2_font_dict_values_t> fontDicts;
|
||||||
hb_vector_t<PRIVDICTVAL> privateDicts;
|
hb_vector_t<PRIVDICTVAL> privateDicts;
|
||||||
|
|
||||||
unsigned int num_glyphs;
|
unsigned int num_glyphs;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct accelerator_t : accelerator_templ_t<cff2_private_dict_opset_t, cff2_private_dict_values_t>
|
struct accelerator_t : accelerator_templ_t<cff2_private_dict_opset_t, cff2_private_dict_values_t>
|
||||||
|
@ -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;
|
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;
|
hb_blob_t *cff2_prime = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -37,18 +37,18 @@ namespace CFF {
|
||||||
/* Used for writing a temporary charstring */
|
/* Used for writing a temporary charstring */
|
||||||
struct str_encoder_t
|
struct str_encoder_t
|
||||||
{
|
{
|
||||||
str_encoder_t (str_buff_t &buff_)
|
inline str_encoder_t (str_buff_t &buff_)
|
||||||
: buff (buff_), error (false) {}
|
: 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)))
|
if (unlikely (buff.push (b) == &Crap(unsigned char)))
|
||||||
set_error ();
|
set_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void encode_int (int v)
|
inline void encode_int (int v)
|
||||||
{
|
{
|
||||||
if ((-1131 <= v) && (v <= 1131))
|
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 ())
|
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))
|
if (Is_OpCode_ESC (op))
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ struct str_encoder_t
|
||||||
encode_byte (op);
|
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;
|
unsigned int offset = buff.len;
|
||||||
buff.resize (offset + str.len);
|
buff.resize (offset + str.len);
|
||||||
|
@ -119,17 +119,17 @@ struct str_encoder_t
|
||||||
memcpy (&buff[offset], &str[0], str.len);
|
memcpy (&buff[offset], &str[0], str.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_error () const { return error; }
|
inline bool is_error () const { return error; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_error () { error = true; }
|
inline void set_error () { error = true; }
|
||||||
|
|
||||||
str_buff_t &buff;
|
str_buff_t &buff;
|
||||||
bool error;
|
bool error;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cff_sub_table_offsets_t {
|
struct cff_sub_table_offsets_t {
|
||||||
cff_sub_table_offsets_t () : privateDictsOffset (0)
|
inline cff_sub_table_offsets_t () : privateDictsOffset (0)
|
||||||
{
|
{
|
||||||
topDictInfo.init ();
|
topDictInfo.init ();
|
||||||
FDSelectInfo.init ();
|
FDSelectInfo.init ();
|
||||||
|
@ -139,23 +139,23 @@ struct cff_sub_table_offsets_t {
|
||||||
localSubrsInfos.init ();
|
localSubrsInfos.init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~cff_sub_table_offsets_t () { localSubrsInfos.fini (); }
|
inline ~cff_sub_table_offsets_t () { localSubrsInfos.fini (); }
|
||||||
|
|
||||||
table_info_t topDictInfo;
|
table_info_t topDictInfo;
|
||||||
table_info_t FDSelectInfo;
|
table_info_t FDSelectInfo;
|
||||||
table_info_t FDArrayInfo;
|
table_info_t FDArrayInfo;
|
||||||
table_info_t charStringsInfo;
|
table_info_t charStringsInfo;
|
||||||
unsigned int privateDictsOffset;
|
unsigned int privateDictsOffset;
|
||||||
table_info_t globalSubrsInfo;
|
table_info_t globalSubrsInfo;
|
||||||
hb_vector_t<table_info_t> localSubrsInfos;
|
hb_vector_t<table_info_t> localSubrsInfos;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename OPSTR=op_str_t>
|
template <typename OPSTR=op_str_t>
|
||||||
struct cff_top_dict_op_serializer_t : op_serializer_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 OPSTR &opstr,
|
||||||
const cff_sub_table_offsets_t &offsets) const
|
const cff_sub_table_offsets_t &offsets) const
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ struct cff_top_dict_op_serializer_t : op_serializer_t
|
||||||
return_trace (true);
|
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)
|
switch (opstr.op)
|
||||||
{
|
{
|
||||||
|
@ -193,9 +193,9 @@ struct cff_top_dict_op_serializer_t : op_serializer_t
|
||||||
|
|
||||||
struct cff_font_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 op_str_t &opstr,
|
||||||
const table_info_t &privateDictInfo) const
|
const table_info_t &privateDictInfo) const
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ struct cff_font_dict_op_serializer_t : op_serializer_t
|
||||||
return_trace (true);
|
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)
|
if (opstr.op == OpCode_Private)
|
||||||
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Private);
|
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Private);
|
||||||
|
@ -233,12 +233,12 @@ struct cff_font_dict_op_serializer_t : op_serializer_t
|
||||||
|
|
||||||
struct cff_private_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_) {}
|
: 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 op_str_t &opstr,
|
||||||
const unsigned int subrsOffset) const
|
const unsigned int subrsOffset) const
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -255,8 +255,8 @@ struct cff_private_dict_op_serializer_t : op_serializer_t
|
||||||
return_trace (copy_opstr (c, opstr));
|
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
|
bool has_localsubr=true) const
|
||||||
{
|
{
|
||||||
if (drop_hints && dict_opset_t::is_hint_op (opstr.op))
|
if (drop_hints && dict_opset_t::is_hint_op (opstr.op))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -278,22 +278,22 @@ struct cff_private_dict_op_serializer_t : op_serializer_t
|
||||||
|
|
||||||
struct flatten_param_t
|
struct flatten_param_t
|
||||||
{
|
{
|
||||||
str_buff_t &flatStr;
|
str_buff_t &flatStr;
|
||||||
bool drop_hints;
|
bool drop_hints;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename ACC, typename ENV, typename OPSET>
|
template <typename ACC, typename ENV, typename OPSET>
|
||||||
struct subr_flattener_t
|
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_,
|
const hb_vector_t<hb_codepoint_t> &glyphs_,
|
||||||
bool drop_hints_)
|
bool drop_hints_)
|
||||||
: acc (acc_),
|
: acc (acc_),
|
||||||
glyphs (glyphs_),
|
glyphs (glyphs_),
|
||||||
drop_hints (drop_hints_)
|
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))
|
if (!flat_charstrings.resize (glyphs.len))
|
||||||
return false;
|
return false;
|
||||||
|
@ -322,10 +322,10 @@ struct subr_flattener_t
|
||||||
|
|
||||||
struct subr_closures_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 (); }
|
{ local_closures.init (); }
|
||||||
|
|
||||||
void init (unsigned int fd_count)
|
inline void init (unsigned int fd_count)
|
||||||
{
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
global_closure = hb_set_create ();
|
global_closure = hb_set_create ();
|
||||||
|
@ -342,7 +342,7 @@ struct subr_closures_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini ()
|
inline void fini ()
|
||||||
{
|
{
|
||||||
hb_set_destroy (global_closure);
|
hb_set_destroy (global_closure);
|
||||||
for (unsigned int i = 0; i < local_closures.len; i++)
|
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
|
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 ();
|
op_str_t::init ();
|
||||||
subr_num = subr_num_;
|
subr_num = subr_num_;
|
||||||
|
@ -374,16 +374,16 @@ struct parsed_cs_op_t : op_str_t
|
||||||
skip_flag = false;
|
skip_flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini () { op_str_t::fini (); }
|
inline void fini () { op_str_t::fini (); }
|
||||||
|
|
||||||
bool for_drop () const { return drop_flag; }
|
inline bool for_drop () const { return drop_flag; }
|
||||||
void set_drop () { if (!for_keep ()) drop_flag = true; }
|
inline void set_drop () { if (!for_keep ()) drop_flag = true; }
|
||||||
|
|
||||||
bool for_keep () const { return keep_flag; }
|
inline bool for_keep () const { return keep_flag; }
|
||||||
void set_keep () { keep_flag = true; }
|
inline void set_keep () { keep_flag = true; }
|
||||||
|
|
||||||
bool for_skip () const { return skip_flag; }
|
inline bool for_skip () const { return skip_flag; }
|
||||||
void set_skip () { skip_flag = true; }
|
inline void set_skip () { skip_flag = true; }
|
||||||
|
|
||||||
unsigned int subr_num;
|
unsigned int subr_num;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ using namespace CFF;
|
||||||
|
|
||||||
struct remap_sid_t : remap_t
|
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))
|
if ((sid != CFF_UNDEF_SID) && !is_std_std (sid))
|
||||||
return offset_sid (remap_t::add (unoffset_sid (sid)));
|
return offset_sid (remap_t::add (unoffset_sid (sid)));
|
||||||
|
@ -44,7 +44,7 @@ struct remap_sid_t : remap_t
|
||||||
return sid;
|
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))
|
if (is_std_std (sid) || (sid == CFF_UNDEF_SID))
|
||||||
return sid;
|
return sid;
|
||||||
|
@ -54,14 +54,14 @@ struct remap_sid_t : remap_t
|
||||||
|
|
||||||
static const unsigned int num_std_strings = 391;
|
static const unsigned int num_std_strings = 391;
|
||||||
|
|
||||||
static bool is_std_std (unsigned int sid) { return sid < num_std_strings; }
|
static inline 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 inline 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 unsigned int unoffset_sid (unsigned int sid) { return sid - num_std_strings; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cff1_sub_table_offsets_t : cff_sub_table_offsets_t
|
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 (),
|
: cff_sub_table_offsets_t (),
|
||||||
nameIndexOffset (0),
|
nameIndexOffset (0),
|
||||||
encodingOffset (0)
|
encodingOffset (0)
|
||||||
|
@ -71,35 +71,35 @@ struct cff1_sub_table_offsets_t : cff_sub_table_offsets_t
|
||||||
privateDictInfo.init ();
|
privateDictInfo.init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int nameIndexOffset;
|
unsigned int nameIndexOffset;
|
||||||
table_info_t stringIndexInfo;
|
table_info_t stringIndexInfo;
|
||||||
unsigned int encodingOffset;
|
unsigned int encodingOffset;
|
||||||
table_info_t charsetInfo;
|
table_info_t charsetInfo;
|
||||||
table_info_t privateDictInfo;
|
table_info_t privateDictInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* a copy of a parsed out cff1_top_dict_values_t augmented with additional operators */
|
/* 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
|
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 ();
|
SUPER::init ();
|
||||||
base = base_;
|
base = base_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini () { SUPER::fini (); }
|
inline void fini () { SUPER::fini (); }
|
||||||
|
|
||||||
unsigned get_count () const { return base->get_count () + SUPER::get_count (); }
|
inline unsigned get_count () const { return base->get_count () + SUPER::get_count (); }
|
||||||
const cff1_top_dict_val_t &get_value (unsigned int i) const
|
inline const cff1_top_dict_val_t &get_value (unsigned int i) const
|
||||||
{
|
{
|
||||||
if (i < base->get_count ())
|
if (i < base->get_count ())
|
||||||
return (*base)[i];
|
return (*base)[i];
|
||||||
else
|
else
|
||||||
return SUPER::values[i - base->get_count ()];
|
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++)
|
for (unsigned int i = 0; i < name_dict_values_t::ValCount; i++)
|
||||||
nameSIDs[i] = sidmap[base->nameSIDs[i]];
|
nameSIDs[i] = sidmap[base->nameSIDs[i]];
|
||||||
|
@ -113,7 +113,7 @@ struct cff1_top_dict_values_mod_t : cff1_top_dict_values_t
|
||||||
struct top_dict_modifiers_t
|
struct top_dict_modifiers_t
|
||||||
{
|
{
|
||||||
top_dict_modifiers_t (const cff1_sub_table_offsets_t &offsets_,
|
top_dict_modifiers_t (const cff1_sub_table_offsets_t &offsets_,
|
||||||
const unsigned int (&nameSIDs_)[name_dict_values_t::ValCount])
|
const unsigned int (&nameSIDs_)[name_dict_values_t::ValCount])
|
||||||
: offsets (offsets_),
|
: offsets (offsets_),
|
||||||
nameSIDs (nameSIDs_)
|
nameSIDs (nameSIDs_)
|
||||||
{}
|
{}
|
||||||
|
@ -124,9 +124,9 @@ struct top_dict_modifiers_t
|
||||||
|
|
||||||
struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dict_val_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 cff1_top_dict_val_t &opstr,
|
||||||
const top_dict_modifiers_t &mod) const
|
const top_dict_modifiers_t &mod) const
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dic
|
||||||
return_trace (true);
|
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;
|
op_code_t op = opstr.op;
|
||||||
switch (op)
|
switch (op)
|
||||||
|
@ -215,29 +215,29 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dic
|
||||||
|
|
||||||
struct font_dict_values_mod_t
|
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_,
|
unsigned int fontName_,
|
||||||
const table_info_t &privateDictInfo_)
|
const table_info_t &privateDictInfo_)
|
||||||
{
|
{
|
||||||
base = base_;
|
base = base_;
|
||||||
fontName = fontName_;
|
fontName = fontName_;
|
||||||
privateDictInfo = privateDictInfo_;
|
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;
|
const cff1_font_dict_values_t *base;
|
||||||
table_info_t privateDictInfo;
|
table_info_t privateDictInfo;
|
||||||
unsigned int fontName;
|
unsigned int fontName;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cff1_font_dict_op_serializer_t : cff_font_dict_op_serializer_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 op_str_t &opstr,
|
||||||
const font_dict_values_mod_t &mod) const
|
const font_dict_values_mod_t &mod) const
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -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));
|
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)
|
if (opstr.op == OpCode_FontName)
|
||||||
return OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (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>
|
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)
|
if (env.arg_start > 0)
|
||||||
flush_width (env, param);
|
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;
|
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);
|
str_encoder_t encoder (param.flatStr);
|
||||||
for (unsigned int i = env.arg_start; i < env.argStack.get_count (); i++)
|
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);
|
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);
|
str_encoder_t encoder (param.flatStr);
|
||||||
encoder.encode_op (op);
|
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);
|
assert (env.has_width);
|
||||||
str_encoder_t encoder (param.flatStr);
|
str_encoder_t encoder (param.flatStr);
|
||||||
encoder.encode_num (env.width);
|
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);
|
SUPER::flush_hintmask (op, env, param);
|
||||||
if (!param.drop_hints)
|
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>
|
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 */
|
/* 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;
|
bool two_byte = false;
|
||||||
for (unsigned int i = (*this).len; i > 0; i--)
|
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>
|
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) {
|
switch (op) {
|
||||||
|
|
||||||
|
@ -377,7 +378,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
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_cs_interp_env_t &env, subr_subset_param_t& param,
|
||||||
cff1_biased_subrs_t& subrs, hb_set_t *closure)
|
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>
|
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 */
|
/* insert width at the beginning of the charstring as necessary */
|
||||||
if (env.has_width)
|
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 {
|
struct cff_subset_plan {
|
||||||
cff_subset_plan ()
|
inline cff_subset_plan ()
|
||||||
: final_size (0),
|
: final_size (0),
|
||||||
offsets (),
|
offsets (),
|
||||||
orig_fdcount (0),
|
orig_fdcount (0),
|
||||||
|
@ -442,7 +443,7 @@ struct cff_subset_plan {
|
||||||
topDictModSIDs[i] = CFF_UNDEF_SID;
|
topDictModSIDs[i] = CFF_UNDEF_SID;
|
||||||
}
|
}
|
||||||
|
|
||||||
~cff_subset_plan ()
|
inline ~cff_subset_plan ()
|
||||||
{
|
{
|
||||||
topdict_sizes.fini ();
|
topdict_sizes.fini ();
|
||||||
topdict_mod.fini ();
|
topdict_mod.fini ();
|
||||||
|
@ -459,7 +460,7 @@ struct cff_subset_plan {
|
||||||
fontdicts_mod.fini ();
|
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;
|
const Encoding *encoding = acc.encoding;
|
||||||
unsigned int size0, size1, supp_size;
|
unsigned int size0, size1, supp_size;
|
||||||
|
@ -520,10 +521,10 @@ struct cff_subset_plan {
|
||||||
subset_enc_supp_codes.len);
|
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;
|
unsigned int size0, size_ranges;
|
||||||
hb_codepoint_t sid, last_sid = CFF_UNDEF_CODE;
|
hb_codepoint_t sid, last_sid = CFF_UNDEF_CODE;
|
||||||
|
|
||||||
subset_charset_ranges.resize (0);
|
subset_charset_ranges.resize (0);
|
||||||
unsigned int glyph;
|
unsigned int glyph;
|
||||||
|
@ -563,7 +564,7 @@ struct cff_subset_plan {
|
||||||
subset_charset_format? subset_charset_ranges.len: plan->glyphs.len);
|
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)))
|
if (unlikely (!sidmap.reset (acc.stringIndex->count)))
|
||||||
return false;
|
return false;
|
||||||
|
@ -586,7 +587,7 @@ struct cff_subset_plan {
|
||||||
return true;
|
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)
|
hb_subset_plan_t *plan)
|
||||||
{
|
{
|
||||||
/* make sure notdef is first */
|
/* make sure notdef is first */
|
||||||
|
@ -821,46 +822,46 @@ struct cff_subset_plan {
|
||||||
&& (fontdicts_mod.len == subset_fdcount));
|
&& (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;
|
unsigned int final_size;
|
||||||
hb_vector_t<unsigned int> topdict_sizes;
|
hb_vector_t<unsigned int> topdict_sizes;
|
||||||
cff1_top_dict_values_mod_t topdict_mod;
|
cff1_top_dict_values_mod_t topdict_mod;
|
||||||
cff1_sub_table_offsets_t offsets;
|
cff1_sub_table_offsets_t offsets;
|
||||||
|
|
||||||
unsigned int num_glyphs;
|
unsigned int num_glyphs;
|
||||||
unsigned int orig_fdcount;
|
unsigned int orig_fdcount;
|
||||||
unsigned int subset_fdcount;
|
unsigned int subset_fdcount;
|
||||||
unsigned int subset_fdselect_format;
|
unsigned int subset_fdselect_format;
|
||||||
hb_vector_t<code_pair_t> subset_fdselect_ranges;
|
hb_vector_t<code_pair_t> subset_fdselect_ranges;
|
||||||
|
|
||||||
/* font dict index remap table from fullset FDArray to subset FDArray.
|
/* font dict index remap table from fullset FDArray to subset FDArray.
|
||||||
* set to CFF_UNDEF_CODE if excluded from subset */
|
* set to CFF_UNDEF_CODE if excluded from subset */
|
||||||
remap_t fdmap;
|
remap_t fdmap;
|
||||||
|
|
||||||
str_buff_vec_t subset_charstrings;
|
str_buff_vec_t subset_charstrings;
|
||||||
str_buff_vec_t subset_globalsubrs;
|
str_buff_vec_t subset_globalsubrs;
|
||||||
hb_vector_t<str_buff_vec_t> subset_localsubrs;
|
hb_vector_t<str_buff_vec_t> subset_localsubrs;
|
||||||
hb_vector_t<font_dict_values_mod_t> fontdicts_mod;
|
hb_vector_t<font_dict_values_mod_t> fontdicts_mod;
|
||||||
|
|
||||||
bool drop_hints;
|
bool drop_hints;
|
||||||
|
|
||||||
bool gid_renum;
|
bool gid_renum;
|
||||||
bool subset_encoding;
|
bool subset_encoding;
|
||||||
uint8_t subset_enc_format;
|
uint8_t subset_enc_format;
|
||||||
unsigned int subset_enc_num_codes;
|
unsigned int subset_enc_num_codes;
|
||||||
range_list_t subset_enc_code_ranges;
|
range_list_t subset_enc_code_ranges;
|
||||||
hb_vector_t<code_pair_t> subset_enc_supp_codes;
|
hb_vector_t<code_pair_t> subset_enc_supp_codes;
|
||||||
|
|
||||||
uint8_t subset_charset_format;
|
uint8_t subset_charset_format;
|
||||||
range_list_t subset_charset_ranges;
|
range_list_t subset_charset_ranges;
|
||||||
bool subset_charset;
|
bool subset_charset;
|
||||||
|
|
||||||
remap_sid_t sidmap;
|
remap_sid_t sidmap;
|
||||||
unsigned int topDictModSIDs[name_dict_values_t::ValCount];
|
unsigned int topDictModSIDs[name_dict_values_t::ValCount];
|
||||||
|
|
||||||
bool desubroutinize;
|
bool desubroutinize;
|
||||||
cff1_subr_subsetter_t subr_subsetter;
|
cff1_subr_subsetter_t subr_subsetter;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool _write_cff1 (const cff_subset_plan &plan,
|
static inline bool _write_cff1 (const cff_subset_plan &plan,
|
||||||
|
|
|
@ -36,9 +36,9 @@ using namespace CFF;
|
||||||
|
|
||||||
struct cff2_sub_table_offsets_t : cff_sub_table_offsets_t
|
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 (),
|
: cff_sub_table_offsets_t (),
|
||||||
varStoreOffset (0)
|
varStoreOffset (0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
unsigned int varStoreOffset;
|
unsigned int varStoreOffset;
|
||||||
|
@ -46,9 +46,9 @@ struct cff2_sub_table_offsets_t : cff_sub_table_offsets_t
|
||||||
|
|
||||||
struct cff2_top_dict_op_serializer_t : cff_top_dict_op_serializer_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 op_str_t &opstr,
|
||||||
const cff2_sub_table_offsets_t &offsets) const
|
const cff2_sub_table_offsets_t &offsets) const
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
||||||
|
@ -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>
|
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)
|
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 ();)
|
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);
|
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 */
|
/* flatten the default values */
|
||||||
str_encoder_t encoder (param.flatStr);
|
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);
|
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)
|
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>
|
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) {
|
switch (op) {
|
||||||
|
|
||||||
|
@ -208,9 +208,9 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
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_cs_interp_env_t &env, subr_subset_param_t& param,
|
||||||
cff2_biased_subrs_t& subrs, hb_set_t *closure)
|
cff2_biased_subrs_t& subrs, hb_set_t *closure)
|
||||||
{
|
{
|
||||||
byte_str_ref_t str_ref = env.str_ref;
|
byte_str_ref_t str_ref = env.str_ref;
|
||||||
env.callSubr (subrs, type);
|
env.callSubr (subrs, type);
|
||||||
|
@ -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>
|
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 */
|
/* vsindex is inserted at the beginning of the charstring as necessary */
|
||||||
if (env.seen_vsindex ())
|
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 {
|
struct cff2_subset_plan {
|
||||||
cff2_subset_plan ()
|
inline cff2_subset_plan ()
|
||||||
: final_size (0),
|
: final_size (0),
|
||||||
orig_fdcount (0),
|
orig_fdcount (0),
|
||||||
subset_fdcount(1),
|
subset_fdcount(1),
|
||||||
|
@ -254,7 +254,7 @@ struct cff2_subset_plan {
|
||||||
privateDictInfos.init ();
|
privateDictInfos.init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~cff2_subset_plan ()
|
inline ~cff2_subset_plan ()
|
||||||
{
|
{
|
||||||
subset_fdselect_ranges.fini ();
|
subset_fdselect_ranges.fini ();
|
||||||
fdmap.fini ();
|
fdmap.fini ();
|
||||||
|
@ -264,8 +264,8 @@ struct cff2_subset_plan {
|
||||||
privateDictInfos.fini ();
|
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)
|
hb_subset_plan_t *plan)
|
||||||
{
|
{
|
||||||
final_size = 0;
|
final_size = 0;
|
||||||
orig_fdcount = acc.fdArray->count;
|
orig_fdcount = acc.fdArray->count;
|
||||||
|
@ -342,7 +342,7 @@ struct cff2_subset_plan {
|
||||||
final_size += offsets.globalSubrsInfo.size;
|
final_size += offsets.globalSubrsInfo.size;
|
||||||
|
|
||||||
/* variation store */
|
/* variation store */
|
||||||
if (acc.varStore != &Null(CFF2VariationStore))
|
if (acc.varStore != &Null(cff2_variation_store_t))
|
||||||
{
|
{
|
||||||
offsets.varStoreOffset = final_size;
|
offsets.varStoreOffset = final_size;
|
||||||
final_size += acc.varStore->get_size ();
|
final_size += acc.varStore->get_size ();
|
||||||
|
@ -412,26 +412,26 @@ struct cff2_subset_plan {
|
||||||
return true;
|
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;
|
unsigned int final_size;
|
||||||
cff2_sub_table_offsets_t offsets;
|
cff2_sub_table_offsets_t offsets;
|
||||||
|
|
||||||
unsigned int orig_fdcount;
|
unsigned int orig_fdcount;
|
||||||
unsigned int subset_fdcount;
|
unsigned int subset_fdcount;
|
||||||
unsigned int subset_fdselect_format;
|
unsigned int subset_fdselect_format;
|
||||||
hb_vector_t<code_pair_t> subset_fdselect_ranges;
|
hb_vector_t<code_pair_t> subset_fdselect_ranges;
|
||||||
|
|
||||||
remap_t fdmap;
|
remap_t fdmap;
|
||||||
|
|
||||||
str_buff_vec_t subset_charstrings;
|
str_buff_vec_t subset_charstrings;
|
||||||
str_buff_vec_t subset_globalsubrs;
|
str_buff_vec_t subset_globalsubrs;
|
||||||
hb_vector_t<str_buff_vec_t> subset_localsubrs;
|
hb_vector_t<str_buff_vec_t> subset_localsubrs;
|
||||||
hb_vector_t<table_info_t> privateDictInfos;
|
hb_vector_t<table_info_t> privateDictInfos;
|
||||||
|
|
||||||
bool drop_hints;
|
bool drop_hints;
|
||||||
bool desubroutinize;
|
bool desubroutinize;
|
||||||
cff2_subr_subsetter_t subr_subsetter;
|
cff2_subr_subsetter_t subr_subsetter;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool _write_cff2 (const cff2_subset_plan &plan,
|
static inline bool _write_cff2 (const cff2_subset_plan &plan,
|
||||||
|
@ -477,10 +477,10 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* variation store */
|
/* variation store */
|
||||||
if (acc.varStore != &Null(CFF2VariationStore))
|
if (acc.varStore != &Null(cff2_variation_store_t))
|
||||||
{
|
{
|
||||||
assert (plan.offsets.varStoreOffset == c.head - c.start);
|
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)))
|
if (unlikely (!dest->serialize (&c, acc.varStore)))
|
||||||
{
|
{
|
||||||
DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 Variation Store");
|
DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 Variation Store");
|
||||||
|
|
|
@ -33,6 +33,6 @@
|
||||||
|
|
||||||
HB_INTERNAL bool
|
HB_INTERNAL bool
|
||||||
hb_subset_cff2 (hb_subset_plan_t *plan,
|
hb_subset_cff2 (hb_subset_plan_t *plan,
|
||||||
hb_blob_t **cff2_prime /* OUT */);
|
hb_blob_t **cff2_prime /* OUT */);
|
||||||
|
|
||||||
#endif /* HB_SUBSET_CFF2_HH */
|
#endif /* HB_SUBSET_CFF2_HH */
|
||||||
|
|
Loading…
Reference in New Issue