Remove redundant 'inline' from methods (#1483)

This commit is contained in:
Ebrahim Byagowi 2018-12-16 22:38:10 +03:30 committed by Behdad Esfahbod
parent 7251c77290
commit b2ebaa9afa
97 changed files with 2911 additions and 2987 deletions

View File

@ -40,11 +40,11 @@ namespace AAT {
struct FontDescriptor
{
inline bool has_data (void) const { return tag; }
bool has_data (void) const { return tag; }
inline int cmp (hb_tag_t a) const { return tag.cmp (a); }
int cmp (hb_tag_t a) const { return tag.cmp (a); }
inline float get_value (void) const { return u.value.to_float (); }
float get_value (void) const { return u.value.to_float (); }
enum non_alphabetic_value_t {
Alphabetic = 0,
@ -56,7 +56,7 @@ struct FontDescriptor
MathSymbols = 6
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -97,10 +97,10 @@ struct fdsc
* (default value: 0) */
};
inline const FontDescriptor &get_descriptor (hb_tag_t style) const
const FontDescriptor &get_descriptor (hb_tag_t style) const
{ return descriptors.lsearch (style); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -41,7 +41,7 @@ using namespace OT;
struct Anchor
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -60,10 +60,10 @@ struct ankr
{
enum { tableTag = HB_AAT_TAG_ankr };
inline const Anchor &get_anchor (hb_codepoint_t glyph_id,
unsigned int i,
unsigned int num_glyphs,
const char *end) const
const Anchor &get_anchor (hb_codepoint_t glyph_id,
unsigned int i,
unsigned int num_glyphs,
const char *end) const
{
const Offset<HBUINT16, false> *offset = (this+lookupTable).get_value (glyph_id, num_glyphs);
if (!offset)
@ -75,7 +75,7 @@ struct ankr
return anchors[i];
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -39,7 +39,7 @@ namespace AAT {
struct BaselineTableFormat0Part
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -57,7 +57,7 @@ struct BaselineTableFormat0Part
struct BaselineTableFormat1Part
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -75,7 +75,7 @@ struct BaselineTableFormat1Part
struct BaselineTableFormat2Part
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -98,7 +98,7 @@ struct BaselineTableFormat2Part
struct BaselineTableFormat3Part
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && lookupTable.sanitize (c));
@ -118,13 +118,14 @@ struct bsln
{
enum { tableTag = HB_AAT_TAG_bsln };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this) && defaultBaseline < 32)))
return_trace (false);
switch (format) {
switch (format)
{
case 0: return_trace (parts.format0.sanitize (c));
case 1: return_trace (parts.format1.sanitize (c));
case 2: return_trace (parts.format2.sanitize (c));

View File

@ -48,18 +48,18 @@ struct LookupFormat0
friend struct Lookup<T>;
private:
inline const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
{
if (unlikely (glyph_id >= num_glyphs)) return nullptr;
return &arrayZ[glyph_id];
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (arrayZ.sanitize (c, c->get_num_glyphs ()));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (arrayZ.sanitize (c, c->get_num_glyphs (), base));
@ -79,16 +79,15 @@ struct LookupSegmentSingle
{
enum { TerminationWordCount = 2 };
inline int cmp (hb_codepoint_t g) const {
return g < first ? -1 : g <= last ? 0 : +1 ;
}
int cmp (hb_codepoint_t g) const
{ return g < first ? -1 : g <= last ? 0 : +1 ; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c, base));
@ -107,18 +106,18 @@ struct LookupFormat2
friend struct Lookup<T>;
private:
inline const T* get_value (hb_codepoint_t glyph_id) const
const T* get_value (hb_codepoint_t glyph_id) const
{
const LookupSegmentSingle<T> *v = segments.bsearch (glyph_id);
return v ? &v->value : nullptr;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (segments.sanitize (c));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (segments.sanitize (c, base));
@ -139,16 +138,15 @@ struct LookupSegmentArray
{
enum { TerminationWordCount = 2 };
inline const T* get_value (hb_codepoint_t glyph_id, const void *base) const
const T* get_value (hb_codepoint_t glyph_id, const void *base) const
{
return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr;
}
inline int cmp (hb_codepoint_t g) const {
return g < first ? -1 : g <= last ? 0 : +1 ;
}
int cmp (hb_codepoint_t g) const
{ return g < first ? -1 : g <= last ? 0 : +1; }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -156,7 +154,7 @@ struct LookupSegmentArray
valuesZ.sanitize (c, base, last - first + 1));
}
template <typename T2>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T2 user_data) const
bool sanitize (hb_sanitize_context_t *c, const void *base, T2 user_data) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -179,18 +177,18 @@ struct LookupFormat4
friend struct Lookup<T>;
private:
inline const T* get_value (hb_codepoint_t glyph_id) const
const T* get_value (hb_codepoint_t glyph_id) const
{
const LookupSegmentArray<T> *v = segments.bsearch (glyph_id);
return v ? v->get_value (glyph_id, this) : nullptr;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (segments.sanitize (c, this));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (segments.sanitize (c, this, base));
@ -211,14 +209,14 @@ struct LookupSingle
{
enum { TerminationWordCount = 1 };
inline int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c, base));
@ -236,18 +234,18 @@ struct LookupFormat6
friend struct Lookup<T>;
private:
inline const T* get_value (hb_codepoint_t glyph_id) const
const T* get_value (hb_codepoint_t glyph_id) const
{
const LookupSingle<T> *v = entries.bsearch (glyph_id);
return v ? &v->value : nullptr;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (entries.sanitize (c));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (entries.sanitize (c, base));
@ -267,18 +265,18 @@ struct LookupFormat8
friend struct Lookup<T>;
private:
inline const T* get_value (hb_codepoint_t glyph_id) const
const T* get_value (hb_codepoint_t glyph_id) const
{
return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ?
&valueArrayZ[glyph_id - firstGlyph] : nullptr;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount, base));
@ -302,7 +300,7 @@ struct LookupFormat10
friend struct Lookup<T>;
private:
inline const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const
const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const
{
if (!(firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount))
return Null(T);
@ -317,7 +315,7 @@ struct LookupFormat10
return v;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -341,7 +339,7 @@ struct LookupFormat10
template <typename T>
struct Lookup
{
inline const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
{
switch (u.format) {
case 0: return u.format0.get_value (glyph_id, num_glyphs);
@ -353,7 +351,7 @@ struct Lookup
}
}
inline const typename T::type get_value_or_null (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
const typename T::type get_value_or_null (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
{
switch (u.format) {
/* Format 10 cannot return a pointer. */
@ -364,15 +362,15 @@ struct Lookup
}
}
inline typename T::type get_class (hb_codepoint_t glyph_id,
unsigned int num_glyphs,
unsigned int outOfRange) const
typename T::type get_class (hb_codepoint_t glyph_id,
unsigned int num_glyphs,
unsigned int outOfRange) const
{
const T *v = get_value (glyph_id, num_glyphs);
return v ? *v : outOfRange;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
@ -386,7 +384,7 @@ struct Lookup
default:return_trace (true);
}
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
@ -443,7 +441,7 @@ enum { DELETED_GLYPH = 0xFFFF };
template <typename T>
struct Entry
{
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
{
TRACE_SANITIZE (this);
/* Note, we don't recurse-sanitize data because we don't access it.
@ -471,7 +469,7 @@ struct Entry
template <>
struct Entry<void>
{
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count /*XXX Unused?*/) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count /*XXX Unused?*/) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -504,19 +502,19 @@ struct StateTable
CLASS_END_OF_LINE = 3,
};
inline int new_state (unsigned int newState) const
int new_state (unsigned int newState) const
{ return Types::extended ? newState : ((int) newState - (int) stateArrayTable) / (int) nClasses; }
inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
{
if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH;
return (this+classTable).get_class (glyph_id, num_glyphs, 1);
}
inline const Entry<Extra> *get_entries (void) const
const Entry<Extra> *get_entries (void) const
{ return (this+entryTable).arrayZ; }
inline const Entry<Extra> *get_entryZ (int state, unsigned int klass) const
const Entry<Extra> *get_entryZ (int state, unsigned int klass) const
{
if (unlikely (klass >= nClasses)) return nullptr;
@ -529,8 +527,8 @@ struct StateTable
return &entries[entry];
}
inline bool sanitize (hb_sanitize_context_t *c,
unsigned int *num_entries_out = nullptr) const
bool sanitize (hb_sanitize_context_t *c,
unsigned int *num_entries_out = nullptr) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this) &&
@ -648,18 +646,18 @@ struct StateTable
template <typename HBUCHAR>
struct ClassTable
{
inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int outOfRange) const
unsigned int get_class (hb_codepoint_t glyph_id, unsigned int outOfRange) const
{
unsigned int i = glyph_id - firstGlyph;
return i >= classArray.len ? outOfRange : classArray.arrayZ[i];
}
inline unsigned int get_class (hb_codepoint_t glyph_id,
unsigned int num_glyphs HB_UNUSED,
unsigned int outOfRange) const
unsigned int get_class (hb_codepoint_t glyph_id,
unsigned int num_glyphs HB_UNUSED,
unsigned int outOfRange) const
{
return get_class (glyph_id, outOfRange);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && classArray.sanitize (c));
@ -681,23 +679,23 @@ struct ObsoleteTypes
typedef ClassTable<HBUINT16> ClassTypeWide;
template <typename T>
static inline unsigned int offsetToIndex (unsigned int offset,
const void *base,
const T *array)
static unsigned int offsetToIndex (unsigned int offset,
const void *base,
const T *array)
{
return (offset - ((const char *) array - (const char *) base)) / sizeof (T);
}
template <typename T>
static inline unsigned int byteOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
static unsigned int byteOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
{
return offsetToIndex (offset, base, array);
}
template <typename T>
static inline unsigned int wordOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
static unsigned int wordOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
{
return offsetToIndex (2 * offset, base, array);
}
@ -711,23 +709,23 @@ struct ExtendedTypes
typedef Lookup<HBUINT16> ClassTypeWide;
template <typename T>
static inline unsigned int offsetToIndex (unsigned int offset,
const void *base,
const T *array)
static unsigned int offsetToIndex (unsigned int offset,
const void *base,
const T *array)
{
return offset;
}
template <typename T>
static inline unsigned int byteOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
static unsigned int byteOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
{
return offset / 2;
}
template <typename T>
static inline unsigned int wordOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
static unsigned int wordOffsetToIndex (unsigned int offset,
const void *base,
const T *array)
{
return offset;
}
@ -736,15 +734,15 @@ struct ExtendedTypes
template <typename Types, typename EntryData>
struct StateTableDriver
{
inline StateTableDriver (const StateTable<Types, EntryData> &machine_,
hb_buffer_t *buffer_,
hb_face_t *face_) :
StateTableDriver (const StateTable<Types, EntryData> &machine_,
hb_buffer_t *buffer_,
hb_face_t *face_) :
machine (machine_),
buffer (buffer_),
num_glyphs (face_->get_num_glyphs ()) {}
template <typename context_t>
inline void drive (context_t *c)
void drive (context_t *c)
{
if (!c->in_place)
buffer->clear_output ();
@ -818,9 +816,9 @@ struct ankr;
struct hb_aat_apply_context_t :
hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
{
inline const char *get_name (void) { return "APPLY"; }
const char *get_name (void) { return "APPLY"; }
template <typename T>
inline return_t dispatch (const T &obj) { return obj.apply (this); }
return_t dispatch (const T &obj) { return obj.apply (this); }
static return_t default_return_value (void) { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; }
@ -845,7 +843,7 @@ struct hb_aat_apply_context_t :
HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_, const char *ankr_end_);
inline void set_lookup_index (unsigned int i) { lookup_index = i; }
void set_lookup_index (unsigned int i) { lookup_index = i; }
};

View File

@ -44,10 +44,10 @@ struct SettingName
int cmp (hb_aat_layout_feature_selector_t key) const
{ return (int) key - (int) setting; }
inline hb_aat_layout_feature_selector_t get_selector (void) const
hb_aat_layout_feature_selector_t get_selector (void) const
{ return (hb_aat_layout_feature_selector_t) (unsigned) setting; }
inline void get_info (hb_aat_layout_feature_selector_info_t *s,
void get_info (hb_aat_layout_feature_selector_info_t *s,
hb_aat_layout_feature_selector_t default_selector) const
{
s->name_id = nameIndex;
@ -60,7 +60,7 @@ struct SettingName
s->reserved = 0;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -95,11 +95,11 @@ struct FeatureName
* as the default. */
};
inline unsigned int get_selector_infos (unsigned int start_offset,
unsigned int *selectors_count, /* IN/OUT. May be NULL. */
hb_aat_layout_feature_selector_info_t *selectors, /* OUT. May be NULL. */
unsigned int *pdefault_index, /* OUT. May be NULL. */
const void *base) const
unsigned int get_selector_infos (unsigned int start_offset,
unsigned int *selectors_count, /* IN/OUT. May be NULL. */
hb_aat_layout_feature_selector_info_t *selectors, /* OUT. May be NULL. */
unsigned int *pdefault_index, /* OUT. May be NULL. */
const void *base) const
{
hb_array_t< const SettingName> settings_table = (base+settingTableZ).as_array (nSettings);
@ -125,12 +125,12 @@ struct FeatureName
return settings_table.len;
}
inline hb_aat_layout_feature_type_t get_feature_type (void) const
hb_aat_layout_feature_type_t get_feature_type (void) const
{ return (hb_aat_layout_feature_type_t) (unsigned int) feature; }
inline hb_ot_name_id_t get_feature_name_id (void) const { return nameIndex; }
hb_ot_name_id_t get_feature_name_id (void) const { return nameIndex; }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -157,11 +157,11 @@ struct feat
{
enum { tableTag = HB_AAT_TAG_feat };
inline bool has_data (void) const { return version.to_int (); }
bool has_data (void) const { return version.to_int (); }
inline unsigned int get_feature_types (unsigned int start_offset,
unsigned int *count,
hb_aat_layout_feature_type_t *features) const
unsigned int get_feature_types (unsigned int start_offset,
unsigned int *count,
hb_aat_layout_feature_type_t *features) const
{
unsigned int feature_count = featureNameCount;
if (count && *count)
@ -174,25 +174,25 @@ struct feat
return featureNameCount;
}
inline const FeatureName& get_feature (hb_aat_layout_feature_type_t feature_type) const
const FeatureName& get_feature (hb_aat_layout_feature_type_t feature_type) const
{
return namesZ.bsearch (featureNameCount, feature_type);
}
inline hb_ot_name_id_t get_feature_name_id (hb_aat_layout_feature_type_t feature) const
hb_ot_name_id_t get_feature_name_id (hb_aat_layout_feature_type_t feature) const
{ return get_feature (feature).get_feature_name_id (); }
inline unsigned int get_selector_infos (hb_aat_layout_feature_type_t feature_type,
unsigned int start_offset,
unsigned int *selectors_count, /* IN/OUT. May be NULL. */
hb_aat_layout_feature_selector_info_t *selectors, /* OUT. May be NULL. */
unsigned int *default_index /* OUT. May be NULL. */) const
unsigned int get_selector_infos (hb_aat_layout_feature_type_t feature_type,
unsigned int start_offset,
unsigned int *selectors_count, /* IN/OUT. May be NULL. */
hb_aat_layout_feature_selector_info_t *selectors, /* OUT. May be NULL. */
unsigned int *default_index /* OUT. May be NULL. */) const
{
return get_feature (feature_type).get_selector_infos (start_offset, selectors_count, selectors,
default_index, this);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -45,7 +45,7 @@ using namespace OT;
struct ActionSubrecordHeader
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -62,7 +62,7 @@ struct ActionSubrecordHeader
struct DecompositionAction
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -91,7 +91,7 @@ struct DecompositionAction
struct UnconditionalAddGlyphAction
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -109,7 +109,7 @@ struct UnconditionalAddGlyphAction
struct ConditionalAddGlyphAction
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -134,7 +134,7 @@ struct ConditionalAddGlyphAction
struct DuctileGlyphAction
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -160,7 +160,7 @@ struct DuctileGlyphAction
struct RepeatedAddGlyphAction
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -178,9 +178,9 @@ struct RepeatedAddGlyphAction
struct ActionSubrecord
{
inline unsigned int get_length (void) const { return u.header.actionLength; }
unsigned int get_length (void) const { return u.header.actionLength; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this)))
@ -215,7 +215,7 @@ struct ActionSubrecord
struct PostcompensationActionChain
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this)))
@ -291,7 +291,7 @@ struct JustWidthDeltaEntry
struct WidthDeltaPair
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -328,7 +328,7 @@ struct JustificationCategory
* glyph if nonzero. */
};
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -347,7 +347,7 @@ struct JustificationCategory
struct JustificationHeader
{
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -384,7 +384,7 @@ struct just
{
enum { tableTag = HB_AAT_TAG_just };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);

View File

@ -66,17 +66,17 @@ struct hb_glyph_pair_t
struct KernPair
{
inline int get_kerning (void) const
int get_kerning (void) const
{ return value; }
inline int cmp (const hb_glyph_pair_t &o) const
int cmp (const hb_glyph_pair_t &o) const
{
int ret = left.cmp (o.left);
if (ret) return ret;
return right.cmp (o.right);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -93,15 +93,15 @@ struct KernPair
template <typename KernSubTableHeader>
struct KerxSubTableFormat0
{
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
hb_aat_apply_context_t *c = nullptr) const
int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
hb_aat_apply_context_t *c = nullptr) const
{
hb_glyph_pair_t pair = {left, right};
int v = pairs.bsearch (pair).get_kerning ();
return kerxTupleKern (v, header.tuple_count (), this, c);
}
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -123,16 +123,16 @@ struct KerxSubTableFormat0
const KerxSubTableFormat0 &table;
hb_aat_apply_context_t *c;
inline accelerator_t (const KerxSubTableFormat0 &table_,
hb_aat_apply_context_t *c_) :
table (table_), c (c_) {}
accelerator_t (const KerxSubTableFormat0 &table_,
hb_aat_apply_context_t *c_) :
table (table_), c (c_) {}
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{ return table.get_kerning (left, right, c); }
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (pairs.sanitize (c)));
@ -171,10 +171,10 @@ struct Format1Entry<true>
DEFINE_SIZE_STATIC (2);
};
static inline bool performAction (const Entry<EntryData> *entry)
static bool performAction (const Entry<EntryData> *entry)
{ return entry->data.kernActionIndex != 0xFFFF; }
static inline unsigned int kernActionIndex (const Entry<EntryData> *entry)
static unsigned int kernActionIndex (const Entry<EntryData> *entry)
{ return entry->data.kernActionIndex; }
};
template <>
@ -193,10 +193,10 @@ struct Format1Entry<false>
typedef void EntryData;
static inline bool performAction (const Entry<EntryData> *entry)
static bool performAction (const Entry<EntryData> *entry)
{ return entry->flags & Offset; }
static inline unsigned int kernActionIndex (const Entry<EntryData> *entry)
static unsigned int kernActionIndex (const Entry<EntryData> *entry)
{ return entry->flags & Offset; }
};
@ -217,8 +217,8 @@ struct KerxSubTableFormat1
DontAdvance = Format1EntryT::DontAdvance,
};
inline driver_context_t (const KerxSubTableFormat1 *table_,
hb_aat_apply_context_t *c_) :
driver_context_t (const KerxSubTableFormat1 *table_,
hb_aat_apply_context_t *c_) :
c (c_),
table (table_),
/* Apparently the offset kernAction is from the beginning of the state-machine,
@ -228,13 +228,13 @@ struct KerxSubTableFormat1
depth (0),
crossStream (table->header.coverage & table->header.CrossStream) {}
inline bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
{
return Format1EntryT::performAction (entry);
}
inline bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
unsigned int flags = entry->flags;
@ -348,7 +348,7 @@ struct KerxSubTableFormat1
bool crossStream;
};
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -364,7 +364,7 @@ struct KerxSubTableFormat1
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
/* The rest of array sanitizations are done at run-time. */
@ -386,8 +386,8 @@ struct KerxSubTableFormat2
typedef typename KernSubTableHeader::Types Types;
typedef typename Types::HBUINT HBUINT;
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
hb_aat_apply_context_t *c) const
int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
hb_aat_apply_context_t *c) const
{
unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
unsigned int l = (this+leftClassTable).get_class (left, num_glyphs, 0);
@ -402,7 +402,7 @@ struct KerxSubTableFormat2
return kerxTupleKern (*v, header.tuple_count (), this, c);
}
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -424,15 +424,15 @@ struct KerxSubTableFormat2
const KerxSubTableFormat2 &table;
hb_aat_apply_context_t *c;
inline accelerator_t (const KerxSubTableFormat2 &table_,
hb_aat_apply_context_t *c_) :
table (table_), c (c_) {}
accelerator_t (const KerxSubTableFormat2 &table_,
hb_aat_apply_context_t *c_) :
table (table_), c (c_) {}
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{ return table.get_kerning (left, right, c); }
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -490,7 +490,7 @@ struct KerxSubTableFormat4
* point table. */
};
inline driver_context_t (const KerxSubTableFormat4 *table,
driver_context_t (const KerxSubTableFormat4 *table,
hb_aat_apply_context_t *c_) :
c (c_),
action_type ((table->flags & ActionType) >> 30),
@ -498,13 +498,13 @@ struct KerxSubTableFormat4
mark_set (false),
mark (0) {}
inline bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
{
return entry->data.ankrActionIndex != 0xFFFF;
}
inline bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
@ -599,7 +599,7 @@ struct KerxSubTableFormat4
unsigned int mark;
};
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -611,7 +611,7 @@ struct KerxSubTableFormat4
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
/* The rest of array sanitizations are done at run-time. */
@ -635,9 +635,9 @@ struct KerxSubTableFormat6
ValuesAreLong = 0x00000001,
};
inline bool is_long (void) const { return flags & ValuesAreLong; }
bool is_long (void) const { return flags & ValuesAreLong; }
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
hb_aat_apply_context_t *c) const
{
unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
@ -665,7 +665,7 @@ struct KerxSubTableFormat6
}
}
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -682,7 +682,7 @@ struct KerxSubTableFormat6
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -705,11 +705,11 @@ struct KerxSubTableFormat6
const KerxSubTableFormat6 &table;
hb_aat_apply_context_t *c;
inline accelerator_t (const KerxSubTableFormat6 &table_,
hb_aat_apply_context_t *c_) :
table (table_), c (c_) {}
accelerator_t (const KerxSubTableFormat6 &table_,
hb_aat_apply_context_t *c_) :
table (table_), c (c_) {}
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{ return table.get_kerning (left, right, c); }
};
@ -743,8 +743,8 @@ struct KerxSubTableHeader
{
typedef ExtendedTypes Types;
inline unsigned int tuple_count (void) const { return tupleCount; }
inline bool is_horizontal (void) const { return !(coverage & Vertical); }
unsigned int tuple_count (void) const { return tupleCount; }
bool is_horizontal (void) const { return !(coverage & Vertical); }
enum Coverage
{
@ -760,7 +760,7 @@ struct KerxSubTableHeader
SubtableType= 0x000000FFu, /* Subtable type. */
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -778,11 +778,11 @@ struct KerxSubTable
{
friend struct kerx;
inline unsigned int get_size (void) const { return u.header.length; }
inline unsigned int get_type (void) const { return u.header.coverage & u.header.SubtableType; }
unsigned int get_size (void) const { return u.header.length; }
unsigned int get_type (void) const { return u.header.coverage & u.header.SubtableType; }
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
@ -796,7 +796,7 @@ struct KerxSubTable
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.header.sanitize (c) ||
@ -829,9 +829,9 @@ template <typename T>
struct KerxTable
{
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
inline const T* thiz (void) const { return static_cast<const T *> (this); }
const T* thiz (void) const { return static_cast<const T *> (this); }
inline bool has_state_machine (void) const
bool has_state_machine (void) const
{
typedef typename T::SubTable SubTable;
@ -846,7 +846,7 @@ struct KerxTable
return false;
}
inline bool has_cross_stream (void) const
bool has_cross_stream (void) const
{
typedef typename T::SubTable SubTable;
@ -861,7 +861,7 @@ struct KerxTable
return false;
}
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{
typedef typename T::SubTable SubTable;
@ -879,7 +879,7 @@ struct KerxTable
return v;
}
inline bool apply (AAT::hb_aat_apply_context_t *c) const
bool apply (AAT::hb_aat_apply_context_t *c) const
{
typedef typename T::SubTable SubTable;
@ -943,7 +943,7 @@ struct KerxTable
return ret;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!thiz()->version.sanitize (c) ||
@ -989,7 +989,7 @@ struct kerx : KerxTable<kerx>
typedef SubTableHeader::Types Types;
typedef KerxSubTable SubTable;
inline bool has_data (void) const { return version; }
bool has_data (void) const { return version; }
protected:
HBUINT16 version; /* The version number of the extended kerning table

View File

@ -42,12 +42,12 @@ struct lcar
{
enum { tableTag = HB_AAT_TAG_lcar };
inline unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
{
const OffsetTo<LigCaretClassEntry>* entry_offset = lookup.get_value (glyph,
font->face->get_num_glyphs ());
@ -70,7 +70,7 @@ struct lcar
return array.len;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -69,17 +69,17 @@ struct RearrangementSubtable
Verb = 0x000F, /* The type of rearrangement specified. */
};
inline driver_context_t (const RearrangementSubtable *table HB_UNUSED) :
driver_context_t (const RearrangementSubtable *table HB_UNUSED) :
ret (false),
start (0), end (0) {}
inline bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
{
return (entry->flags & Verb) && start < end;
}
inline bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
unsigned int flags = entry->flags;
@ -163,7 +163,7 @@ struct RearrangementSubtable
unsigned int end;
};
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -175,7 +175,7 @@ struct RearrangementSubtable
return_trace (dc.ret);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (machine.sanitize (c));
@ -213,7 +213,7 @@ struct ContextualSubtable
Reserved = 0x3FFF, /* These bits are reserved and should be set to 0. */
};
inline driver_context_t (const ContextualSubtable *table_,
driver_context_t (const ContextualSubtable *table_,
hb_aat_apply_context_t *c_) :
ret (false),
c (c_),
@ -222,8 +222,8 @@ struct ContextualSubtable
table (table_),
subs (table+table->substitutionTables) {}
inline bool is_actionable (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
bool is_actionable (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
@ -232,8 +232,8 @@ struct ContextualSubtable
return entry->data.markIndex != 0xFFFF || entry->data.currentIndex != 0xFFFF;
}
inline bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
@ -311,7 +311,7 @@ struct ContextualSubtable
const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT, false> &subs;
};
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -323,7 +323,7 @@ struct ContextualSubtable
return_trace (dc.ret);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -384,10 +384,10 @@ struct LigatureEntry<true>
DEFINE_SIZE_STATIC (2);
};
static inline bool performAction (const Entry<EntryData> *entry)
static bool performAction (const Entry<EntryData> *entry)
{ return entry->flags & PerformAction; }
static inline unsigned int ligActionIndex (const Entry<EntryData> *entry)
static unsigned int ligActionIndex (const Entry<EntryData> *entry)
{ return entry->data.ligActionIndex; }
};
template <>
@ -406,10 +406,10 @@ struct LigatureEntry<false>
typedef void EntryData;
static inline bool performAction (const Entry<EntryData> *entry)
static bool performAction (const Entry<EntryData> *entry)
{ return entry->flags & Offset; }
static inline unsigned int ligActionIndex (const Entry<EntryData> *entry)
static unsigned int ligActionIndex (const Entry<EntryData> *entry)
{ return entry->flags & Offset; }
};
@ -441,8 +441,8 @@ struct LigatureSubtable
* into the component table. */
};
inline driver_context_t (const LigatureSubtable *table_,
hb_aat_apply_context_t *c_) :
driver_context_t (const LigatureSubtable *table_,
hb_aat_apply_context_t *c_) :
ret (false),
c (c_),
table (table_),
@ -451,13 +451,13 @@ struct LigatureSubtable
ligature (table+table->ligature),
match_length (0) {}
inline bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
{
return LigatureEntryT::performAction (entry);
}
inline bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
@ -567,7 +567,7 @@ struct LigatureSubtable
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
};
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -579,7 +579,7 @@ struct LigatureSubtable
return_trace (dc.ret);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
/* The rest of array sanitizations are done at run-time. */
@ -603,7 +603,7 @@ struct LigatureSubtable
template <typename Types>
struct NoncontextualSubtable
{
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -625,7 +625,7 @@ struct NoncontextualSubtable
return_trace (ret);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (substitute.sanitize (c));
@ -709,22 +709,22 @@ struct InsertionSubtable
* marked location is 31 glyphs. */
};
inline driver_context_t (const InsertionSubtable *table,
hb_aat_apply_context_t *c_) :
driver_context_t (const InsertionSubtable *table,
hb_aat_apply_context_t *c_) :
ret (false),
c (c_),
mark_set (false),
mark (0),
insertionAction (table+table->insertionAction) {}
inline bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> *entry)
{
return (entry->flags & (CurrentInsertCount | MarkedInsertCount)) &&
(entry->data.currentInsertIndex != 0xFFFF ||entry->data.markedInsertIndex != 0xFFFF);
}
inline bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
bool transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> *entry)
{
hb_buffer_t *buffer = driver->buffer;
unsigned int flags = entry->flags;
@ -809,7 +809,7 @@ struct InsertionSubtable
const UnsizedArrayOf<GlyphID> &insertionAction;
};
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -821,7 +821,7 @@ struct InsertionSubtable
return_trace (dc.ret);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
/* The rest of array sanitizations are done at run-time. */
@ -842,7 +842,7 @@ struct InsertionSubtable
struct Feature
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -868,9 +868,9 @@ struct ChainSubtable
template <typename T>
friend struct Chain;
inline unsigned int get_size (void) const { return length; }
inline unsigned int get_type (void) const { return coverage & 0xFF; }
inline unsigned int get_coverage (void) const { return coverage >> (sizeof (HBUINT) * 8 - 8); }
unsigned int get_size (void) const { return length; }
unsigned int get_type (void) const { return coverage & 0xFF; }
unsigned int get_coverage (void) const { return coverage >> (sizeof (HBUINT) * 8 - 8); }
enum Coverage
{
@ -897,7 +897,7 @@ struct ChainSubtable
};
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
@ -911,14 +911,14 @@ struct ChainSubtable
}
}
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_sanitize_with_object_t with (&c->sanitizer, this);
return_trace (dispatch (c));
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!length.sanitize (c) ||
@ -950,7 +950,7 @@ struct Chain
{
typedef typename Types::HBUINT HBUINT;
inline hb_mask_t compile_flags (const hb_aat_map_builder_t *map) const
hb_mask_t compile_flags (const hb_aat_map_builder_t *map) const
{
hb_mask_t flags = defaultFlags;
{
@ -979,7 +979,7 @@ struct Chain
return flags;
}
inline void apply (hb_aat_apply_context_t *c,
void apply (hb_aat_apply_context_t *c,
hb_mask_t flags) const
{
const ChainSubtable<Types> *subtable = &StructAfter<ChainSubtable<Types> > (featureZ.as_array (featureCount));
@ -1049,9 +1049,9 @@ struct Chain
}
}
inline unsigned int get_size (void) const { return length; }
unsigned int get_size (void) const { return length; }
inline bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const
bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const
{
TRACE_SANITIZE (this);
if (!length.sanitize (c) ||
@ -1098,10 +1098,10 @@ struct mortmorx
{
enum { tableTag = HB_AAT_TAG_morx };
inline bool has_data (void) const { return version != 0; }
bool has_data (void) const { return version != 0; }
inline void compile_flags (const hb_aat_map_builder_t *mapper,
hb_aat_map_t *map) const
void compile_flags (const hb_aat_map_builder_t *mapper,
hb_aat_map_t *map) const
{
const Chain<Types> *chain = &firstChain;
unsigned int count = chainCount;
@ -1112,7 +1112,7 @@ struct mortmorx
}
}
inline void apply (hb_aat_apply_context_t *c) const
void apply (hb_aat_apply_context_t *c) const
{
if (unlikely (!c->buffer->successful)) return;
c->set_lookup_index (0);
@ -1126,7 +1126,7 @@ struct mortmorx
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!version.sanitize (c) || !version || !chainCount.sanitize (c))

View File

@ -46,15 +46,15 @@ struct TrackTableEntry
{
friend struct TrackData;
inline float get_track_value (void) const { return track.to_float (); }
float get_track_value (void) const { return track.to_float (); }
inline int get_value (const void *base, unsigned int index,
unsigned int table_size) const
int get_value (const void *base, unsigned int index,
unsigned int table_size) const
{ return (base+valuesZ).as_array (table_size)[index]; }
public:
inline bool sanitize (hb_sanitize_context_t *c, const void *base,
unsigned int table_size) const
bool sanitize (hb_sanitize_context_t *c, const void *base,
unsigned int table_size) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -76,10 +76,10 @@ struct TrackTableEntry
struct TrackData
{
inline float interpolate_at (unsigned int idx,
float target_size,
const TrackTableEntry &trackTableEntry,
const void *base) const
float interpolate_at (unsigned int idx,
float target_size,
const TrackTableEntry &trackTableEntry,
const void *base) const
{
unsigned int sizes = nSizes;
hb_array_t<const Fixed> size_table ((base+sizeTable).arrayZ, sizes);
@ -91,7 +91,7 @@ struct TrackData
(1.f - t) * trackTableEntry.get_value (base, idx, sizes);
}
inline int get_tracking (const void *base, float ptem) const
int get_tracking (const void *base, float ptem) const
{
/* CoreText points are CSS pixels (96 per inch),
* NOT typographic points (72 per inch).
@ -137,7 +137,7 @@ struct TrackData
*trackTableEntry, base));
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -162,9 +162,9 @@ struct trak
{
enum { tableTag = HB_AAT_TAG_trak };
inline bool has_data (void) const { return version.to_int (); }
bool has_data (void) const { return version.to_int (); }
inline bool apply (hb_aat_apply_context_t *c) const
bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -205,7 +205,7 @@ struct trak
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);

View File

@ -39,7 +39,7 @@ struct hb_aat_feature_mapping_t
hb_aat_layout_feature_selector_t selectorToEnable;
hb_aat_layout_feature_selector_t selectorToDisable;
static inline int cmp (const void *key_, const void *entry_)
static int cmp (const void *key_, const void *entry_)
{
hb_tag_t key = * (unsigned int *) key_;
const hb_aat_feature_mapping_t * entry = (const hb_aat_feature_mapping_t *) entry_;

View File

@ -43,7 +43,7 @@ struct FTStringRange
{
friend struct ltag;
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && (base+tag).sanitize (c, length));
@ -62,14 +62,14 @@ struct ltag
{
enum { tableTag = HB_AAT_TAG_ltag };
inline hb_language_t get_language (unsigned int i) const
hb_language_t get_language (unsigned int i) const
{
const FTStringRange &range = tagRanges[i];
return hb_language_from_string ((const char *) (this+range.tag).arrayZ,
range.length);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -36,15 +36,12 @@ struct hb_aat_map_t
public:
inline void init (void)
void init (void)
{
memset (this, 0, sizeof (*this));
chain_flags.init ();
}
inline void fini (void)
{
chain_flags.fini ();
}
void fini (void) { chain_flags.fini (); }
public:
hb_vector_t<hb_mask_t, 1> chain_flags;

View File

@ -267,12 +267,12 @@ inline void *hb_atomic_ptr_impl_get (void ** const P) { void *v = *P; _hb_memory
#define HB_ATOMIC_INT_INIT(V) {V}
struct hb_atomic_int_t
{
inline void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); }
inline void set (int v_) { hb_atomic_int_impl_set (&v, v_); }
inline int get_relaxed (void) const { return hb_atomic_int_impl_get_relaxed (&v); }
inline int get (void) const { return hb_atomic_int_impl_get (&v); }
inline int inc (void) { return hb_atomic_int_impl_add (&v, 1); }
inline int dec (void) { return hb_atomic_int_impl_add (&v, -1); }
void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); }
void set (int v_) { hb_atomic_int_impl_set (&v, v_); }
int get_relaxed (void) const { return hb_atomic_int_impl_get_relaxed (&v); }
int get (void) const { return hb_atomic_int_impl_get (&v); }
int inc (void) { return hb_atomic_int_impl_add (&v, 1); }
int dec (void) { return hb_atomic_int_impl_add (&v, -1); }
int v;
};
@ -284,14 +284,14 @@ struct hb_atomic_ptr_t
{
typedef typename hb_remove_pointer (P) T;
inline void init (T* v_ = nullptr) { set_relaxed (v_); }
inline void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, v_); }
inline T *get_relaxed (void) const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); }
inline T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
inline bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); }
void init (T* v_ = nullptr) { set_relaxed (v_); }
void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, v_); }
T *get_relaxed (void) const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); }
T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); }
inline T * operator -> (void) const { return get (); }
template <typename C> inline operator C * (void) const { return get (); }
T * operator -> (void) const { return get (); }
template <typename C> operator C * (void) const { return get (); }
T *v;
};

View File

@ -38,12 +38,12 @@
struct hb_blob_t
{
inline void fini_shallow (void)
void fini_shallow (void)
{
destroy_user_data ();
}
inline void destroy_user_data (void)
void destroy_user_data (void)
{
if (destroy)
{
@ -58,14 +58,12 @@ struct hb_blob_t
HB_INTERNAL bool try_make_writable_inplace_unix (void);
template <typename Type>
inline const Type* as (void) const
const Type* as (void) const
{
return length < hb_null_size (Type) ? &Null(Type) : reinterpret_cast<const Type *> (data);
}
inline hb_bytes_t as_bytes (void) const
{
return hb_bytes_t (data, length);
}
hb_bytes_t as_bytes (void) const
{ return hb_bytes_t (data, length); }
public:
hb_object_header_t header;
@ -88,16 +86,16 @@ struct hb_blob_ptr_t
{
typedef typename hb_remove_pointer (P) T;
inline hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {}
inline hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; }
inline const T * operator -> (void) const { return get (); }
inline const T & operator * (void) const { return *get (); }
template <typename C> inline operator const C * (void) const { return get (); }
inline operator const char * (void) const { return (const char *) get (); }
inline const T * get (void) const { return b->as<T> (); }
inline hb_blob_t * get_blob (void) const { return b.get_raw (); }
inline unsigned int get_length (void) const { return b.get ()->length; }
inline void destroy (void) { hb_blob_destroy (b.get ()); b = nullptr; }
hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {}
hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; }
const T * operator -> (void) const { return get (); }
const T & operator * (void) const { return *get (); }
template <typename C> operator const C * (void) const { return get (); }
operator const char * (void) const { return (const char *) get (); }
const T * get (void) const { return b->as<T> (); }
hb_blob_t * get_blob (void) const { return b.get_raw (); }
unsigned int get_length (void) const { return b.get ()->length; }
void destroy (void) { hb_blob_destroy (b.get ()); b = nullptr; }
hb_nonnull_ptr_t<hb_blob_t> b;
};

View File

@ -137,7 +137,7 @@ struct hb_buffer_t
/* Methods */
inline void allocate_var (unsigned int start, unsigned int count)
void allocate_var (unsigned int start, unsigned int count)
{
#ifndef HB_NDEBUG
unsigned int end = start + count;
@ -147,7 +147,7 @@ struct hb_buffer_t
allocated_var_bits |= bits;
#endif
}
inline void deallocate_var (unsigned int start, unsigned int count)
void deallocate_var (unsigned int start, unsigned int count)
{
#ifndef HB_NDEBUG
unsigned int end = start + count;
@ -157,7 +157,7 @@ struct hb_buffer_t
allocated_var_bits &= ~bits;
#endif
}
inline void assert_var (unsigned int start, unsigned int count)
void assert_var (unsigned int start, unsigned int count)
{
#ifndef HB_NDEBUG
unsigned int end = start + count;
@ -166,33 +166,33 @@ struct hb_buffer_t
assert (bits == (allocated_var_bits & bits));
#endif
}
inline void deallocate_var_all (void)
void deallocate_var_all (void)
{
#ifndef HB_NDEBUG
allocated_var_bits = 0;
#endif
}
inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
inline bool has_separate_output (void) const { return info != out_info; }
bool has_separate_output (void) const { return info != out_info; }
HB_INTERNAL void reset (void);
HB_INTERNAL void clear (void);
inline unsigned int backtrack_len (void) const
unsigned int backtrack_len (void) const
{ return have_output? out_len : idx; }
inline unsigned int lookahead_len (void) const
unsigned int lookahead_len (void) const
{ return len - idx; }
inline unsigned int next_serial (void) { return serial++; }
unsigned int next_serial (void) { return serial++; }
HB_INTERNAL void add (hb_codepoint_t codepoint,
unsigned int cluster);
@ -212,7 +212,7 @@ struct hb_buffer_t
unsigned int num_out,
const hb_codepoint_t *glyph_data);
inline void replace_glyph (hb_codepoint_t glyph_index)
void replace_glyph (hb_codepoint_t glyph_index)
{
if (unlikely (out_info != info || out_len != idx)) {
if (unlikely (!make_room_for (1, 1))) return;
@ -224,7 +224,7 @@ struct hb_buffer_t
out_len++;
}
/* Makes a copy of the glyph at idx to output and replace glyph_index */
inline hb_glyph_info_t & output_glyph (hb_codepoint_t glyph_index)
hb_glyph_info_t & output_glyph (hb_codepoint_t glyph_index)
{
if (unlikely (!make_room_for (0, 1))) return Crap(hb_glyph_info_t);
@ -238,7 +238,7 @@ struct hb_buffer_t
return out_info[out_len - 1];
}
inline void output_info (const hb_glyph_info_t &glyph_info)
void output_info (const hb_glyph_info_t &glyph_info)
{
if (unlikely (!make_room_for (0, 1))) return;
@ -247,7 +247,7 @@ struct hb_buffer_t
out_len++;
}
/* Copies glyph at idx to output but doesn't advance idx */
inline void copy_glyph (void)
void copy_glyph (void)
{
if (unlikely (!make_room_for (0, 1))) return;
@ -257,7 +257,7 @@ struct hb_buffer_t
}
/* Copies glyph at idx to output and advance idx.
* If there's no output, just advance idx. */
inline void
void
next_glyph (void)
{
if (have_output)
@ -274,7 +274,7 @@ struct hb_buffer_t
}
/* Copies n glyphs at idx to output and advance idx.
* If there's no output, just advance idx. */
inline void
void
next_glyphs (unsigned int n)
{
if (have_output)
@ -290,16 +290,16 @@ struct hb_buffer_t
idx += n;
}
/* Advance idx without copying to output. */
inline void skip_glyph (void)
void skip_glyph (void)
{
idx++;
}
inline void reset_masks (hb_mask_t mask)
void reset_masks (hb_mask_t mask)
{
for (unsigned int j = 0; j < len; j++)
info[j].mask = mask;
}
inline void add_masks (hb_mask_t mask)
void add_masks (hb_mask_t mask)
{
for (unsigned int j = 0; j < len; j++)
info[j].mask |= mask;
@ -307,7 +307,7 @@ struct hb_buffer_t
HB_INTERNAL void set_masks (hb_mask_t value, hb_mask_t mask,
unsigned int cluster_start, unsigned int cluster_end);
inline void merge_clusters (unsigned int start, unsigned int end)
void merge_clusters (unsigned int start, unsigned int end)
{
if (end - start < 2)
return;
@ -318,7 +318,7 @@ struct hb_buffer_t
/* Merge clusters for deleting current glyph, and skip it. */
HB_INTERNAL void delete_glyph (void);
inline void unsafe_to_break (unsigned int start,
void unsafe_to_break (unsigned int start,
unsigned int end)
{
if (end - start < 2)
@ -334,10 +334,10 @@ struct hb_buffer_t
HB_INTERNAL bool enlarge (unsigned int size);
inline bool ensure (unsigned int size)
bool ensure (unsigned int size)
{ return likely (!size || size < allocated) ? true : enlarge (size); }
inline bool ensure_inplace (unsigned int size)
bool ensure_inplace (unsigned int size)
{ return likely (!size || size < allocated); }
HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out);
@ -346,12 +346,12 @@ struct hb_buffer_t
typedef long scratch_buffer_t;
HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size);
inline void clear_context (unsigned int side) { context_len[side] = 0; }
void clear_context (unsigned int side) { context_len[side] = 0; }
HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *));
inline bool messaging (void) { return unlikely (message_func); }
inline bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3, 4)
bool messaging (void) { return unlikely (message_func); }
bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3, 4)
{
if (!messaging ())
return true;
@ -363,7 +363,7 @@ struct hb_buffer_t
}
HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) HB_PRINTF_FUNC(3, 0);
static inline void
static void
set_cluster (hb_glyph_info_t &inf, unsigned int cluster, unsigned int mask = 0)
{
if (inf.cluster != cluster)
@ -376,7 +376,7 @@ struct hb_buffer_t
inf.cluster = cluster;
}
inline int
int
_unsafe_to_break_find_min_cluster (const hb_glyph_info_t *infos,
unsigned int start, unsigned int end,
unsigned int cluster) const
@ -385,7 +385,7 @@ struct hb_buffer_t
cluster = MIN<unsigned int> (cluster, infos[i].cluster);
return cluster;
}
inline void
void
_unsafe_to_break_set_mask (hb_glyph_info_t *infos,
unsigned int start, unsigned int end,
unsigned int cluster)
@ -398,13 +398,9 @@ struct hb_buffer_t
}
}
inline void
unsafe_to_break_all (void)
{
unsafe_to_break_impl (0, len);
}
inline void
safe_to_break_all (void)
void unsafe_to_break_all (void)
{ unsafe_to_break_impl (0, len); }
void safe_to_break_all (void)
{
for (unsigned int i = 0; i < len; i++)
info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;

View File

@ -39,16 +39,16 @@ struct hb_cache_t
static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (hb_atomic_int_t)), "");
static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int), "");
inline void init (void) { clear (); }
inline void fini (void) {}
void init (void) { clear (); }
void fini (void) {}
inline void clear (void)
void clear (void)
{
for (unsigned i = 0; i < ARRAY_LENGTH (values); i++)
values[i].set_relaxed (-1);
}
inline bool get (unsigned int key, unsigned int *value) const
bool get (unsigned int key, unsigned int *value) const
{
unsigned int k = key & ((1u<<cache_bits)-1);
unsigned int v = values[k].get_relaxed ();
@ -59,7 +59,7 @@ struct hb_cache_t
return true;
}
inline bool set (unsigned int key, unsigned int value)
bool set (unsigned int key, unsigned int value)
{
if (unlikely ((key >> key_bits) || (value >> value_bits)))
return false; /* Overflows */

View File

@ -217,61 +217,45 @@ inline unsigned int OpCode_Size (OpCode op) { return Is_OpCode_ESC (op) ? 2: 1;
struct Number
{
inline void init (void)
{ set_real (0.0); }
inline void fini (void)
{}
void init (void) { set_real (0.0); }
void fini (void) {}
inline void set_int (int v) { value = (double)v; }
inline int to_int (void) const { return (int)value; }
inline void set_fixed (int32_t v) { value = v / 65536.0; }
inline int32_t to_fixed (void) const
void set_int (int v) { value = (double) v; }
int to_int (void) const { return (int) value; }
void set_fixed (int32_t v) { value = v / 65536.0; }
int32_t to_fixed (void) const
{
return (int32_t)(value * 65536.0);
}
inline void set_real (double v) { value = v; }
inline double to_real (void) const
{
return value;
}
void set_real (double v) { value = v; }
double to_real (void) const { return value; }
inline int ceil (void) const
{
return (int)::ceil (value);
}
int ceil (void) const { return (int) ::ceil (value); }
int floor (void) const { return (int) ::floor (value); }
inline int floor (void) const
{
return (int)::floor (value);
}
bool in_int_range (void) const
{ return ((double) (int16_t) to_int () == value); }
inline bool in_int_range (void) const
{
return ((double)(int16_t)to_int () == value);
}
bool operator > (const Number &n) const
{ return value > n.to_real (); }
inline bool operator > (const Number &n) const
{
return value > n.to_real ();
}
inline bool operator < (const Number &n) const
bool operator < (const Number &n) const
{ return n > *this; }
inline bool operator >= (const Number &n) const
{ return ! (*this < n); }
bool operator >= (const Number &n) const
{ return !(*this < n); }
inline bool operator <= (const Number &n) const
{ return ! (*this > n); }
bool operator <= (const Number &n) const
{ return !(*this > n); }
inline const Number &operator += (const Number &n)
const Number &operator += (const Number &n)
{
set_real (to_real () + n.to_real ());
return *this;
}
protected:
protected:
double value;
};
@ -280,7 +264,7 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
{
// encode 2-byte int (Dict/CharString) or 4-byte int (Dict)
template <typename INTTYPE, int minVal, int maxVal>
inline static bool serialize_int (hb_serialize_context_t *c, OpCode intOp, int value)
static bool serialize_int (hb_serialize_context_t *c, OpCode intOp, int value)
{
TRACE_SERIALIZE (this);
@ -298,10 +282,10 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
return_trace (true);
}
inline static bool serialize_int4 (hb_serialize_context_t *c, int value)
static bool serialize_int4 (hb_serialize_context_t *c, int value)
{ return serialize_int<HBUINT32, 0, 0x7FFFFFFF> (c, OpCode_longintdict, value); }
inline static bool serialize_int2 (hb_serialize_context_t *c, int value)
static bool serialize_int2 (hb_serialize_context_t *c, int value)
{ return serialize_int<HBUINT16, 0, 0x7FFF> (c, OpCode_shortint, value); }
/* Defining null_size allows a Null object may be created. Should be safe because:
@ -316,29 +300,30 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
struct ByteStr
{
inline ByteStr (void)
ByteStr (void)
: str (&Null(UnsizedByteStr)), len (0) {}
inline ByteStr (const UnsizedByteStr& s, unsigned int l)
ByteStr (const UnsizedByteStr& s, unsigned int l)
: str (&s), len (l) {}
inline ByteStr (const char *s, unsigned int l=0)
ByteStr (const char *s, unsigned int l=0)
: str ((const UnsizedByteStr *)s), len (l) {}
/* sub-string */
inline ByteStr (const ByteStr &bs, unsigned int offset, unsigned int len_)
ByteStr (const ByteStr &bs, unsigned int offset, unsigned int len_)
{
str = (const UnsizedByteStr *)&bs.str[offset];
len = len_;
}
inline bool sanitize (hb_sanitize_context_t *c) const { return str->sanitize (c, len); }
bool sanitize (hb_sanitize_context_t *c) const { return str->sanitize (c, len); }
inline const HBUINT8& operator [] (unsigned int i) const {
const HBUINT8& operator [] (unsigned int i) const
{
if (likely (str && (i < len)))
return (*str)[i];
else
return Null(HBUINT8);
}
inline bool serialize (hb_serialize_context_t *c, const ByteStr &src)
bool serialize (hb_serialize_context_t *c, const ByteStr &src)
{
TRACE_SERIALIZE (this);
HBUINT8 *dest = c->allocate_size<HBUINT8> (src.len);
@ -348,9 +333,9 @@ struct ByteStr
return_trace (true);
}
inline unsigned int get_size (void) const { return len; }
unsigned int get_size (void) const { return len; }
inline bool check_limit (unsigned int offset, unsigned int count) const
bool check_limit (unsigned int offset, unsigned int count) const
{ return (offset + count <= len); }
const UnsizedByteStr *str;
@ -359,29 +344,29 @@ struct ByteStr
struct SubByteStr
{
inline SubByteStr (void)
SubByteStr (void)
{ init (); }
inline void init (void)
void init (void)
{
str = ByteStr (0);
offset = 0;
error = false;
}
inline void fini (void) {}
void fini (void) {}
inline SubByteStr (const ByteStr &str_, unsigned int offset_ = 0)
SubByteStr (const ByteStr &str_, unsigned int offset_ = 0)
: str (str_), offset (offset_), error (false) {}
inline void reset (const ByteStr &str_, unsigned int offset_ = 0)
void reset (const ByteStr &str_, unsigned int offset_ = 0)
{
str = str_;
offset = offset_;
error = false;
}
inline const HBUINT8& operator [] (int i) {
const HBUINT8& operator [] (int i) {
if (unlikely ((unsigned int)(offset + i) >= str.len))
{
set_error ();
@ -391,13 +376,13 @@ struct SubByteStr
return str[offset + i];
}
inline operator ByteStr (void) const { return ByteStr (str, offset, str.len - offset); }
operator ByteStr (void) const { return ByteStr (str, offset, str.len - offset); }
inline bool avail (unsigned int count=1) const
bool avail (unsigned int count=1) const
{
return (!in_error () && str.check_limit (offset, count));
}
inline void inc (unsigned int count=1)
void inc (unsigned int count=1)
{
if (likely (!in_error () && (offset <= str.len) && (offset + count <= str.len)))
{
@ -410,8 +395,8 @@ struct SubByteStr
}
}
inline void set_error (void) { error = true; }
inline bool in_error (void) const { return error; }
void set_error (void) { error = true; }
bool in_error (void) const { return error; }
ByteStr str;
unsigned int offset; /* beginning of the sub-string within str */
@ -426,7 +411,7 @@ typedef hb_vector_t<ByteStr> ByteStrArray;
template <typename ELEM, int LIMIT>
struct Stack
{
inline void init (void)
void init (void)
{
error = false;
count = 0;
@ -436,18 +421,18 @@ struct Stack
elements[i].init ();
}
inline void fini (void)
void fini (void)
{
elements.fini_deep ();
}
inline ELEM& operator [] (unsigned int i)
ELEM& operator [] (unsigned int i)
{
if (unlikely (i >= count)) set_error ();
return elements[i];
}
inline void push (const ELEM &v)
void push (const ELEM &v)
{
if (likely (count < elements.len))
elements[count++] = v;
@ -455,7 +440,7 @@ struct Stack
set_error ();
}
inline ELEM &push (void)
ELEM &push (void)
{
if (likely (count < elements.len))
return elements[count++];
@ -466,7 +451,7 @@ struct Stack
}
}
inline ELEM& pop (void)
ELEM& pop (void)
{
if (likely (count > 0))
return elements[--count];
@ -477,7 +462,7 @@ struct Stack
}
}
inline void pop (unsigned int n)
void pop (unsigned int n)
{
if (likely (count >= n))
count -= n;
@ -485,7 +470,7 @@ struct Stack
set_error ();
}
inline const ELEM& peek (void)
const ELEM& peek (void)
{
if (likely (count > 0))
return elements[count-1];
@ -496,7 +481,7 @@ struct Stack
}
}
inline void unpop (void)
void unpop (void)
{
if (likely (count < elements.len))
count++;
@ -504,13 +489,13 @@ struct Stack
set_error ();
}
inline void clear (void) { count = 0; }
void clear (void) { count = 0; }
inline bool in_error (void) const { return (error || elements.in_error ()); }
inline void set_error (void) { error = true; }
bool in_error (void) const { return (error || elements.in_error ()); }
void set_error (void) { error = true; }
inline unsigned int get_count (void) const { return count; }
inline bool is_empty (void) const { return count == 0; }
unsigned int get_count (void) const { return count; }
bool is_empty (void) const { return count == 0; }
static const unsigned int kSizeLimit = LIMIT;
@ -524,35 +509,35 @@ struct Stack
template <typename ARG=Number>
struct ArgStack : Stack<ARG, 513>
{
inline void push_int (int v)
void push_int (int v)
{
ARG &n = S::push ();
n.set_int (v);
}
inline void push_fixed (int32_t v)
void push_fixed (int32_t v)
{
ARG &n = S::push ();
n.set_fixed (v);
}
inline void push_real (double v)
void push_real (double v)
{
ARG &n = S::push ();
n.set_real (v);
}
inline ARG& pop_num (void)
ARG& pop_num (void)
{
return this->pop ();
}
inline int pop_int (void)
int pop_int (void)
{
return this->pop ().to_int ();
}
inline unsigned int pop_uint (void)
unsigned int pop_uint (void)
{
int i = pop_int ();
if (unlikely (i < 0))
@ -563,13 +548,13 @@ struct ArgStack : Stack<ARG, 513>
return (unsigned)i;
}
inline void push_longint_from_substr (SubByteStr& substr)
void push_longint_from_substr (SubByteStr& substr)
{
push_int ((substr[0] << 24) | (substr[1] << 16) | (substr[2] << 8) | (substr[3]));
substr.inc (4);
}
inline bool push_fixed_from_substr (SubByteStr& substr)
bool push_fixed_from_substr (SubByteStr& substr)
{
if (unlikely (!substr.avail (4)))
return false;
@ -578,7 +563,7 @@ struct ArgStack : Stack<ARG, 513>
return true;
}
inline hb_array_t<const ARG> get_subarray (unsigned int start) const
hb_array_t<const ARG> get_subarray (unsigned int start) const
{
return S::elements.sub_array (start);
}
@ -590,8 +575,8 @@ struct ArgStack : Stack<ARG, 513>
/* an operator prefixed by its operands in a byte string */
struct OpStr
{
inline void init (void) {}
inline void fini (void) {}
void init (void) {}
void fini (void) {}
OpCode op;
ByteStr str;
@ -601,7 +586,7 @@ struct OpStr
struct OpSerializer
{
protected:
inline bool copy_opstr (hb_serialize_context_t *c, const OpStr& opstr) const
bool copy_opstr (hb_serialize_context_t *c, const OpStr& opstr) const
{
TRACE_SERIALIZE (this);
@ -615,18 +600,18 @@ struct OpSerializer
template <typename VAL>
struct ParsedValues
{
inline void init (void)
void init (void)
{
opStart = 0;
values.init ();
}
inline void fini (void)
void fini (void)
{
values.fini_deep ();
}
inline void add_op (OpCode op, const SubByteStr& substr = SubByteStr ())
void add_op (OpCode op, const SubByteStr& substr = SubByteStr ())
{
VAL *val = values.push ();
val->op = op;
@ -634,7 +619,7 @@ struct ParsedValues
opStart = substr.offset;
}
inline void add_op (OpCode op, const SubByteStr& substr, const VAL &v)
void add_op (OpCode op, const SubByteStr& substr, const VAL &v)
{
VAL *val = values.push (v);
val->op = op;
@ -642,16 +627,16 @@ struct ParsedValues
opStart = substr.offset;
}
inline bool has_op (OpCode op) const
bool has_op (OpCode op) const
{
for (unsigned int i = 0; i < get_count (); i++)
if (get_value (i).op == op) return true;
return false;
}
inline unsigned get_count (void) const { return values.len; }
inline const VAL &get_value (unsigned int i) const { return values[i]; }
inline const VAL &operator [] (unsigned int i) const { return get_value (i); }
unsigned get_count (void) const { return values.len; }
const VAL &get_value (unsigned int i) const { return values[i]; }
const VAL &operator [] (unsigned int i) const { return get_value (i); }
unsigned int opStart;
hb_vector_t<VAL> values;
@ -660,26 +645,26 @@ struct ParsedValues
template <typename ARG=Number>
struct InterpEnv
{
inline void init (const ByteStr &str_)
void init (const ByteStr &str_)
{
substr.reset (str_);
argStack.init ();
error = false;
}
inline void fini (void)
void fini (void)
{
argStack.fini ();
}
inline bool in_error (void) const
bool in_error (void) const
{
return error || substr.in_error () || argStack.in_error ();
}
inline void set_error (void) { error = true; }
void set_error (void) { error = true; }
inline OpCode fetch_op (void)
OpCode fetch_op (void)
{
OpCode op = OpCode_Invalid;
if (unlikely (!substr.avail ()))
@ -695,22 +680,22 @@ struct InterpEnv
return op;
}
inline const ARG& eval_arg (unsigned int i)
const ARG& eval_arg (unsigned int i)
{
return argStack[i];
}
inline ARG& pop_arg (void)
ARG& pop_arg (void)
{
return argStack.pop ();
}
inline void pop_n_args (unsigned int n)
void pop_n_args (unsigned int n)
{
argStack.pop (n);
}
inline void clear_args (void)
void clear_args (void)
{
pop_n_args (argStack.get_count ());
}
@ -726,7 +711,7 @@ typedef InterpEnv<> NumInterpEnv;
template <typename ARG=Number>
struct OpSet
{
static inline void process_op (OpCode op, InterpEnv<ARG>& env)
static void process_op (OpCode op, InterpEnv<ARG>& env)
{
switch (op) {
case OpCode_shortint:
@ -764,9 +749,9 @@ struct OpSet
template <typename ENV>
struct Interpreter {
inline ~Interpreter(void) { fini (); }
~Interpreter(void) { fini (); }
inline void fini (void) { env.fini (); }
void fini (void) { env.fini (); }
ENV env;
};

View File

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

View File

@ -37,14 +37,8 @@ using namespace OT;
/* an opstr and the parsed out dict value(s) */
struct DictVal : OpStr
{
inline void init (void)
{
single_val.set_int (0);
}
inline void fini (void)
{
}
void init (void) { single_val.set_int (0); }
void fini (void) {}
Number single_val;
};
@ -56,19 +50,19 @@ template <typename VAL> struct DictValues : ParsedValues<VAL> {};
template <typename OPSTR=OpStr>
struct TopDictValues : DictValues<OPSTR>
{
inline void init (void)
void init (void)
{
DictValues<OPSTR>::init ();
charStringsOffset = 0;
FDArrayOffset = 0;
}
inline void fini (void)
void fini (void)
{
DictValues<OPSTR>::fini ();
}
inline unsigned int calculate_serialized_op_size (const OPSTR& opstr) const
unsigned int calculate_serialized_op_size (const OPSTR& opstr) const
{
switch (opstr.op)
{
@ -87,7 +81,7 @@ struct TopDictValues : DictValues<OPSTR>
struct DictOpSet : OpSet<Number>
{
static inline void process_op (OpCode op, InterpEnv<Number>& env)
static void process_op (OpCode op, InterpEnv<Number>& env)
{
switch (op) {
case OpCode_longintdict: /* 5-byte integer */
@ -104,7 +98,7 @@ struct DictOpSet : OpSet<Number>
}
}
static inline double parse_bcd (SubByteStr& substr)
static double parse_bcd (SubByteStr& substr)
{
bool neg = false;
double int_part = 0;
@ -230,7 +224,7 @@ struct DictOpSet : OpSet<Number>
return value;
}
static inline bool is_hint_op (OpCode op)
static bool is_hint_op (OpCode op)
{
switch (op)
{
@ -258,7 +252,7 @@ struct DictOpSet : OpSet<Number>
template <typename VAL=OpStr>
struct TopDictOpSet : DictOpSet
{
static inline void process_op (OpCode op, InterpEnv<Number>& env, TopDictValues<VAL> & dictval)
static void process_op (OpCode op, InterpEnv<Number>& env, TopDictValues<VAL> & dictval)
{
switch (op) {
case OpCode_CharStrings:
@ -282,7 +276,7 @@ struct TopDictOpSet : DictOpSet
template <typename OPSET, typename PARAM, typename ENV=NumInterpEnv>
struct DictInterpreter : Interpreter<ENV>
{
inline bool interpret (PARAM& param)
bool interpret (PARAM& param)
{
param.init ();
while (SUPER::env.substr.avail ())

View File

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

View File

@ -35,23 +35,23 @@ using namespace OT;
struct BlendArg : Number
{
inline void init (void)
void init (void)
{
Number::init ();
deltas.init ();
}
inline void fini (void)
void fini (void)
{
Number::fini ();
deltas.fini_deep ();
}
inline void set_int (int v) { reset_blends (); Number::set_int (v); }
inline void set_fixed (int32_t v) { reset_blends (); Number::set_fixed (v); }
inline void set_real (double v) { reset_blends (); Number::set_real (v); }
void set_int (int v) { reset_blends (); Number::set_int (v); }
void set_fixed (int32_t v) { reset_blends (); Number::set_fixed (v); }
void set_real (double v) { reset_blends (); Number::set_real (v); }
inline void set_blends (unsigned int numValues_, unsigned int valueIndex_,
void set_blends (unsigned int numValues_, unsigned int valueIndex_,
unsigned int numBlends, const hb_array_t<const BlendArg> &blends_)
{
numValues = numValues_;
@ -61,8 +61,8 @@ struct BlendArg : Number
deltas[i] = blends_[i];
}
inline bool blending (void) const { return deltas.len > 0; }
inline void reset_blends (void)
bool blending (void) const { return deltas.len > 0; }
void reset_blends (void)
{
numValues = valueIndex = 0;
deltas.resize (0);
@ -79,7 +79,7 @@ typedef BiasedSubrs<CFF2Subrs> CFF2BiasedSubrs;
struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
{
template <typename ACC>
inline void init (const ByteStr &str, ACC &acc, unsigned int fd,
void init (const ByteStr &str, ACC &acc, unsigned int fd,
const int *coords_=nullptr, unsigned int num_coords_=0)
{
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
@ -94,13 +94,13 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
set_ivs (acc.privateDicts[fd].ivs);
}
inline void fini (void)
void fini (void)
{
scalars.fini ();
SUPER::fini ();
}
inline OpCode fetch_op (void)
OpCode fetch_op (void)
{
if (this->substr.avail ())
return SUPER::fetch_op ();
@ -112,21 +112,21 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
return OpCode_return;
}
inline const BlendArg& eval_arg (unsigned int i)
const BlendArg& eval_arg (unsigned int i)
{
BlendArg &arg = argStack[i];
blend_arg (arg);
return arg;
}
inline const BlendArg& pop_arg (void)
const BlendArg& pop_arg (void)
{
BlendArg &arg = argStack.pop ();
blend_arg (arg);
return arg;
}
inline void process_blend (void)
void process_blend (void)
{
if (!seen_blend)
{
@ -142,7 +142,7 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
}
}
inline void process_vsindex (void)
void process_vsindex (void)
{
unsigned int index = argStack.pop_uint ();
if (unlikely (seen_vsindex () || seen_blend))
@ -156,14 +156,14 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
seen_vsindex_ = true;
}
inline unsigned int get_region_count (void) const { return region_count; }
inline void set_region_count (unsigned int region_count_) { region_count = region_count_; }
inline unsigned int get_ivs (void) const { return ivs; }
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
inline bool seen_vsindex (void) const { return seen_vsindex_; }
unsigned int get_region_count (void) const { return region_count; }
void set_region_count (unsigned int region_count_) { region_count = region_count_; }
unsigned int get_ivs (void) const { return ivs; }
void set_ivs (unsigned int ivs_) { ivs = ivs_; }
bool seen_vsindex (void) const { return seen_vsindex_; }
protected:
inline void blend_arg (BlendArg &arg)
void blend_arg (BlendArg &arg)
{
if (do_blend && arg.blending ())
{
@ -196,7 +196,7 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
template <typename OPSET, typename PARAM, typename PATH=PathProcsNull<CFF2CSInterpEnv, PARAM> >
struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH>
{
static inline void process_op (OpCode op, CFF2CSInterpEnv &env, PARAM& param)
static void process_op (OpCode op, CFF2CSInterpEnv &env, PARAM& param)
{
switch (op) {
case OpCode_callsubr:
@ -228,7 +228,7 @@ struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH>
}
}
static inline void process_blend (CFF2CSInterpEnv &env, PARAM& param)
static void process_blend (CFF2CSInterpEnv &env, PARAM& param)
{
unsigned int n, k;
@ -253,7 +253,7 @@ struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH>
env.argStack.pop (k * n);
}
static inline void process_vsindex (CFF2CSInterpEnv &env, PARAM& param)
static void process_vsindex (CFF2CSInterpEnv &env, PARAM& param)
{
env.process_vsindex ();
env.clear_args ();

View File

@ -247,11 +247,10 @@ struct hb_language_item_t {
struct hb_language_item_t *next;
hb_language_t lang;
inline bool operator == (const char *s) const {
return lang_equal (lang, s);
}
bool operator == (const char *s) const
{ return lang_equal (lang, s); }
inline hb_language_item_t & operator = (const char *s) {
hb_language_item_t & operator = (const char *s) {
/* If a custom allocated is used calling strdup() pairs
badly with a call to the custom free() in fini() below.
Therefore don't call strdup(), implement its behavior.
@ -787,7 +786,7 @@ static void free_static_C_locale (void);
static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (HB_LOCALE_T),
hb_C_locale_lazy_loader_t>
{
static inline HB_LOCALE_T create (void)
static HB_LOCALE_T create (void)
{
HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C");
@ -797,11 +796,11 @@ static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (HB
return C_locale;
}
static inline void destroy (HB_LOCALE_T p)
static void destroy (HB_LOCALE_T p)
{
HB_FREE_LOCALE (p);
}
static inline HB_LOCALE_T get_null (void)
static HB_LOCALE_T get_null (void)
{
return nullptr;
}

View File

@ -284,7 +284,7 @@ struct hb_auto_trace_t
_hb_debug_msg_va<max_level> (what, obj, func, true, plevel ? *plevel : 0, +1, message, ap);
va_end (ap);
}
inline ~hb_auto_trace_t (void)
~hb_auto_trace_t (void)
{
_hb_warn_no_return<ret_t> (returned);
if (!returned) {
@ -293,9 +293,9 @@ struct hb_auto_trace_t
if (plevel) --*plevel;
}
inline ret_t ret (ret_t v,
const char *func = "",
unsigned int line = 0)
ret_t ret (ret_t v,
const char *func = "",
unsigned int line = 0)
{
if (unlikely (returned)) {
fprintf (stderr, "OUCH, double calls to return_trace(). This is a bug, please report.\n");
@ -327,18 +327,18 @@ struct hb_auto_trace_t<0, ret_t>
const char *message,
...) HB_PRINTF_FUNC(6, 7) {}
inline ret_t ret (ret_t v,
const char *func HB_UNUSED = nullptr,
unsigned int line HB_UNUSED = 0) { return v; }
ret_t ret (ret_t v,
const char *func HB_UNUSED = nullptr,
unsigned int line HB_UNUSED = 0) { return v; }
};
/* For disabled tracing; optimize out everything.
* https://github.com/harfbuzz/harfbuzz/pull/605 */
template <typename ret_t>
struct hb_no_trace_t {
inline ret_t ret (ret_t v,
const char *func HB_UNUSED = "",
unsigned int line HB_UNUSED = 0) { return v; }
ret_t ret (ret_t v,
const char *func HB_UNUSED = "",
unsigned int line HB_UNUSED = 0) { return v; }
};
#define return_trace(RET) return trace.ret (RET, HB_FUNC, __LINE__)

View File

@ -269,7 +269,7 @@ public:
uint8_t mBidiLevel;
bool mIsSideways;
inline bool ContainsTextPosition (uint32_t aTextPosition) const
bool ContainsTextPosition (uint32_t aTextPosition) const
{
return aTextPosition >= mTextStart &&
aTextPosition < mTextStart + mTextLength;

View File

@ -535,24 +535,24 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
struct hb_bytes_t
{
inline hb_bytes_t (void) : arrayZ (nullptr), len (0) {}
inline hb_bytes_t (const char *bytes_, unsigned int len_) : arrayZ (bytes_), len (len_) {}
inline hb_bytes_t (const void *bytes_, unsigned int len_) : arrayZ ((const char *) bytes_), len (len_) {}
hb_bytes_t (void) : arrayZ (nullptr), len (0) {}
hb_bytes_t (const char *bytes_, unsigned int len_) : arrayZ (bytes_), len (len_) {}
hb_bytes_t (const void *bytes_, unsigned int len_) : arrayZ ((const char *) bytes_), len (len_) {}
template <typename T>
inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len * sizeof (array.arrayZ[0])) {}
hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len * sizeof (array.arrayZ[0])) {}
inline operator const void * (void) const { return arrayZ; }
inline operator const char * (void) const { return arrayZ; }
operator const void * (void) const { return arrayZ; }
operator const char * (void) const { return arrayZ; }
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
inline int cmp (const hb_bytes_t &a) const
int cmp (const hb_bytes_t &a) const
{
if (len != a.len)
return (int) a.len - (int) len;
return hb_memcmp (a.arrayZ, arrayZ, len);
}
static inline int cmp (const void *pa, const void *pb)
static int cmp (const void *pa, const void *pb)
{
hb_bytes_t *a = (hb_bytes_t *) pa;
hb_bytes_t *b = (hb_bytes_t *) pb;
@ -571,24 +571,24 @@ struct hb_array_t
{
static_assert ((bool) (unsigned) hb_static_size (Type), "");
inline hb_array_t (void) : arrayZ (nullptr), len (0) {}
inline hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {}
inline hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len (len_) {}
hb_array_t (void) : arrayZ (nullptr), len (0) {}
hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {}
hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len (len_) {}
inline Type& operator [] (int i_) const
Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= len)) return Null(Type);
return arrayZ[i];
}
template <typename T> inline operator T * (void) const { return arrayZ; }
template <typename T> operator T * (void) const { return arrayZ; }
inline Type * operator & (void) const { return arrayZ; }
Type * operator & (void) const { return arrayZ; }
inline unsigned int get_size (void) const { return len * sizeof (Type); }
unsigned int get_size (void) const { return len * sizeof (Type); }
inline hb_array_t<Type> sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const
hb_array_t<Type> sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const
{
if (!start_offset && !seg_count)
return *this;
@ -602,14 +602,14 @@ struct hb_array_t
count = *seg_count = MIN (count, *seg_count);
return hb_array_t<Type> (arrayZ + start_offset, count);
}
inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int seg_count) const
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int seg_count) const
{ return sub_array (start_offset, &seg_count); }
inline hb_bytes_t as_bytes (void) const
hb_bytes_t as_bytes (void) const
{ return hb_bytes_t (arrayZ, len * sizeof (Type)); }
template <typename T>
inline Type *lsearch (const T &x,
Type *lsearch (const T &x,
Type *not_found = nullptr)
{
unsigned int count = len;
@ -619,7 +619,7 @@ struct hb_array_t
return not_found;
}
template <typename T>
inline const Type *lsearch (const T &x, const Type *not_found = nullptr) const
const Type *lsearch (const T &x, const Type *not_found = nullptr) const
{
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
@ -628,28 +628,28 @@ struct hb_array_t
return not_found;
}
inline hb_sorted_array_t<Type> qsort (int (*cmp)(const void*, const void*))
hb_sorted_array_t<Type> qsort (int (*cmp)(const void*, const void*))
{
::qsort (arrayZ, len, sizeof (Type), cmp);
return hb_sorted_array_t<Type> (*this);
}
inline hb_sorted_array_t<Type> qsort (void)
hb_sorted_array_t<Type> qsort (void)
{
::qsort (arrayZ, len, sizeof (Type), Type::cmp);
return hb_sorted_array_t<Type> (*this);
}
inline void qsort (unsigned int start, unsigned int end)
void qsort (unsigned int start, unsigned int end)
{
end = MIN (end, len);
assert (start <= end);
::qsort (arrayZ + start, end - start, sizeof (Type), Type::cmp);
}
inline void free (void)
void free (void)
{ ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
template <typename hb_sanitize_context_t>
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{ return c->check_array (arrayZ, len); }
public:
@ -670,29 +670,29 @@ enum hb_bfind_not_found_t
template <typename Type>
struct hb_sorted_array_t : hb_array_t<Type>
{
inline hb_sorted_array_t (void) : hb_array_t<Type> () {}
inline hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {}
inline hb_sorted_array_t (Type *array_, unsigned int len_) : hb_array_t<Type> (array_, len_) {}
hb_sorted_array_t (void) : hb_array_t<Type> () {}
hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {}
hb_sorted_array_t (Type *array_, unsigned int len_) : hb_array_t<Type> (array_, len_) {}
inline hb_sorted_array_t<Type> sub_array (unsigned int start_offset, unsigned int *seg_count /* IN/OUT */) const
hb_sorted_array_t<Type> sub_array (unsigned int start_offset, unsigned int *seg_count /* IN/OUT */) const
{ return hb_sorted_array_t<Type> (((const hb_array_t<Type> *) (this))->sub_array (start_offset, seg_count)); }
inline hb_sorted_array_t<Type> sub_array (unsigned int start_offset, unsigned int seg_count) const
hb_sorted_array_t<Type> sub_array (unsigned int start_offset, unsigned int seg_count) const
{ return sub_array (start_offset, &seg_count); }
template <typename T>
inline Type *bsearch (const T &x, Type *not_found = nullptr)
Type *bsearch (const T &x, Type *not_found = nullptr)
{
unsigned int i;
return bfind (x, &i) ? &this->arrayZ[i] : not_found;
}
template <typename T>
inline const Type *bsearch (const T &x, const Type *not_found = nullptr) const
const Type *bsearch (const T &x, const Type *not_found = nullptr) const
{
unsigned int i;
return bfind (x, &i) ? &this->arrayZ[i] : not_found;
}
template <typename T>
inline bool bfind (const T &x, unsigned int *i = nullptr,
bool bfind (const T &x, unsigned int *i = nullptr,
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{
@ -773,13 +773,13 @@ struct HbOpXor
template <typename elt_t, unsigned int byte_size>
struct hb_vector_size_t
{
inline elt_t& operator [] (unsigned int i) { return u.v[i]; }
inline const elt_t& operator [] (unsigned int i) const { return u.v[i]; }
elt_t& operator [] (unsigned int i) { return u.v[i]; }
const elt_t& operator [] (unsigned int i) const { return u.v[i]; }
inline void clear (unsigned char v = 0) { memset (this, v, sizeof (*this)); }
void clear (unsigned char v = 0) { memset (this, v, sizeof (*this)); }
template <class Op>
inline hb_vector_size_t process (const hb_vector_size_t &o) const
hb_vector_size_t process (const hb_vector_size_t &o) const
{
hb_vector_size_t r;
#if HB_VECTOR_SIZE
@ -792,13 +792,13 @@ struct hb_vector_size_t
Op::process (r.u.v[i], u.v[i], o.u.v[i]);
return r;
}
inline hb_vector_size_t operator | (const hb_vector_size_t &o) const
hb_vector_size_t operator | (const hb_vector_size_t &o) const
{ return process<HbOpOr> (o); }
inline hb_vector_size_t operator & (const hb_vector_size_t &o) const
hb_vector_size_t operator & (const hb_vector_size_t &o) const
{ return process<HbOpAnd> (o); }
inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const
hb_vector_size_t operator ^ (const hb_vector_size_t &o) const
{ return process<HbOpXor> (o); }
inline hb_vector_size_t operator ~ (void) const
hb_vector_size_t operator ~ (void) const
{
hb_vector_size_t r;
#if HB_VECTOR_SIZE && 0

View File

@ -588,7 +588,7 @@ struct hb_face_builder_data_t
{
struct table_entry_t
{
inline int cmp (hb_tag_t t) const
int cmp (hb_tag_t t) const
{
if (t < tag) return -1;
if (t > tag) return -1;

View File

@ -67,7 +67,7 @@ struct hb_face_t
};
hb_atomic_ptr_t<plan_node_t> shape_plans;
inline hb_blob_t *reference_table (hb_tag_t tag) const
hb_blob_t *reference_table (hb_tag_t tag) const
{
hb_blob_t *blob;
@ -81,7 +81,7 @@ struct hb_face_t
return blob;
}
inline HB_PURE_FUNC unsigned int get_upem (void) const
HB_PURE_FUNC unsigned int get_upem (void) const
{
unsigned int ret = upem.get_relaxed ();
if (unlikely (!ret))
@ -91,7 +91,7 @@ struct hb_face_t
return ret;
}
inline unsigned int get_num_glyphs (void) const
unsigned int get_num_glyphs (void) const
{
unsigned int ret = num_glyphs.get_relaxed ();
if (unlikely (ret == (unsigned int) -1))

View File

@ -127,40 +127,42 @@ struct hb_font_t
/* Convert from font-space to user-space */
inline int dir_scale (hb_direction_t direction)
int dir_scale (hb_direction_t direction)
{ return HB_DIRECTION_IS_VERTICAL(direction) ? y_scale : x_scale; }
inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); }
inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); }
inline hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scale); }
inline hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scale); }
inline float em_fscale_x (int16_t v) { return em_fscale (v, x_scale); }
inline float em_fscale_y (int16_t v) { return em_fscale (v, y_scale); }
inline hb_position_t em_scale_dir (int16_t v, hb_direction_t direction)
hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); }
hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); }
hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scale); }
hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scale); }
float em_fscale_x (int16_t v) { return em_fscale (v, x_scale); }
float em_fscale_y (int16_t v) { return em_fscale (v, y_scale); }
hb_position_t em_scale_dir (int16_t v, hb_direction_t direction)
{ return em_scale (v, dir_scale (direction)); }
/* Convert from parent-font user-space to our user-space */
inline hb_position_t parent_scale_x_distance (hb_position_t v) {
hb_position_t parent_scale_x_distance (hb_position_t v)
{
if (unlikely (parent && parent->x_scale != x_scale))
return (hb_position_t) (v * (int64_t) this->x_scale / this->parent->x_scale);
return v;
}
inline hb_position_t parent_scale_y_distance (hb_position_t v) {
hb_position_t parent_scale_y_distance (hb_position_t v)
{
if (unlikely (parent && parent->y_scale != y_scale))
return (hb_position_t) (v * (int64_t) this->y_scale / this->parent->y_scale);
return v;
}
inline hb_position_t parent_scale_x_position (hb_position_t v) {
return parent_scale_x_distance (v);
}
inline hb_position_t parent_scale_y_position (hb_position_t v) {
return parent_scale_y_distance (v);
}
hb_position_t parent_scale_x_position (hb_position_t v)
{ return parent_scale_x_distance (v); }
hb_position_t parent_scale_y_position (hb_position_t v)
{ return parent_scale_y_distance (v); }
inline void parent_scale_distance (hb_position_t *x, hb_position_t *y) {
void parent_scale_distance (hb_position_t *x, hb_position_t *y)
{
*x = parent_scale_x_distance (*x);
*y = parent_scale_y_distance (*y);
}
inline void parent_scale_position (hb_position_t *x, hb_position_t *y) {
void parent_scale_position (hb_position_t *x, hb_position_t *y)
{
*x = parent_scale_x_position (*x);
*y = parent_scale_y_position (*y);
}
@ -190,14 +192,14 @@ struct hb_font_t
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
inline hb_bool_t get_font_h_extents (hb_font_extents_t *extents)
hb_bool_t get_font_h_extents (hb_font_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
return klass->get.f.font_h_extents (this, user_data,
extents,
klass->user_data.font_h_extents);
}
inline hb_bool_t get_font_v_extents (hb_font_extents_t *extents)
hb_bool_t get_font_v_extents (hb_font_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
return klass->get.f.font_v_extents (this, user_data,
@ -205,13 +207,13 @@ struct hb_font_t
klass->user_data.font_v_extents);
}
inline bool has_glyph (hb_codepoint_t unicode)
bool has_glyph (hb_codepoint_t unicode)
{
hb_codepoint_t glyph;
return get_nominal_glyph (unicode, &glyph);
}
inline hb_bool_t get_nominal_glyph (hb_codepoint_t unicode,
hb_bool_t get_nominal_glyph (hb_codepoint_t unicode,
hb_codepoint_t *glyph)
{
*glyph = 0;
@ -219,11 +221,11 @@ struct hb_font_t
unicode, glyph,
klass->user_data.nominal_glyph);
}
inline unsigned int get_nominal_glyphs (unsigned int count,
const hb_codepoint_t *first_unicode,
unsigned int unicode_stride,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride)
unsigned int get_nominal_glyphs (unsigned int count,
const hb_codepoint_t *first_unicode,
unsigned int unicode_stride,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride)
{
return klass->get.f.nominal_glyphs (this, user_data,
count,
@ -232,8 +234,8 @@ struct hb_font_t
klass->user_data.nominal_glyphs);
}
inline hb_bool_t get_variation_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
hb_codepoint_t *glyph)
hb_bool_t get_variation_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
hb_codepoint_t *glyph)
{
*glyph = 0;
return klass->get.f.variation_glyph (this, user_data,
@ -241,25 +243,25 @@ struct hb_font_t
klass->user_data.variation_glyph);
}
inline hb_position_t get_glyph_h_advance (hb_codepoint_t glyph)
hb_position_t get_glyph_h_advance (hb_codepoint_t glyph)
{
return klass->get.f.glyph_h_advance (this, user_data,
glyph,
klass->user_data.glyph_h_advance);
}
inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
{
return klass->get.f.glyph_v_advance (this, user_data,
glyph,
klass->user_data.glyph_v_advance);
}
inline void get_glyph_h_advances (unsigned int count,
const hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride)
void get_glyph_h_advances (unsigned int count,
const hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride)
{
return klass->get.f.glyph_h_advances (this, user_data,
count,
@ -268,11 +270,11 @@ struct hb_font_t
klass->user_data.glyph_h_advances);
}
inline void get_glyph_v_advances (unsigned int count,
const hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride)
void get_glyph_v_advances (unsigned int count,
const hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride)
{
return klass->get.f.glyph_v_advances (this, user_data,
count,
@ -281,7 +283,7 @@ struct hb_font_t
klass->user_data.glyph_v_advances);
}
inline hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
@ -290,8 +292,8 @@ struct hb_font_t
klass->user_data.glyph_h_origin);
}
inline hb_bool_t get_glyph_v_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
hb_bool_t get_glyph_v_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
return klass->get.f.glyph_v_origin (this, user_data,
@ -299,21 +301,23 @@ struct hb_font_t
klass->user_data.glyph_v_origin);
}
inline hb_position_t get_glyph_h_kerning (hb_codepoint_t left_glyph, hb_codepoint_t right_glyph)
hb_position_t get_glyph_h_kerning (hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph)
{
return klass->get.f.glyph_h_kerning (this, user_data,
left_glyph, right_glyph,
klass->user_data.glyph_h_kerning);
}
inline hb_position_t get_glyph_v_kerning (hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph)
hb_position_t get_glyph_v_kerning (hb_codepoint_t top_glyph,
hb_codepoint_t bottom_glyph)
{
return klass->get.f.glyph_v_kerning (this, user_data,
top_glyph, bottom_glyph,
klass->user_data.glyph_v_kerning);
}
inline hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
hb_glyph_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
@ -323,7 +327,7 @@ struct hb_font_t
klass->user_data.glyph_extents);
}
inline hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index,
hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index,
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
@ -333,8 +337,8 @@ struct hb_font_t
klass->user_data.glyph_contour_point);
}
inline hb_bool_t get_glyph_name (hb_codepoint_t glyph,
char *name, unsigned int size)
hb_bool_t get_glyph_name (hb_codepoint_t glyph,
char *name, unsigned int size)
{
if (size) *name = '\0';
return klass->get.f.glyph_name (this, user_data,
@ -343,8 +347,8 @@ struct hb_font_t
klass->user_data.glyph_name);
}
inline hb_bool_t get_glyph_from_name (const char *name, int len, /* -1 means nul-terminated */
hb_codepoint_t *glyph)
hb_bool_t get_glyph_from_name (const char *name, int len, /* -1 means nul-terminated */
hb_codepoint_t *glyph)
{
*glyph = 0;
if (len == -1) len = strlen (name);
@ -357,7 +361,7 @@ struct hb_font_t
/* A bit higher-level, and with fallback */
inline void get_h_extents_with_fallback (hb_font_extents_t *extents)
void get_h_extents_with_fallback (hb_font_extents_t *extents)
{
if (!get_font_h_extents (extents))
{
@ -366,7 +370,7 @@ struct hb_font_t
extents->line_gap = 0;
}
}
inline void get_v_extents_with_fallback (hb_font_extents_t *extents)
void get_v_extents_with_fallback (hb_font_extents_t *extents)
{
if (!get_font_v_extents (extents))
{
@ -376,8 +380,8 @@ struct hb_font_t
}
}
inline void get_extents_for_direction (hb_direction_t direction,
hb_font_extents_t *extents)
void get_extents_for_direction (hb_direction_t direction,
hb_font_extents_t *extents)
{
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
get_h_extents_with_fallback (extents);
@ -385,9 +389,9 @@ struct hb_font_t
get_v_extents_with_fallback (extents);
}
inline void get_glyph_advance_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
void get_glyph_advance_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
@ -395,12 +399,12 @@ struct hb_font_t
else
*y = get_glyph_v_advance (glyph);
}
inline void get_glyph_advances_for_direction (hb_direction_t direction,
unsigned int count,
const hb_codepoint_t *first_glyph,
unsigned glyph_stride,
hb_position_t *first_advance,
unsigned advance_stride)
void get_glyph_advances_for_direction (hb_direction_t direction,
unsigned int count,
const hb_codepoint_t *first_glyph,
unsigned glyph_stride,
hb_position_t *first_advance,
unsigned advance_stride)
{
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
get_glyph_h_advances (count, first_glyph, glyph_stride, first_advance, advance_stride);
@ -408,8 +412,8 @@ struct hb_font_t
get_glyph_v_advances (count, first_glyph, glyph_stride, first_advance, advance_stride);
}
inline void guess_v_origin_minus_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
void guess_v_origin_minus_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
*x = get_glyph_h_advance (glyph) / 2;
@ -419,8 +423,8 @@ struct hb_font_t
*y = extents.ascender;
}
inline void get_glyph_h_origin_with_fallback (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
void get_glyph_h_origin_with_fallback (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
if (!get_glyph_h_origin (glyph, x, y) &&
get_glyph_v_origin (glyph, x, y))
@ -430,8 +434,8 @@ struct hb_font_t
*x -= dx; *y -= dy;
}
}
inline void get_glyph_v_origin_with_fallback (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
void get_glyph_v_origin_with_fallback (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
if (!get_glyph_v_origin (glyph, x, y) &&
get_glyph_h_origin (glyph, x, y))
@ -442,9 +446,9 @@ struct hb_font_t
}
}
inline void get_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
void get_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
get_glyph_h_origin_with_fallback (glyph, x, y);
@ -452,8 +456,8 @@ struct hb_font_t
get_glyph_v_origin_with_fallback (glyph, x, y);
}
inline void add_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
void add_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
hb_position_t origin_x, origin_y;
@ -462,8 +466,8 @@ struct hb_font_t
*x += origin_x;
*y += origin_y;
}
inline void add_glyph_v_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
void add_glyph_v_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
hb_position_t origin_x, origin_y;
@ -472,9 +476,9 @@ struct hb_font_t
*x += origin_x;
*y += origin_y;
}
inline void add_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
void add_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
hb_position_t origin_x, origin_y;
@ -484,8 +488,8 @@ struct hb_font_t
*y += origin_y;
}
inline void subtract_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
void subtract_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
hb_position_t origin_x, origin_y;
@ -494,8 +498,8 @@ struct hb_font_t
*x -= origin_x;
*y -= origin_y;
}
inline void subtract_glyph_v_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
void subtract_glyph_v_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
hb_position_t origin_x, origin_y;
@ -504,9 +508,9 @@ struct hb_font_t
*x -= origin_x;
*y -= origin_y;
}
inline void subtract_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
void subtract_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
hb_position_t origin_x, origin_y;
@ -516,9 +520,9 @@ struct hb_font_t
*y -= origin_y;
}
inline void get_glyph_kerning_for_direction (hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
void get_glyph_kerning_for_direction (hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
*y = 0;
@ -529,9 +533,9 @@ struct hb_font_t
}
}
inline hb_bool_t get_glyph_extents_for_origin (hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t *extents)
hb_bool_t get_glyph_extents_for_origin (hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t *extents)
{
hb_bool_t ret = get_glyph_extents (glyph, extents);
@ -541,9 +545,9 @@ struct hb_font_t
return ret;
}
inline hb_bool_t get_glyph_contour_point_for_origin (hb_codepoint_t glyph, unsigned int point_index,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
hb_bool_t get_glyph_contour_point_for_origin (hb_codepoint_t glyph, unsigned int point_index,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
hb_bool_t ret = get_glyph_contour_point (glyph, point_index, x, y);
@ -554,7 +558,7 @@ struct hb_font_t
}
/* Generates gidDDD if glyph has no name. */
inline void
void
glyph_to_string (hb_codepoint_t glyph,
char *s, unsigned int size)
{
@ -565,7 +569,7 @@ struct hb_font_t
}
/* Parses gidDDD and uniUUUU strings automatically. */
inline hb_bool_t
hb_bool_t
glyph_from_string (const char *s, int len, /* -1 means nul-terminated */
hb_codepoint_t *glyph)
{
@ -595,21 +599,17 @@ struct hb_font_t
return false;
}
inline hb_position_t em_scale (int16_t v, int scale)
hb_position_t em_scale (int16_t v, int scale)
{
int upem = face->get_upem ();
int64_t scaled = v * (int64_t) scale;
scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */
return (hb_position_t) (scaled / upem);
}
inline hb_position_t em_scalef (float v, int scale)
{
return (hb_position_t) round (v * scale / face->get_upem ());
}
inline float em_fscale (int16_t v, int scale)
{
return (float) v * scale / face->get_upem ();
}
hb_position_t em_scalef (float v, int scale)
{ return (hb_position_t) round (v * scale / face->get_upem ()); }
float em_fscale (int16_t v, int scale)
{ return (float) v * scale / face->get_upem (); }
};
DECLARE_NULL_INSTANCE (hb_font_t);

View File

@ -484,7 +484,7 @@ static void free_static_ft_funcs (void);
static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft_font_funcs_lazy_loader_t>
{
static inline hb_font_funcs_t *create (void)
static hb_font_funcs_t *create (void)
{
hb_font_funcs_t *funcs = hb_font_funcs_create ();
@ -751,7 +751,7 @@ static void free_static_ft_library (void);
static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (FT_Library),
hb_ft_library_lazy_loader_t>
{
static inline FT_Library create (void)
static FT_Library create (void)
{
FT_Library l;
if (FT_Init_FreeType (&l))
@ -763,11 +763,11 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (
return l;
}
static inline void destroy (FT_Library l)
static void destroy (FT_Library l)
{
FT_Done_FreeType (l);
}
static inline FT_Library get_null (void)
static FT_Library get_null (void)
{
return nullptr;
}

View File

@ -342,7 +342,7 @@ static void free_static_glib_funcs (void);
static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_glib_unicode_funcs_lazy_loader_t>
{
static inline hb_unicode_funcs_t *create (void)
static hb_unicode_funcs_t *create (void)
{
hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);

View File

@ -307,7 +307,7 @@ static void free_static_icu_funcs (void);
static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_icu_unicode_funcs_lazy_loader_t>
{
static inline hb_unicode_funcs_t *create (void)
static hb_unicode_funcs_t *create (void)
{
void *user_data = nullptr;
#if U_ICU_VERSION_MAJOR_NUM >= 49

View File

@ -65,28 +65,28 @@ struct Iter<T *>
typedef T Value;
/* Constructors. */
inline Iter (T *array_, int length_) :
Iter (T *array_, int length_) :
array (array_), length (MAX (length_, 0)) {}
template <unsigned int length_>
explicit inline Iter (T (&array_)[length_]) :
array (array_), length (length_) {}
/* Emptiness. */
explicit_operator inline operator bool (void) const { return bool (length); }
explicit_operator operator bool (void) const { return bool (length); }
/* Current item. */
inline T &operator * (void)
T &operator * (void)
{
if (unlikely (!length)) return CrapOrNull(T);
return *array;
}
inline T &operator -> (void)
T &operator -> (void)
{
return (operator *);
}
/* Next. */
inline Iter<T *> & operator ++ (void)
Iter<T *> & operator ++ (void)
{
if (unlikely (!length)) return *this;
array++;
@ -94,7 +94,7 @@ struct Iter<T *>
return *this;
}
/* Might return void, or a copy of pre-increment iterator. */
inline void operator ++ (int)
void operator ++ (int)
{
if (unlikely (!length)) return;
array++;
@ -102,11 +102,11 @@ struct Iter<T *>
}
/* Some iterators might implement len(). */
inline unsigned int len (void) const { return length; }
unsigned int len (void) const { return length; }
/* Some iterators might implement fast-forward.
* Only implement it if it's constant-time. */
inline void operator += (unsigned int n)
void operator += (unsigned int n)
{
n = MIN (n, length);
array += n;
@ -115,7 +115,7 @@ struct Iter<T *>
/* Some iterators might implement random-access.
* Only implement it if it's constant-time. */
inline Iter<T *> & operator [] (unsigned int i)
Iter<T *> & operator [] (unsigned int i)
{
if (unlikely (i >= length)) return CrapOrNull(T);
return array[i];

View File

@ -44,10 +44,10 @@ struct hb_kern_machine_t
crossStream (crossStream_) {}
HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW
inline void kern (hb_font_t *font,
hb_buffer_t *buffer,
hb_mask_t kern_mask,
bool scale = true) const
void kern (hb_font_t *font,
hb_buffer_t *buffer,
hb_mask_t kern_mask,
bool scale = true) const
{
OT::hb_ot_apply_context_t c (1, font, buffer);
c.set_lookup_mask (kern_mask);

View File

@ -81,14 +81,14 @@ static inline Type& StructAfter(TObject &X)
/* Check _assertion in a method environment */
#define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \
inline void _instance_assertion_on_line_##_line (void) const \
void _instance_assertion_on_line_##_line (void) const \
{ static_assert ((_assertion), ""); }
# define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion)
# define DEFINE_INSTANCE_ASSERTION(_assertion) _DEFINE_INSTANCE_ASSERTION0 (__LINE__, _assertion)
/* Check that _code compiles in a method environment */
#define _DEFINE_COMPILES_ASSERTION1(_line, _code) \
inline void _compiles_assertion_on_line_##_line (void) const \
void _compiles_assertion_on_line_##_line (void) const \
{ _code; }
# define _DEFINE_COMPILES_ASSERTION0(_line, _code) _DEFINE_COMPILES_ASSERTION1 (_line, _code)
# define DEFINE_COMPILES_ASSERTION(_code) _DEFINE_COMPILES_ASSERTION0 (__LINE__, _code)
@ -96,7 +96,7 @@ static inline Type& StructAfter(TObject &X)
#define DEFINE_SIZE_STATIC(size) \
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)) \
inline unsigned int get_size (void) const { return (size); } \
unsigned int get_size (void) const { return (size); } \
enum { null_size = (size) }; \
enum { min_size = (size) }; \
enum { static_size = (size) }
@ -123,7 +123,7 @@ static inline Type& StructAfter(TObject &X)
enum { min_size = (size) }
#define DEFINE_SIZE_ARRAY_SIZED(size, array) \
inline unsigned int get_size (void) const { return (size - (array).min_size + (array).get_size ()); } \
unsigned int get_size (void) const { return (size - (array).min_size + (array).get_size ()); } \
DEFINE_SIZE_ARRAY(size, array)
@ -137,7 +137,7 @@ struct hb_dispatch_context_t
enum { max_debug_depth = MaxDebugDepth };
typedef Return return_t;
template <typename T, typename F>
inline bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; }
bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; }
static return_t no_dispatch_return_value (void) { return Context::default_return_value (); }
static bool stop_sublookup_iteration (const return_t r HB_UNUSED) { return false; }
};
@ -226,7 +226,7 @@ struct hb_dispatch_context_t
struct hb_sanitize_context_t :
hb_dispatch_context_t<hb_sanitize_context_t, bool, HB_DEBUG_SANITIZE>
{
inline hb_sanitize_context_t (void) :
hb_sanitize_context_t (void) :
debug_depth (0),
start (nullptr), end (nullptr),
max_ops (0),
@ -235,33 +235,33 @@ struct hb_sanitize_context_t :
num_glyphs (65536),
num_glyphs_set (false) {}
inline const char *get_name (void) { return "SANITIZE"; }
const char *get_name (void) { return "SANITIZE"; }
template <typename T, typename F>
inline bool may_dispatch (const T *obj HB_UNUSED, const F *format)
bool may_dispatch (const T *obj HB_UNUSED, const F *format)
{ return format->sanitize (this); }
template <typename T>
inline return_t dispatch (const T &obj) { return obj.sanitize (this); }
return_t dispatch (const T &obj) { return obj.sanitize (this); }
static return_t default_return_value (void) { return true; }
static return_t no_dispatch_return_value (void) { return false; }
bool stop_sublookup_iteration (const return_t r) const { return !r; }
inline void init (hb_blob_t *b)
void init (hb_blob_t *b)
{
this->blob = hb_blob_reference (b);
this->writable = false;
}
inline void set_num_glyphs (unsigned int num_glyphs_)
void set_num_glyphs (unsigned int num_glyphs_)
{
num_glyphs = num_glyphs_;
num_glyphs_set = true;
}
inline unsigned int get_num_glyphs (void) { return num_glyphs; }
unsigned int get_num_glyphs (void) { return num_glyphs; }
inline void set_max_ops (int max_ops_) { max_ops = max_ops_; }
void set_max_ops (int max_ops_) { max_ops = max_ops_; }
template <typename T>
inline void set_object (const T *obj)
void set_object (const T *obj)
{
reset_object ();
@ -280,14 +280,14 @@ struct hb_sanitize_context_t :
}
}
inline void reset_object (void)
void reset_object (void)
{
this->start = this->blob->data;
this->end = this->start + this->blob->length;
assert (this->start <= this->end); /* Must not overflow. */
}
inline void start_processing (void)
void start_processing (void)
{
reset_object ();
this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
@ -301,7 +301,7 @@ struct hb_sanitize_context_t :
(unsigned long) (this->end - this->start));
}
inline void end_processing (void)
void end_processing (void)
{
DEBUG_MSG_LEVEL (SANITIZE, this->start, 0, -1,
"end [%p..%p] %u edit requests",
@ -312,7 +312,7 @@ struct hb_sanitize_context_t :
this->start = this->end = nullptr;
}
inline bool check_range (const void *base,
bool check_range (const void *base,
unsigned int len) const
{
const char *p = (const char *) base;
@ -331,7 +331,7 @@ struct hb_sanitize_context_t :
}
template <typename T>
inline bool check_range (const T *base,
bool check_range (const T *base,
unsigned int a,
unsigned int b) const
{
@ -340,7 +340,7 @@ struct hb_sanitize_context_t :
}
template <typename T>
inline bool check_range (const T *base,
bool check_range (const T *base,
unsigned int a,
unsigned int b,
unsigned int c) const
@ -350,14 +350,14 @@ struct hb_sanitize_context_t :
}
template <typename T>
inline bool check_array (const T *base,
bool check_array (const T *base,
unsigned int len) const
{
return this->check_range (base, len, T::static_size);
}
template <typename T>
inline bool check_array (const T *base,
bool check_array (const T *base,
unsigned int a,
unsigned int b) const
{
@ -365,12 +365,10 @@ struct hb_sanitize_context_t :
}
template <typename Type>
inline bool check_struct (const Type *obj) const
{
return likely (this->check_range (obj, obj->min_size));
}
bool check_struct (const Type *obj) const
{ return likely (this->check_range (obj, obj->min_size)); }
inline bool may_edit (const void *base, unsigned int len)
bool may_edit (const void *base, unsigned int len)
{
if (this->edit_count >= HB_SANITIZE_MAX_EDITS)
return false;
@ -389,7 +387,7 @@ struct hb_sanitize_context_t :
}
template <typename Type, typename ValueType>
inline bool try_set (const Type *obj, const ValueType &v) {
bool try_set (const Type *obj, const ValueType &v) {
if (this->may_edit (obj, obj->static_size)) {
const_cast<Type *> (obj)->set (v);
return true;
@ -398,7 +396,7 @@ struct hb_sanitize_context_t :
}
template <typename Type>
inline hb_blob_t *sanitize_blob (hb_blob_t *blob)
hb_blob_t *sanitize_blob (hb_blob_t *blob)
{
bool sane;
@ -465,7 +463,7 @@ struct hb_sanitize_context_t :
}
template <typename Type>
inline hb_blob_t *reference_table (const hb_face_t *face, hb_tag_t tableTag = Type::tableTag)
hb_blob_t *reference_table (const hb_face_t *face, hb_tag_t tableTag = Type::tableTag)
{
if (!num_glyphs_set)
set_num_glyphs (hb_face_get_glyph_count (face));
@ -486,15 +484,11 @@ struct hb_sanitize_context_t :
struct hb_sanitize_with_object_t
{
template <typename T>
inline hb_sanitize_with_object_t (hb_sanitize_context_t *c,
hb_sanitize_with_object_t (hb_sanitize_context_t *c,
const T& obj) : c (c)
{
c->set_object (obj);
}
inline ~hb_sanitize_with_object_t (void)
{
c->reset_object ();
}
{ c->set_object (obj); }
~hb_sanitize_with_object_t (void)
{ c->reset_object (); }
private:
hb_sanitize_context_t *c;
@ -507,25 +501,25 @@ struct hb_sanitize_with_object_t
struct hb_serialize_context_t
{
inline hb_serialize_context_t (void *start_, unsigned int size)
hb_serialize_context_t (void *start_, unsigned int size)
{
this->start = (char *) start_;
this->end = this->start + size;
reset ();
}
inline void reset (void)
void reset (void)
{
this->ran_out_of_room = false;
this->head = this->start;
this->debug_depth = 0;
}
inline bool err (bool e) { return this->ran_out_of_room = this->ran_out_of_room || e; }
bool err (bool e) { return this->ran_out_of_room = this->ran_out_of_room || e; }
/* To be called around main operation. */
template <typename Type>
inline Type *start_serialize (void)
Type *start_serialize (void)
{
DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, +1,
"start [%p..%p] (%lu bytes)",
@ -534,7 +528,7 @@ struct hb_serialize_context_t
return start_embed<Type> ();
}
inline void end_serialize (void)
void end_serialize (void)
{
DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, -1,
"end [%p..%p] serialized %d bytes; %s",
@ -543,9 +537,9 @@ struct hb_serialize_context_t
this->ran_out_of_room ? "RAN OUT OF ROOM" : "did not ran out of room");
}
inline unsigned int length (void) const { return this->head - this->start; }
unsigned int length (void) const { return this->head - this->start; }
inline void align (unsigned int alignment)
void align (unsigned int alignment)
{
unsigned int l = length () % alignment;
if (l)
@ -553,14 +547,14 @@ struct hb_serialize_context_t
}
template <typename Type>
inline Type *start_embed (const Type *_ HB_UNUSED = nullptr) const
Type *start_embed (const Type *_ HB_UNUSED = nullptr) const
{
Type *ret = reinterpret_cast<Type *> (this->head);
return ret;
}
template <typename Type>
inline Type *allocate_size (unsigned int size)
Type *allocate_size (unsigned int size)
{
if (unlikely (this->ran_out_of_room || this->end - this->head < ptrdiff_t (size))) {
this->ran_out_of_room = true;
@ -573,13 +567,13 @@ struct hb_serialize_context_t
}
template <typename Type>
inline Type *allocate_min (void)
Type *allocate_min (void)
{
return this->allocate_size<Type> (Type::min_size);
}
template <typename Type>
inline Type *embed (const Type &obj)
Type *embed (const Type &obj)
{
unsigned int size = obj.get_size ();
Type *ret = this->allocate_size<Type> (size);
@ -589,7 +583,7 @@ struct hb_serialize_context_t
}
template <typename Type>
inline Type *extend_size (Type &obj, unsigned int size)
Type *extend_size (Type &obj, unsigned int size)
{
assert (this->start <= (char *) &obj);
assert ((char *) &obj <= this->head);
@ -599,14 +593,14 @@ struct hb_serialize_context_t
}
template <typename Type>
inline Type *extend_min (Type &obj) { return extend_size (obj, obj.min_size); }
Type *extend_min (Type &obj) { return extend_size (obj, obj.min_size); }
template <typename Type>
inline Type *extend (Type &obj) { return extend_size (obj, obj.get_size ()); }
Type *extend (Type &obj) { return extend_size (obj, obj.get_size ()); }
/* Output routines. */
template <typename Type>
inline Type *copy (void) const
Type *copy (void) const
{
assert (!this->ran_out_of_room);
unsigned int len = this->head - this->start;
@ -615,7 +609,7 @@ struct hb_serialize_context_t
memcpy (p, this->start, len);
return reinterpret_cast<Type *> (p);
}
inline hb_bytes_t copy_bytes (void) const
hb_bytes_t copy_bytes (void) const
{
assert (!this->ran_out_of_room);
unsigned int len = this->head - this->start;
@ -626,7 +620,7 @@ struct hb_serialize_context_t
return hb_bytes_t ();
return hb_bytes_t (p, len);
}
inline hb_blob_t *copy_blob (void) const
hb_blob_t *copy_blob (void) const
{
assert (!this->ran_out_of_room);
return hb_blob_create (this->start,
@ -649,32 +643,32 @@ struct hb_serialize_context_t
template <typename Type>
struct Supplier
{
inline Supplier (const Type *array, unsigned int len_, unsigned int stride_=sizeof (Type))
Supplier (const Type *array, unsigned int len_, unsigned int stride_=sizeof (Type))
{
head = array;
len = len_;
stride = stride_;
}
inline Supplier (hb_array_t<const Type> v)
Supplier (hb_array_t<const Type> v)
{
head = v.arrayZ;
len = v.len;
stride = sizeof (Type);
}
inline Supplier (const hb_vector_t<Type> &v)
Supplier (const hb_vector_t<Type> &v)
{
head = (const Type *) v;
len = v.len;
stride = sizeof (Type);
}
inline const Type operator [] (unsigned int i) const
const Type operator [] (unsigned int i) const
{
if (unlikely (i >= len)) return Type ();
return * (const Type *) (const void *) ((const char *) head + stride * i);
}
inline Supplier<Type> & operator += (unsigned int count)
Supplier<Type> & operator += (unsigned int count)
{
if (unlikely (count > len))
count = len;
@ -684,8 +678,8 @@ struct Supplier
}
private:
inline Supplier (const Supplier<Type> &); /* Disallow copy */
inline Supplier<Type>& operator= (const Supplier<Type> &); /* Disallow copy */
Supplier (const Supplier<Type> &); /* Disallow copy */
Supplier<Type>& operator= (const Supplier<Type> &); /* Disallow copy */
unsigned int len;
unsigned int stride;
@ -704,14 +698,10 @@ struct BEInt<Type, 1>
{
public:
typedef Type type;
inline void set (Type V)
{
v = V;
}
inline operator Type (void) const
{
return v;
}
void set (Type V)
{ v = V; }
operator Type (void) const
{ return v; }
private: uint8_t v;
};
template <typename Type>
@ -719,12 +709,12 @@ struct BEInt<Type, 2>
{
public:
typedef Type type;
inline void set (Type V)
void set (Type V)
{
v[0] = (V >> 8) & 0xFF;
v[1] = (V ) & 0xFF;
}
inline operator Type (void) const
operator Type (void) const
{
#if (defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)
/* Spoon-feed the compiler a big-endian integer with alignment 1.
@ -742,13 +732,13 @@ struct BEInt<Type, 3>
{
public:
typedef Type type;
inline void set (Type V)
void set (Type V)
{
v[0] = (V >> 16) & 0xFF;
v[1] = (V >> 8) & 0xFF;
v[2] = (V ) & 0xFF;
}
inline operator Type (void) const
operator Type (void) const
{
return (v[0] << 16)
+ (v[1] << 8)
@ -761,14 +751,14 @@ struct BEInt<Type, 4>
{
public:
typedef Type type;
inline void set (Type V)
void set (Type V)
{
v[0] = (V >> 24) & 0xFF;
v[1] = (V >> 16) & 0xFF;
v[2] = (V >> 8) & 0xFF;
v[3] = (V ) & 0xFF;
}
inline operator Type (void) const
operator Type (void) const
{
return (v[0] << 24)
+ (v[1] << 16)
@ -788,23 +778,23 @@ struct hb_data_wrapper_t
{
static_assert (WheresData > 0, "");
inline Data * get_data (void) const
Data * get_data (void) const
{
return *(((Data **) (void *) this) - WheresData);
}
inline bool is_inert (void) const { return !get_data (); }
bool is_inert (void) const { return !get_data (); }
template <typename Stored, typename Subclass>
inline Stored * call_create (void) const { return Subclass::create (get_data ()); }
Stored * call_create (void) const { return Subclass::create (get_data ()); }
};
template <>
struct hb_data_wrapper_t<void, 0>
{
inline bool is_inert (void) const { return false; }
bool is_inert (void) const { return false; }
template <typename Stored, typename Funcs>
inline Stored * call_create (void) const { return Funcs::create (); }
Stored * call_create (void) const { return Funcs::create (); }
};
template <typename T1, typename T2> struct hb_non_void_t { typedef T1 value; };
@ -821,13 +811,13 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
hb_lazy_loader_t<Returned,Subclass,Data,WheresData,Stored>
>::value Funcs;
inline void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */
inline void init (void) { instance.set_relaxed (nullptr); }
inline void fini (void)
void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */
void init (void) { instance.set_relaxed (nullptr); }
void fini (void)
{
do_destroy (instance.get ());
}
inline void free_instance (void)
void free_instance (void)
{
retry:
Stored *p = instance.get ();
@ -836,19 +826,19 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
do_destroy (p);
}
static inline void do_destroy (Stored *p)
static void do_destroy (Stored *p)
{
if (p && p != const_cast<Stored *> (Funcs::get_null ()))
Funcs::destroy (p);
}
inline const Returned * operator -> (void) const { return get (); }
inline const Returned & operator * (void) const { return *get (); }
explicit_operator inline operator bool (void) const
const Returned * operator -> (void) const { return get (); }
const Returned & operator * (void) const { return *get (); }
explicit_operator operator bool (void) const
{ return get_stored () != Funcs::get_null (); }
template <typename C> inline operator const C * (void) const { return get (); }
template <typename C> operator const C * (void) const { return get (); }
inline Stored * get_stored (void) const
Stored * get_stored (void) const
{
retry:
Stored *p = this->instance.get ();
@ -869,41 +859,41 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
}
return p;
}
inline Stored * get_stored_relaxed (void) const
Stored * get_stored_relaxed (void) const
{
return this->instance.get_relaxed ();
}
inline bool cmpexch (Stored *current, Stored *value) const
bool cmpexch (Stored *current, Stored *value) const
{
/* This *must* be called when there are no other threads accessing. */
return this->instance.cmpexch (current, value);
}
inline const Returned * get (void) const { return Funcs::convert (get_stored ()); }
inline const Returned * get_relaxed (void) const { return Funcs::convert (get_stored_relaxed ()); }
inline Returned * get_unconst (void) const { return const_cast<Returned *> (Funcs::convert (get_stored ())); }
const Returned * get (void) const { return Funcs::convert (get_stored ()); }
const Returned * get_relaxed (void) const { return Funcs::convert (get_stored_relaxed ()); }
Returned * get_unconst (void) const { return const_cast<Returned *> (Funcs::convert (get_stored ())); }
/* To be possibly overloaded by subclasses. */
static inline Returned* convert (Stored *p) { return p; }
static Returned* convert (Stored *p) { return p; }
/* By default null/init/fini the object. */
static inline const Stored* get_null (void) { return &Null(Stored); }
static inline Stored *create (Data *data)
static const Stored* get_null (void) { return &Null(Stored); }
static Stored *create (Data *data)
{
Stored *p = (Stored *) calloc (1, sizeof (Stored));
if (likely (p))
p->init (data);
return p;
}
static inline Stored *create (void)
static Stored *create (void)
{
Stored *p = (Stored *) calloc (1, sizeof (Stored));
if (likely (p))
p->init ();
return p;
}
static inline void destroy (Stored *p)
static void destroy (Stored *p)
{
p->fini ();
free (p);
@ -927,24 +917,24 @@ struct hb_table_lazy_loader_t : hb_lazy_loader_t<T,
hb_face_t, WheresFace,
hb_blob_t>
{
static inline hb_blob_t *create (hb_face_t *face)
static hb_blob_t *create (hb_face_t *face)
{
return hb_sanitize_context_t ().reference_table<T> (face);
}
static inline void destroy (hb_blob_t *p)
static void destroy (hb_blob_t *p)
{
hb_blob_destroy (p);
}
static inline const hb_blob_t *get_null (void)
static const hb_blob_t *get_null (void)
{
return hb_blob_get_empty ();
}
static inline const T* convert (const hb_blob_t *blob)
static const T* convert (const hb_blob_t *blob)
{
return blob->as<T> ();
}
inline hb_blob_t* get_blob (void) const
hb_blob_t* get_blob (void) const
{
return this->get_stored ();
}
@ -953,11 +943,11 @@ struct hb_table_lazy_loader_t : hb_lazy_loader_t<T,
template <typename Subclass>
struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<hb_font_funcs_t, Subclass>
{
static inline void destroy (hb_font_funcs_t *p)
static void destroy (hb_font_funcs_t *p)
{
hb_font_funcs_destroy (p);
}
static inline const hb_font_funcs_t *get_null (void)
static const hb_font_funcs_t *get_null (void)
{
return hb_font_funcs_get_empty ();
}
@ -965,11 +955,11 @@ struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<hb_font_funcs_t, Subclass>
template <typename Subclass>
struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unicode_funcs_t, Subclass>
{
static inline void destroy (hb_unicode_funcs_t *p)
static void destroy (hb_unicode_funcs_t *p)
{
hb_unicode_funcs_destroy (p);
}
static inline const hb_unicode_funcs_t *get_null (void)
static const hb_unicode_funcs_t *get_null (void)
{
return hb_unicode_funcs_get_empty ();
}

View File

@ -45,16 +45,16 @@ inline uint32_t Hash (const T &v)
struct hb_map_t
{
HB_NO_COPY_ASSIGN (hb_map_t);
inline hb_map_t (void) { init (); }
inline ~hb_map_t (void) { fini (); }
hb_map_t (void) { init (); }
~hb_map_t (void) { fini (); }
struct item_t
{
hb_codepoint_t key;
hb_codepoint_t value;
inline bool is_unused (void) const { return key == INVALID; }
inline bool is_tombstone (void) const { return key != INVALID && value == INVALID; }
bool is_unused (void) const { return key == INVALID; }
bool is_tombstone (void) const { return key != INVALID && value == INVALID; }
};
hb_object_header_t header;
@ -65,7 +65,7 @@ struct hb_map_t
unsigned int prime;
item_t *items;
inline void init_shallow (void)
void init_shallow (void)
{
successful = true;
population = occupancy = 0;
@ -73,24 +73,24 @@ struct hb_map_t
prime = 0;
items = nullptr;
}
inline void init (void)
void init (void)
{
hb_object_init (this);
init_shallow ();
}
inline void fini_shallow (void)
void fini_shallow (void)
{
free (items);
items = nullptr;
}
inline void fini (void)
void fini (void)
{
population = occupancy = 0;
hb_object_fini (this);
fini_shallow ();
}
inline bool resize (void)
bool resize (void)
{
if (unlikely (!successful)) return false;
@ -124,7 +124,7 @@ struct hb_map_t
return true;
}
inline void set (hb_codepoint_t key, hb_codepoint_t value)
void set (hb_codepoint_t key, hb_codepoint_t value)
{
if (unlikely (!successful)) return;
if (unlikely (key == INVALID)) return;
@ -149,36 +149,36 @@ struct hb_map_t
population++;
}
inline hb_codepoint_t get (hb_codepoint_t key) const
hb_codepoint_t get (hb_codepoint_t key) const
{
if (unlikely (!items)) return INVALID;
unsigned int i = bucket_for (key);
return items[i].key == key ? items[i].value : INVALID;
}
inline void del (hb_codepoint_t key) { set (key, INVALID); }
void del (hb_codepoint_t key) { set (key, INVALID); }
inline bool has (hb_codepoint_t key) const
bool has (hb_codepoint_t key) const
{ return get (key) != INVALID; }
inline hb_codepoint_t operator [] (unsigned int key) const
hb_codepoint_t operator [] (unsigned int key) const
{ return get (key); }
enum { INVALID = HB_MAP_VALUE_INVALID };
inline void clear (void)
void clear (void)
{
memset (items, 0xFF, ((size_t) mask + 1) * sizeof (item_t));
population = occupancy = 0;
}
inline bool is_empty (void) const { return population == 0; }
bool is_empty (void) const { return population == 0; }
inline unsigned int get_population (void) const { return population; }
unsigned int get_population (void) const { return population; }
protected:
inline unsigned int bucket_for (hb_codepoint_t key) const
unsigned int bucket_for (hb_codepoint_t key) const
{
unsigned int i = Hash (key) % prime;
unsigned int step = 0;
@ -194,7 +194,7 @@ struct hb_map_t
return tombstone == INVALID ? i : tombstone;
}
static inline unsigned int prime_for (unsigned int shift)
static unsigned int prime_for (unsigned int shift)
{
/* Following comment and table copied from glib. */
/* Each table size has an associated prime modulo (the first prime

View File

@ -131,16 +131,16 @@ struct hb_mutex_t
hb_mutex_impl_t m;
inline void init (void) { hb_mutex_impl_init (&m); }
inline void lock (void) { hb_mutex_impl_lock (&m); }
inline void unlock (void) { hb_mutex_impl_unlock (&m); }
inline void fini (void) { hb_mutex_impl_finish (&m); }
void init (void) { hb_mutex_impl_init (&m); }
void lock (void) { hb_mutex_impl_lock (&m); }
void unlock (void) { hb_mutex_impl_unlock (&m); }
void fini (void) { hb_mutex_impl_finish (&m); }
};
struct hb_lock_t
{
inline hb_lock_t (hb_mutex_t &mutex_) : mutex (mutex_) { mutex.lock (); }
inline ~hb_lock_t (void) { mutex.unlock (); }
hb_lock_t (hb_mutex_t &mutex_) : mutex (mutex_) { mutex.lock (); }
~hb_lock_t (void) { mutex.unlock (); }
private:
hb_mutex_t &mutex;
};

View File

@ -91,7 +91,7 @@ template <typename QType>
struct NullHelper
{
typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type;
static inline const Type & get_null (void) { return Null<Type> (); }
static const Type & get_null (void) { return Null<Type> (); }
};
#define Null(Type) NullHelper<Type>::get_null ()
@ -140,17 +140,17 @@ template <typename QType>
struct CrapHelper
{
typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type;
static inline Type & get_crap (void) { return Crap<Type> (); }
static Type & get_crap (void) { return Crap<Type> (); }
};
#define Crap(Type) CrapHelper<Type>::get_crap ()
template <typename Type>
struct CrapOrNullHelper {
static inline Type & get (void) { return Crap(Type); }
static Type & get (void) { return Crap(Type); }
};
template <typename Type>
struct CrapOrNullHelper<const Type> {
static inline const Type & get (void) { return Null(Type); }
static const Type & get (void) { return Null(Type); }
};
#define CrapOrNull(Type) CrapOrNullHelper<Type>::get ()
@ -164,16 +164,16 @@ struct hb_nonnull_ptr_t
{
typedef typename hb_remove_pointer (P) T;
inline hb_nonnull_ptr_t (T *v_ = nullptr) : v (v_) {}
inline T * operator = (T *v_) { return v = v_; }
inline T * operator -> (void) const { return get (); }
inline T & operator * (void) const { return *get (); }
inline T ** operator & (void) const { return &v; }
hb_nonnull_ptr_t (T *v_ = nullptr) : v (v_) {}
T * operator = (T *v_) { return v = v_; }
T * operator -> (void) const { return get (); }
T & operator * (void) const { return *get (); }
T ** operator & (void) const { return &v; }
/* Only auto-cast to const types. */
template <typename C> inline operator const C * (void) const { return get (); }
inline operator const char * (void) const { return (const char *) get (); }
inline T * get (void) const { return v ? v : const_cast<T *> (&Null(T)); }
inline T * get_raw (void) const { return v; }
template <typename C> operator const C * (void) const { return get (); }
operator const char * (void) const { return (const char *) get (); }
T * get (void) const { return v ? v : const_cast<T *> (&Null(T)); }
T * get_raw (void) const { return v; }
T *v;
};

View File

@ -47,10 +47,10 @@ struct hb_lockable_set_t
{
hb_vector_t <item_t, 1> items;
inline void init (void) { items.init (); }
void init (void) { items.init (); }
template <typename T>
inline item_t *replace_or_insert (T v, lock_t &l, bool replace)
item_t *replace_or_insert (T v, lock_t &l, bool replace)
{
l.lock ();
item_t *item = items.find (v);
@ -73,7 +73,7 @@ struct hb_lockable_set_t
}
template <typename T>
inline void remove (T v, lock_t &l)
void remove (T v, lock_t &l)
{
l.lock ();
item_t *item = items.find (v);
@ -89,7 +89,7 @@ struct hb_lockable_set_t
}
template <typename T>
inline bool find (T v, item_t *i, lock_t &l)
bool find (T v, item_t *i, lock_t &l)
{
l.lock ();
item_t *item = items.find (v);
@ -100,7 +100,7 @@ struct hb_lockable_set_t
}
template <typename T>
inline item_t *find_or_insert (T v, lock_t &l)
item_t *find_or_insert (T v, lock_t &l)
{
l.lock ();
item_t *item = items.find (v);
@ -111,7 +111,7 @@ struct hb_lockable_set_t
return item;
}
inline void fini (lock_t &l)
void fini (lock_t &l)
{
if (!items.len) {
/* No need for locking. */
@ -145,14 +145,14 @@ struct hb_reference_count_t
{
mutable hb_atomic_int_t ref_count;
inline void init (int v = 1) { ref_count.set_relaxed (v); }
inline int get_relaxed (void) const { return ref_count.get_relaxed (); }
inline int inc (void) const { return ref_count.inc (); }
inline int dec (void) const { return ref_count.dec (); }
inline void fini (void) { ref_count.set_relaxed (HB_REFERENCE_COUNT_POISON_VALUE); }
void init (int v = 1) { ref_count.set_relaxed (v); }
int get_relaxed (void) const { return ref_count.get_relaxed (); }
int inc (void) const { return ref_count.inc (); }
int dec (void) const { return ref_count.dec (); }
void fini (void) { ref_count.set_relaxed (HB_REFERENCE_COUNT_POISON_VALUE); }
inline bool is_inert (void) const { return ref_count.get_relaxed () == HB_REFERENCE_COUNT_INERT_VALUE; }
inline bool is_valid (void) const { return ref_count.get_relaxed () > 0; }
bool is_inert (void) const { return ref_count.get_relaxed () == HB_REFERENCE_COUNT_INERT_VALUE; }
bool is_valid (void) const { return ref_count.get_relaxed () > 0; }
};
@ -165,8 +165,8 @@ struct hb_user_data_array_t
void *data;
hb_destroy_func_t destroy;
inline bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; }
inline bool operator == (hb_user_data_item_t &other) const { return key == other.key; }
bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; }
bool operator == (hb_user_data_item_t &other) const { return key == other.key; }
void fini (void) { if (destroy) destroy (data); }
};
@ -174,7 +174,7 @@ struct hb_user_data_array_t
hb_mutex_t lock;
hb_lockable_set_t<hb_user_data_item_t, hb_mutex_t> items;
inline void init (void) { lock.init (); items.init (); }
void init (void) { lock.init (); items.init (); }
HB_INTERNAL bool set (hb_user_data_key_t *key,
void * data,
@ -183,7 +183,7 @@ struct hb_user_data_array_t
HB_INTERNAL void *get (hb_user_data_key_t *key);
inline void fini (void) { items.fini (lock); lock.fini (); }
void fini (void) { items.fini (lock); lock.fini (); }
};

View File

@ -64,7 +64,7 @@ typedef struct TableRecord
return b->cmp (a->tag);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -83,13 +83,13 @@ typedef struct OffsetTable
{
friend struct OpenTypeFontFile;
inline unsigned int get_table_count (void) const
unsigned int get_table_count (void) const
{ return tables.len; }
inline const TableRecord& get_table (unsigned int i) const
const TableRecord& get_table (unsigned int i) const
{
return tables[i];
}
inline unsigned int get_table_tags (unsigned int start_offset,
unsigned int get_table_tags (unsigned int start_offset,
unsigned int *table_count, /* IN/OUT */
hb_tag_t *table_tags /* OUT */) const
{
@ -107,13 +107,13 @@ typedef struct OffsetTable
}
return tables.len;
}
inline bool find_table_index (hb_tag_t tag, unsigned int *table_index) const
bool find_table_index (hb_tag_t tag, unsigned int *table_index) const
{
Tag t;
t.set (tag);
return tables.bfind (t, table_index, HB_BFIND_NOT_FOUND_STORE, Index::NOT_FOUND_INDEX);
}
inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
const TableRecord& get_table_by_tag (hb_tag_t tag) const
{
unsigned int table_index;
find_table_index (tag, &table_index);
@ -122,11 +122,11 @@ typedef struct OffsetTable
public:
inline bool serialize (hb_serialize_context_t *c,
hb_tag_t sfnt_tag,
Supplier<hb_tag_t> &tags,
Supplier<hb_blob_t *> &blobs,
unsigned int table_count)
bool serialize (hb_serialize_context_t *c,
hb_tag_t sfnt_tag,
Supplier<hb_tag_t> &tags,
Supplier<hb_blob_t *> &blobs,
unsigned int table_count)
{
TRACE_SERIALIZE (this);
/* Alloc 12 for the OTHeader. */
@ -192,7 +192,7 @@ typedef struct OffsetTable
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && tables.sanitize (c));
@ -215,10 +215,10 @@ struct TTCHeaderVersion1
{
friend struct TTCHeader;
inline unsigned int get_face_count (void) const { return table.len; }
inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
unsigned int get_face_count (void) const { return table.len; }
const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (table.sanitize (c, this));
@ -241,7 +241,7 @@ struct TTCHeader
private:
inline unsigned int get_face_count (void) const
unsigned int get_face_count (void) const
{
switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */
@ -249,7 +249,7 @@ struct TTCHeader
default:return 0;
}
}
inline const OpenTypeFontFace& get_face (unsigned int i) const
const OpenTypeFontFace& get_face (unsigned int i) const
{
switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */
@ -258,7 +258,7 @@ struct TTCHeader
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!u.header.version.sanitize (c))) return_trace (false);
@ -288,10 +288,10 @@ struct TTCHeader
struct ResourceRecord
{
inline const OpenTypeFontFace & get_face (const void *data_base) const
const OpenTypeFontFace & get_face (const void *data_base) const
{ return CastR<OpenTypeFontFace> ((data_base+offset).arrayZ); }
inline bool sanitize (hb_sanitize_context_t *c,
bool sanitize (hb_sanitize_context_t *c,
const void *data_base) const
{
TRACE_SANITIZE (this);
@ -317,20 +317,20 @@ struct ResourceRecord
struct ResourceTypeRecord
{
inline unsigned int get_resource_count (void) const
unsigned int get_resource_count (void) const
{ return tag == HB_TAG_sfnt ? resCountM1 + 1 : 0; }
inline bool is_sfnt (void) const { return tag == HB_TAG_sfnt; }
bool is_sfnt (void) const { return tag == HB_TAG_sfnt; }
inline const ResourceRecord& get_resource_record (unsigned int i,
const void *type_base) const
const ResourceRecord& get_resource_record (unsigned int i,
const void *type_base) const
{
return (type_base+resourcesZ).as_array (get_resource_count ())[i];
}
inline bool sanitize (hb_sanitize_context_t *c,
const void *type_base,
const void *data_base) const
bool sanitize (hb_sanitize_context_t *c,
const void *type_base,
const void *data_base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -351,7 +351,7 @@ struct ResourceTypeRecord
struct ResourceMap
{
inline unsigned int get_face_count (void) const
unsigned int get_face_count (void) const
{
unsigned int count = get_type_count ();
for (unsigned int i = 0; i < count; i++)
@ -363,8 +363,8 @@ struct ResourceMap
return 0;
}
inline const OpenTypeFontFace& get_face (unsigned int idx,
const void *data_base) const
const OpenTypeFontFace& get_face (unsigned int idx,
const void *data_base) const
{
unsigned int count = get_type_count ();
for (unsigned int i = 0; i < count; i++)
@ -378,7 +378,7 @@ struct ResourceMap
return Null (OpenTypeFontFace);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *data_base) const
bool sanitize (hb_sanitize_context_t *c, const void *data_base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -388,9 +388,9 @@ struct ResourceMap
}
private:
inline unsigned int get_type_count (void) const { return (this+typeList).lenM1 + 1; }
unsigned int get_type_count (void) const { return (this+typeList).lenM1 + 1; }
inline const ResourceTypeRecord& get_type_record (unsigned int i) const
const ResourceTypeRecord& get_type_record (unsigned int i) const
{ return (this+typeList)[i]; }
protected:
@ -409,11 +409,11 @@ struct ResourceMap
struct ResourceForkHeader
{
inline unsigned int get_face_count (void) const
unsigned int get_face_count (void) const
{ return (this+map).get_face_count (); }
inline const OpenTypeFontFace& get_face (unsigned int idx,
unsigned int *base_offset = nullptr) const
const OpenTypeFontFace& get_face (unsigned int idx,
unsigned int *base_offset = nullptr) const
{
const OpenTypeFontFace &face = (this+map).get_face (idx, &(this+data));
if (base_offset)
@ -421,7 +421,7 @@ struct ResourceForkHeader
return face;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -457,9 +457,9 @@ struct OpenTypeFontFile
Typ1Tag = HB_TAG ('t','y','p','1') /* Obsolete Apple Type1 font in SFNT container */
};
inline hb_tag_t get_tag (void) const { return u.tag; }
hb_tag_t get_tag (void) const { return u.tag; }
inline unsigned int get_face_count (void) const
unsigned int get_face_count (void) const
{
switch (u.tag) {
case CFFTag: /* All the non-collection tags */
@ -471,7 +471,7 @@ struct OpenTypeFontFile
default: return 0;
}
}
inline const OpenTypeFontFace& get_face (unsigned int i, unsigned int *base_offset = nullptr) const
const OpenTypeFontFace& get_face (unsigned int i, unsigned int *base_offset = nullptr) const
{
if (base_offset)
*base_offset = 0;
@ -489,11 +489,11 @@ struct OpenTypeFontFile
}
}
inline bool serialize_single (hb_serialize_context_t *c,
hb_tag_t sfnt_tag,
Supplier<hb_tag_t> &tags,
Supplier<hb_blob_t *> &blobs,
unsigned int table_count)
bool serialize_single (hb_serialize_context_t *c,
hb_tag_t sfnt_tag,
Supplier<hb_tag_t> &tags,
Supplier<hb_blob_t *> &blobs,
unsigned int table_count)
{
TRACE_SERIALIZE (this);
assert (sfnt_tag != TTCTag);
@ -501,7 +501,7 @@ struct OpenTypeFontFile
return_trace (u.fontFace.serialize (c, sfnt_tag, tags, blobs, table_count));
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!u.tag.sanitize (c))) return_trace (false);

View File

@ -63,13 +63,13 @@ struct IntType
typedef Type type;
typedef typename hb_signedness_int<hb_is_signed<Type>::value>::value wide_type;
inline void set (wide_type i) { v.set (i); }
inline operator wide_type (void) const { return v; }
inline bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; }
inline bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); }
static inline int cmp (const IntType<Type,Size> *a, const IntType<Type,Size> *b) { return b->cmp (*a); }
void set (wide_type i) { v.set (i); }
operator wide_type (void) const { return v; }
bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; }
bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); }
static int cmp (const IntType<Type,Size> *a, const IntType<Type,Size> *b) { return b->cmp (*a); }
template <typename Type2>
inline int cmp (Type2 a) const
int cmp (Type2 a) const
{
Type b = v;
if (sizeof (Type) < sizeof (int) && sizeof (Type2) < sizeof (int))
@ -77,7 +77,7 @@ struct IntType
else
return a < b ? -1 : a == b ? 0 : +1;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -111,8 +111,8 @@ typedef HBUINT16 UFWORD;
struct F2DOT14 : HBINT16
{
// 16384 means 1<<14
inline float to_float (void) const { return ((int32_t) v) / 16384.f; }
inline void set_float (float f) { v.set (round (f * 16384.f)); }
float to_float (void) const { return ((int32_t) v) / 16384.f; }
void set_float (float f) { v.set (round (f * 16384.f)); }
public:
DEFINE_SIZE_STATIC (2);
};
@ -121,8 +121,8 @@ struct F2DOT14 : HBINT16
struct Fixed : HBINT32
{
// 65536 means 1<<16
inline float to_float (void) const { return ((int32_t) v) / 65536.f; }
inline void set_float (float f) { v.set (round (f * 65536.f)); }
float to_float (void) const { return ((int32_t) v) / 65536.f; }
void set_float (float f) { v.set (round (f * 65536.f)); }
public:
DEFINE_SIZE_STATIC (4);
};
@ -131,7 +131,7 @@ struct Fixed : HBINT32
* 1904. The value is represented as a signed 64-bit integer. */
struct LONGDATETIME
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -148,8 +148,8 @@ struct LONGDATETIME
struct Tag : HBUINT32
{
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
inline operator const char* (void) const { return reinterpret_cast<const char *> (&this->v); }
inline operator char* (void) { return reinterpret_cast<char *> (&this->v); }
operator const char* (void) const { return reinterpret_cast<const char *> (&this->v); }
operator char* (void) { return reinterpret_cast<char *> (&this->v); }
public:
DEFINE_SIZE_STATIC (4);
};
@ -171,9 +171,9 @@ struct Offset : Type
{
typedef Type type;
inline bool is_null (void) const { return has_null && 0 == *this; }
bool is_null (void) const { return has_null && 0 == *this; }
inline void *serialize (hb_serialize_context_t *c, const void *base)
void *serialize (hb_serialize_context_t *c, const void *base)
{
void *t = c->start_embed<void> ();
this->set ((char *) t - (char *) base); /* TODO(serialize) Overflow? */
@ -192,7 +192,7 @@ typedef Offset<HBUINT32> Offset32;
struct CheckSum : HBUINT32
{
/* This is reference implementation from the spec. */
static inline uint32_t CalcTableChecksum (const HBUINT32 *Table, uint32_t Length)
static uint32_t CalcTableChecksum (const HBUINT32 *Table, uint32_t Length)
{
uint32_t Sum = 0L;
assert (0 == (Length & 3));
@ -204,7 +204,7 @@ struct CheckSum : HBUINT32
}
/* Note: data should be 4byte aligned and have 4byte padding at the end. */
inline void set_for_data (const void *data, unsigned int length)
void set_for_data (const void *data, unsigned int length)
{ set (CalcTableChecksum ((const HBUINT32 *) data, length)); }
public:
@ -219,9 +219,9 @@ struct CheckSum : HBUINT32
template <typename FixedType=HBUINT16>
struct FixedVersion
{
inline uint32_t to_int (void) const { return (major << (sizeof (FixedType) * 8)) + minor; }
uint32_t to_int (void) const { return (major << (sizeof (FixedType) * 8)) + minor; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -242,37 +242,37 @@ struct FixedVersion
template <typename Type, bool has_null>
struct _hb_has_null
{
static inline const Type *get_null (void) { return nullptr; }
static inline Type *get_crap (void) { return nullptr; }
static const Type *get_null (void) { return nullptr; }
static Type *get_crap (void) { return nullptr; }
};
template <typename Type>
struct _hb_has_null<Type, true>
{
static inline const Type *get_null (void) { return &Null(Type); }
static inline Type *get_crap (void) { return &Crap(Type); }
static const Type *get_null (void) { return &Null(Type); }
static Type *get_crap (void) { return &Crap(Type); }
};
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true>
struct OffsetTo : Offset<OffsetType, has_null>
{
inline const Type& operator () (const void *base) const
const Type& operator () (const void *base) const
{
if (unlikely (this->is_null ())) return *_hb_has_null<Type, has_null>::get_null ();
return StructAtOffset<const Type> (base, *this);
}
inline Type& operator () (void *base) const
Type& operator () (void *base) const
{
if (unlikely (this->is_null ())) return *_hb_has_null<Type, has_null>::get_crap ();
return StructAtOffset<Type> (base, *this);
}
inline Type& serialize (hb_serialize_context_t *c, const void *base)
Type& serialize (hb_serialize_context_t *c, const void *base)
{
return * (Type *) Offset<OffsetType>::serialize (c, base);
}
template <typename T>
inline void serialize_subset (hb_subset_context_t *c, const T &src, const void *base)
void serialize_subset (hb_subset_context_t *c, const T &src, const void *base)
{
if (&src == &Null (T))
{
@ -284,7 +284,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
this->set (0);
}
inline bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const
bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this))) return_trace (false);
@ -293,7 +293,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (sanitize_shallow (c, base) &&
@ -302,7 +302,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
neuter (c)));
}
template <typename T1>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1) const
bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1) const
{
TRACE_SANITIZE (this);
return_trace (sanitize_shallow (c, base) &&
@ -311,7 +311,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
neuter (c)));
}
template <typename T1, typename T2>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1, T2 d2) const
bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1, T2 d2) const
{
TRACE_SANITIZE (this);
return_trace (sanitize_shallow (c, base) &&
@ -320,7 +320,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
neuter (c)));
}
template <typename T1, typename T2, typename T3>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1, T2 d2, T3 d3) const
bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1, T2 d2, T3 d3) const
{
TRACE_SANITIZE (this);
return_trace (sanitize_shallow (c, base) &&
@ -330,7 +330,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
}
/* Set the offset to Null */
inline bool neuter (hb_sanitize_context_t *c) const
bool neuter (hb_sanitize_context_t *c) const
{
if (!has_null) return false;
return c->try_set (this, 0);
@ -358,14 +358,14 @@ struct UnsizedArrayOf
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
const Type *p = &arrayZ[i];
if (unlikely (p < arrayZ)) return Null (Type); /* Overflowed. */
return *p;
}
inline Type& operator [] (int i_)
Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
Type *p = &arrayZ[i];
@ -373,29 +373,29 @@ struct UnsizedArrayOf
return *p;
}
inline unsigned int get_size (unsigned int len) const
unsigned int get_size (unsigned int len) const
{ return len * Type::static_size; }
template <typename T> inline operator T * (void) { return arrayZ; }
template <typename T> inline operator const T * (void) const { return arrayZ; }
inline hb_array_t<Type> as_array (unsigned int len)
template <typename T> operator T * (void) { return arrayZ; }
template <typename T> operator const T * (void) const { return arrayZ; }
hb_array_t<Type> as_array (unsigned int len)
{ return hb_array (arrayZ, len); }
inline hb_array_t<const Type> as_array (unsigned int len) const
hb_array_t<const Type> as_array (unsigned int len) const
{ return hb_array (arrayZ, len); }
inline operator hb_array_t<Type> (void) { return as_array (); }
inline operator hb_array_t<const Type> (void) const { as_array (); }
operator hb_array_t<Type> (void) { return as_array (); }
operator hb_array_t<const Type> (void) const { as_array (); }
template <typename T>
inline Type &lsearch (unsigned int len, const T &x, Type &not_found = Crap (Type))
Type &lsearch (unsigned int len, const T &x, Type &not_found = Crap (Type))
{ return *as_array (len).lsearch (x, &not_found); }
template <typename T>
inline const Type &lsearch (unsigned int len, const T &x, const Type &not_found = Null (Type)) const
const Type &lsearch (unsigned int len, const T &x, const Type &not_found = Null (Type)) const
{ return *as_array (len).lsearch (x, &not_found); }
inline void qsort (unsigned int len, unsigned int start = 0, unsigned int end = (unsigned int) -1)
void qsort (unsigned int len, unsigned int start = 0, unsigned int end = (unsigned int) -1)
{ as_array (len).qsort (start, end); }
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c, count))) return_trace (false);
@ -411,7 +411,7 @@ struct UnsizedArrayOf
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c, count))) return_trace (false);
@ -421,7 +421,7 @@ struct UnsizedArrayOf
return_trace (true);
}
template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base, T user_data) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base, T user_data) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c, count))) return_trace (false);
@ -431,7 +431,7 @@ struct UnsizedArrayOf
return_trace (true);
}
inline bool sanitize_shallow (hb_sanitize_context_t *c, unsigned int count) const
bool sanitize_shallow (hb_sanitize_context_t *c, unsigned int count) const
{
TRACE_SANITIZE (this);
return_trace (c->check_array (arrayZ, count));
@ -451,14 +451,14 @@ struct UnsizedOffsetArrayOf : UnsizedArrayOf<OffsetTo<Type, OffsetType, has_null
template <typename Type, typename OffsetType, bool has_null=true>
struct UnsizedOffsetListOf : UnsizedOffsetArrayOf<Type, OffsetType, has_null>
{
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
const OffsetTo<Type, OffsetType, has_null> *p = &this->arrayZ[i];
if (unlikely (p < this->arrayZ)) return Null (Type); /* Overflowed. */
return this+*p;
}
inline Type& operator [] (int i_)
Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
const OffsetTo<Type, OffsetType, has_null> *p = &this->arrayZ[i];
@ -467,13 +467,13 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf<Type, OffsetType, has_null>
}
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
{
TRACE_SANITIZE (this);
return_trace ((UnsizedOffsetArrayOf<Type, OffsetType, has_null>::sanitize (c, count, this)));
}
template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count, T user_data) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count, T user_data) const
{
TRACE_SANITIZE (this);
return_trace ((UnsizedOffsetArrayOf<Type, OffsetType, has_null>::sanitize (c, count, this, user_data)));
@ -484,21 +484,21 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf<Type, OffsetType, has_null>
template <typename Type>
struct SortedUnsizedArrayOf : UnsizedArrayOf<Type>
{
inline hb_sorted_array_t<Type> as_array (unsigned int len)
hb_sorted_array_t<Type> as_array (unsigned int len)
{ return hb_sorted_array (this->arrayZ, len); }
inline hb_sorted_array_t<const Type> as_array (unsigned int len) const
hb_sorted_array_t<const Type> as_array (unsigned int len) const
{ return hb_sorted_array (this->arrayZ, len); }
inline operator hb_sorted_array_t<Type> (void) { return as_array (); }
inline operator hb_sorted_array_t<const Type> (void) const { as_array (); }
operator hb_sorted_array_t<Type> (void) { return as_array (); }
operator hb_sorted_array_t<const Type> (void) const { as_array (); }
template <typename T>
inline Type &bsearch (unsigned int len, const T &x, Type &not_found = Crap (Type))
Type &bsearch (unsigned int len, const T &x, Type &not_found = Crap (Type))
{ return *as_array (len).bsearch (x, &not_found); }
template <typename T>
inline const Type &bsearch (unsigned int len, const T &x, const Type &not_found = Null (Type)) const
const Type &bsearch (unsigned int len, const T &x, const Type &not_found = Null (Type)) const
{ return *as_array (len).bsearch (x, &not_found); }
template <typename T>
inline bool bfind (unsigned int len, const T &x, unsigned int *i = nullptr,
bool bfind (unsigned int len, const T &x, unsigned int *i = nullptr,
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{ return as_array (len).bfind (x, i, not_found, to_store); }
@ -515,40 +515,39 @@ struct ArrayOf
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= len)) return Null (Type);
return arrayZ[i];
}
inline Type& operator [] (int i_)
Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= len)) return Crap (Type);
return arrayZ[i];
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return len.static_size + len * Type::static_size; }
inline hb_array_t<Type> as_array (void)
hb_array_t<Type> as_array (void)
{ return hb_array (arrayZ, len); }
inline hb_array_t<const Type> as_array (void) const
hb_array_t<const Type> as_array (void) const
{ return hb_array (arrayZ, len); }
inline operator hb_array_t<Type> (void) { return as_array (); }
inline operator hb_array_t<const Type> (void) const { as_array (); }
operator hb_array_t<Type> (void) { return as_array (); }
operator hb_array_t<const Type> (void) const { as_array (); }
inline hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const
hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count)
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count)
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
{ return as_array ().sub_array (start_offset, count);}
inline bool serialize (hb_serialize_context_t *c,
unsigned int items_len)
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -556,9 +555,9 @@ struct ArrayOf
if (unlikely (!c->extend (*this))) return_trace (false);
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<Type> &items,
unsigned int items_len)
bool serialize (hb_serialize_context_t *c,
Supplier<Type> &items,
unsigned int items_len)
{
TRACE_SERIALIZE (this);
if (unlikely (!serialize (c, items_len))) return_trace (false);
@ -568,7 +567,7 @@ struct ArrayOf
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -584,7 +583,7 @@ struct ArrayOf
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -595,7 +594,7 @@ struct ArrayOf
return_trace (true);
}
template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -607,16 +606,16 @@ struct ArrayOf
}
template <typename T>
inline Type &lsearch (const T &x, Type &not_found = Crap (Type))
Type &lsearch (const T &x, Type &not_found = Crap (Type))
{ return *as_array ().lsearch (x, &not_found); }
template <typename T>
inline const Type &lsearch (const T &x, const Type &not_found = Null (Type)) const
const Type &lsearch (const T &x, const Type &not_found = Null (Type)) const
{ return *as_array ().lsearch (x, &not_found); }
inline void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1)
void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1)
{ as_array ().qsort (start, end); }
inline bool sanitize_shallow (hb_sanitize_context_t *c) const
bool sanitize_shallow (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (len.sanitize (c) && c->check_array (arrayZ, len));
@ -643,20 +642,20 @@ struct LOffsetLArrayOf : ArrayOf<OffsetTo<Type, HBUINT32>, HBUINT32> {};
template <typename Type>
struct OffsetListOf : OffsetArrayOf<Type>
{
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= this->len)) return Null (Type);
return this+this->arrayZ[i];
}
inline const Type& operator [] (int i_)
const Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= this->len)) return Crap (Type);
return this+this->arrayZ[i];
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
struct OffsetListOf<Type> *out = c->serializer->embed (*this);
@ -667,13 +666,13 @@ struct OffsetListOf : OffsetArrayOf<Type>
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (OffsetArrayOf<Type>::sanitize (c, this));
}
template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, T user_data) const
bool sanitize (hb_sanitize_context_t *c, T user_data) const
{
TRACE_SANITIZE (this);
return_trace (OffsetArrayOf<Type>::sanitize (c, this, user_data));
@ -688,24 +687,24 @@ struct HeadlessArrayOf
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (HeadlessArrayOf, Type, LenType);
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= lenP1 || !i)) return Null (Type);
return arrayZ[i-1];
}
inline Type& operator [] (int i_)
Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= lenP1 || !i)) return Crap (Type);
return arrayZ[i-1];
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return lenP1.static_size + (lenP1 ? lenP1 - 1 : 0) * Type::static_size; }
inline bool serialize (hb_serialize_context_t *c,
Supplier<Type> &items,
unsigned int items_len)
bool serialize (hb_serialize_context_t *c,
Supplier<Type> &items,
unsigned int items_len)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -718,7 +717,7 @@ struct HeadlessArrayOf
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -736,7 +735,7 @@ struct HeadlessArrayOf
}
private:
inline bool sanitize_shallow (hb_sanitize_context_t *c) const
bool sanitize_shallow (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (lenP1.sanitize (c) &&
@ -756,23 +755,23 @@ struct ArrayOfM1
{
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOfM1, Type, LenType);
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
if (unlikely (i > lenM1)) return Null (Type);
return arrayZ[i];
}
inline Type& operator [] (int i_)
Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
if (unlikely (i > lenM1)) return Crap (Type);
return arrayZ[i];
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return lenM1.static_size + (lenM1 + 1) * Type::static_size; }
template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -784,7 +783,7 @@ struct ArrayOfM1
}
private:
inline bool sanitize_shallow (hb_sanitize_context_t *c) const
bool sanitize_shallow (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (lenM1.sanitize (c) &&
@ -802,30 +801,30 @@ struct ArrayOfM1
template <typename Type, typename LenType=HBUINT16>
struct SortedArrayOf : ArrayOf<Type, LenType>
{
inline hb_sorted_array_t<Type> as_array (void)
hb_sorted_array_t<Type> as_array (void)
{ return hb_sorted_array (this->arrayZ, this->len); }
inline hb_sorted_array_t<const Type> as_array (void) const
hb_sorted_array_t<const Type> as_array (void) const
{ return hb_sorted_array (this->arrayZ, this->len); }
inline operator hb_sorted_array_t<Type> (void) { return as_array (); }
inline operator hb_sorted_array_t<const Type> (void) const { as_array (); }
operator hb_sorted_array_t<Type> (void) { return as_array (); }
operator hb_sorted_array_t<const Type> (void) const { as_array (); }
inline hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const
hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count)
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count)
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
{ return as_array ().sub_array (start_offset, count);}
template <typename T>
inline Type &bsearch (const T &x, Type &not_found = Crap (Type))
Type &bsearch (const T &x, Type &not_found = Crap (Type))
{ return *as_array ().bsearch (x, &not_found); }
template <typename T>
inline const Type &bsearch (const T &x, const Type &not_found = Null (Type)) const
const Type &bsearch (const T &x, const Type &not_found = Null (Type)) const
{ return *as_array ().bsearch (x, &not_found); }
template <typename T>
inline bool bfind (const T &x, unsigned int *i = nullptr,
bool bfind (const T &x, unsigned int *i = nullptr,
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{ return as_array ().bfind (x, i, not_found, to_store); }
@ -838,15 +837,15 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
template <typename LenType=HBUINT16>
struct BinSearchHeader
{
inline operator uint32_t (void) const { return len; }
operator uint32_t (void) const { return len; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
}
inline void set (unsigned int v)
void set (unsigned int v)
{
len.set (v);
assert (len == v);
@ -874,7 +873,7 @@ struct BinSearchArrayOf : SortedArrayOf<Type, BinSearchHeader<LenType> > {};
struct VarSizedBinSearchHeader
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -900,7 +899,7 @@ struct VarSizedBinSearchArrayOf
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type);
inline bool last_is_terminator (void) const
bool last_is_terminator (void) const
{
if (unlikely (!header.nUnits)) return false;
@ -916,26 +915,26 @@ struct VarSizedBinSearchArrayOf
return true;
}
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= get_length ())) return Null (Type);
return StructAtOffset<Type> (&bytesZ, i * header.unitSize);
}
inline Type& operator [] (int i_)
Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= get_length ())) return Crap (Type);
return StructAtOffset<Type> (&bytesZ, i * header.unitSize);
}
inline unsigned int get_length (void) const
unsigned int get_length (void) const
{
return header.nUnits - last_is_terminator ();
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return header.static_size + header.nUnits * header.unitSize; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -951,7 +950,7 @@ struct VarSizedBinSearchArrayOf
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -962,7 +961,7 @@ struct VarSizedBinSearchArrayOf
return_trace (true);
}
template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
@ -974,7 +973,7 @@ struct VarSizedBinSearchArrayOf
}
template <typename T>
inline const Type *bsearch (const T &key) const
const Type *bsearch (const T &key) const
{
unsigned int size = header.unitSize;
int min = 0, max = (int) get_length () - 1;
@ -991,7 +990,7 @@ struct VarSizedBinSearchArrayOf
}
private:
inline bool sanitize_shallow (hb_sanitize_context_t *c) const
bool sanitize_shallow (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (header.sanitize (c) &&

View File

@ -64,12 +64,9 @@ struct code_pair
typedef hb_vector_t<char, 1> StrBuff;
struct StrBuffArray : hb_vector_t<StrBuff>
{
inline void fini (void)
{
SUPER::fini_deep ();
}
void fini (void) { SUPER::fini_deep (); }
inline unsigned int total_size (void) const
unsigned int total_size (void) const
{
unsigned int size = 0;
for (unsigned int i = 0; i < len; i++)
@ -85,7 +82,7 @@ struct StrBuffArray : hb_vector_t<StrBuff>
template <typename COUNT>
struct CFFIndex
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely ((count.sanitize (c) && count == 0) || /* empty INDEX */
@ -94,13 +91,13 @@ struct CFFIndex
c->check_array ((const HBUINT8*)data_base (), 1, max_offset () - 1))));
}
inline static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count)
static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count)
{ return offSize * (count + 1); }
inline unsigned int offset_array_size (void) const
unsigned int offset_array_size (void) const
{ return calculate_offset_array_size (offSize, count); }
inline static unsigned int calculate_serialized_size (unsigned int offSize, unsigned int count, unsigned int dataSize)
static unsigned int calculate_serialized_size (unsigned int offSize, unsigned int count, unsigned int dataSize)
{
if (count == 0)
return COUNT::static_size;
@ -108,7 +105,7 @@ struct CFFIndex
return min_size + calculate_offset_array_size (offSize, count) + dataSize;
}
inline bool serialize (hb_serialize_context_t *c, const CFFIndex &src)
bool serialize (hb_serialize_context_t *c, const CFFIndex &src)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size ();
@ -118,9 +115,9 @@ struct CFFIndex
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const ByteStrArray &byteArray)
bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const ByteStrArray &byteArray)
{
TRACE_SERIALIZE (this);
if (byteArray.len == 0)
@ -160,9 +157,9 @@ struct CFFIndex
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const StrBuffArray &buffArray)
bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const StrBuffArray &buffArray)
{
ByteStrArray byteArray;
byteArray.init ();
@ -176,7 +173,7 @@ struct CFFIndex
return result;
}
inline void set_offset_at (unsigned int index, unsigned int offset)
void set_offset_at (unsigned int index, unsigned int offset)
{
HBUINT8 *p = offsets + offSize * index + offSize;
unsigned int size = offSize;
@ -188,7 +185,7 @@ struct CFFIndex
}
}
inline unsigned int offset_at (unsigned int index) const
unsigned int offset_at (unsigned int index) const
{
assert (index <= count);
const HBUINT8 *p = offsets + offSize * index;
@ -199,7 +196,7 @@ struct CFFIndex
return offset;
}
inline unsigned int length_at (unsigned int index) const
unsigned int length_at (unsigned int index) const
{
if (likely ((offset_at (index + 1) >= offset_at (index)) &&
(offset_at (index + 1) <= offset_at (count))))
@ -208,13 +205,13 @@ struct CFFIndex
return 0;
}
inline const char *data_base (void) const
const char *data_base (void) const
{ return (const char *)this + min_size + offset_array_size (); }
inline unsigned int data_size (void) const
unsigned int data_size (void) const
{ return HBINT8::static_size; }
inline ByteStr operator [] (unsigned int index) const
ByteStr operator [] (unsigned int index) const
{
if (likely (index < count))
return ByteStr (data_base () + offset_at (index) - 1, length_at (index));
@ -222,7 +219,7 @@ struct CFFIndex
return Null(ByteStr);
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{
if (this != &Null(CFFIndex))
{
@ -236,7 +233,7 @@ struct CFFIndex
}
protected:
inline unsigned int max_offset (void) const
unsigned int max_offset (void) const
{
unsigned int max = 0;
for (unsigned int i = 0; i < count + 1u; i++)
@ -259,7 +256,7 @@ struct CFFIndex
template <typename COUNT, typename TYPE>
struct CFFIndexOf : CFFIndex<COUNT>
{
inline const ByteStr operator [] (unsigned int index) const
const ByteStr operator [] (unsigned int index) const
{
if (likely (index < CFFIndex<COUNT>::count))
return ByteStr (CFFIndex<COUNT>::data_base () + CFFIndex<COUNT>::offset_at (index) - 1, CFFIndex<COUNT>::length_at (index));
@ -267,13 +264,13 @@ struct CFFIndexOf : CFFIndex<COUNT>
}
template <typename DATA, typename PARAM1, typename PARAM2>
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const DATA *dataArray,
unsigned int dataArrayLen,
const hb_vector_t<unsigned int> &dataSizeArray,
const PARAM1 &param1,
const PARAM2 &param2)
bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const DATA *dataArray,
unsigned int dataArrayLen,
const hb_vector_t<unsigned int> &dataSizeArray,
const PARAM1 &param1,
const PARAM2 &param2)
{
TRACE_SERIALIZE (this);
/* serialize CFFIndex header */
@ -306,11 +303,11 @@ struct CFFIndexOf : CFFIndex<COUNT>
/* in parallel to above */
template <typename DATA, typename PARAM>
inline static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const DATA *dataArray,
unsigned int dataArrayLen,
hb_vector_t<unsigned int> &dataSizeArray, /* OUT */
const PARAM &param)
static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const DATA *dataArray,
unsigned int dataArrayLen,
hb_vector_t<unsigned int> &dataSizeArray, /* OUT */
const PARAM &param)
{
/* determine offset size */
unsigned int totalDataSize = 0;
@ -330,10 +327,10 @@ struct CFFIndexOf : CFFIndex<COUNT>
struct Dict : UnsizedByteStr
{
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
inline bool serialize (hb_serialize_context_t *c,
const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
bool serialize (hb_serialize_context_t *c,
const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
{
TRACE_SERIALIZE (this);
for (unsigned int i = 0; i < dictval.get_count (); i++)
@ -346,9 +343,9 @@ struct Dict : UnsizedByteStr
/* in parallel to above */
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
inline static unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
static unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
{
unsigned int size = 0;
for (unsigned int i = 0; i < dictval.get_count (); i++)
@ -357,8 +354,8 @@ struct Dict : UnsizedByteStr
}
template <typename DICTVAL, typename OP_SERIALIZER>
inline static unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr)
static unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr)
{
unsigned int size = 0;
for (unsigned int i = 0; i < dictval.get_count (); i++)
@ -367,7 +364,7 @@ struct Dict : UnsizedByteStr
}
template <typename INTTYPE, int minVal, int maxVal>
inline static bool serialize_int_op (hb_serialize_context_t *c, OpCode op, int value, OpCode intOp)
static bool serialize_int_op (hb_serialize_context_t *c, OpCode op, int value, OpCode intOp)
{
// XXX: not sure why but LLVM fails to compile the following 'unlikely' macro invocation
if (/*unlikely*/ (!serialize_int<INTTYPE, minVal, maxVal> (c, intOp, value)))
@ -387,18 +384,18 @@ struct Dict : UnsizedByteStr
return_trace (true);
}
inline static bool serialize_uint4_op (hb_serialize_context_t *c, OpCode op, int value)
static bool serialize_uint4_op (hb_serialize_context_t *c, OpCode op, int value)
{ return serialize_int_op<HBUINT32, 0, 0x7FFFFFFF> (c, op, value, OpCode_longintdict); }
inline static bool serialize_uint2_op (hb_serialize_context_t *c, OpCode op, int value)
static bool serialize_uint2_op (hb_serialize_context_t *c, OpCode op, int value)
{ return serialize_int_op<HBUINT16, 0, 0x7FFF> (c, op, value, OpCode_shortint); }
inline static bool serialize_offset4_op (hb_serialize_context_t *c, OpCode op, int value)
static bool serialize_offset4_op (hb_serialize_context_t *c, OpCode op, int value)
{
return serialize_uint4_op (c, op, value);
}
inline static bool serialize_offset2_op (hb_serialize_context_t *c, OpCode op, int value)
static bool serialize_offset2_op (hb_serialize_context_t *c, OpCode op, int value)
{
return serialize_uint2_op (c, op, value);
}
@ -421,13 +418,11 @@ struct TableInfo
* set to CFF_UNDEF_CODE if excluded from subset */
struct Remap : hb_vector_t<hb_codepoint_t>
{
inline void init (void)
{ SUPER::init (); }
void init (void) { SUPER::init (); }
inline void fini (void)
{ SUPER::fini (); }
void fini (void) { SUPER::fini (); }
inline bool reset (unsigned int size)
bool reset (unsigned int size)
{
if (unlikely (!SUPER::resize (size)))
return false;
@ -437,7 +432,7 @@ struct Remap : hb_vector_t<hb_codepoint_t>
return true;
}
inline bool identity (unsigned int size)
bool identity (unsigned int size)
{
if (unlikely (!SUPER::resize (size)))
return false;
@ -448,20 +443,20 @@ struct Remap : hb_vector_t<hb_codepoint_t>
return true;
}
inline bool excludes (hb_codepoint_t id) const
bool excludes (hb_codepoint_t id) const
{ return (id < len) && ((*this)[id] == CFF_UNDEF_CODE); }
inline bool includes (hb_codepoint_t id) const
bool includes (hb_codepoint_t id) const
{ return !excludes (id); }
inline unsigned int add (unsigned int i)
unsigned int add (unsigned int i)
{
if ((*this)[i] == CFF_UNDEF_CODE)
(*this)[i] = count++;
return (*this)[i];
}
inline hb_codepoint_t get_count (void) const
hb_codepoint_t get_count (void) const
{ return count; }
protected:
@ -476,10 +471,10 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
{
/* used by CFF1 */
template <typename DICTVAL, typename OP_SERIALIZER>
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
OP_SERIALIZER& opszr)
bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
OP_SERIALIZER& opszr)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -510,13 +505,13 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* used by CFF2 */
template <typename DICTVAL, typename OP_SERIALIZER>
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr,
const hb_vector_t<TableInfo> &privateInfos)
bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr,
const hb_vector_t<TableInfo> &privateInfos)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -549,11 +544,11 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* in parallel to above */
template <typename OP_SERIALIZER, typename DICTVAL>
inline static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr)
static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr)
{
unsigned int dictsSize = 0;
for (unsigned int i = 0; i < fontDicts.len; i++)
@ -567,7 +562,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* FDSelect */
struct FDSelect0 {
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this))))
@ -579,12 +574,12 @@ struct FDSelect0 {
return_trace (true);
}
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
return (hb_codepoint_t)fds[glyph];
}
inline unsigned int get_size (unsigned int num_glyphs) const
unsigned int get_size (unsigned int num_glyphs) const
{ return HBUINT8::static_size * num_glyphs; }
HBUINT8 fds[VAR];
@ -594,7 +589,7 @@ struct FDSelect0 {
template <typename GID_TYPE, typename FD_TYPE>
struct FDSelect3_4_Range {
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) && (first < c->get_num_glyphs ()) && (fd < fdcount)));
@ -608,10 +603,10 @@ struct FDSelect3_4_Range {
template <typename GID_TYPE, typename FD_TYPE>
struct FDSelect3_4 {
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return GID_TYPE::static_size * 2 + FDSelect3_4_Range<GID_TYPE, FD_TYPE>::static_size * nRanges; }
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this) && (nRanges > 0) && (ranges[0].first == 0))))
@ -630,7 +625,7 @@ struct FDSelect3_4 {
return_trace (true);
}
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
unsigned int i;
for (i = 1; i < nRanges; i++)
@ -640,8 +635,8 @@ struct FDSelect3_4 {
return (hb_codepoint_t)ranges[i - 1].fd;
}
inline GID_TYPE &sentinel (void) { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
inline const GID_TYPE &sentinel (void) const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
GID_TYPE &sentinel (void) { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
const GID_TYPE &sentinel (void) const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
GID_TYPE nRanges;
FDSelect3_4_Range<GID_TYPE, FD_TYPE> ranges[VAR];
@ -654,7 +649,7 @@ typedef FDSelect3_4<HBUINT16, HBUINT8> FDSelect3;
typedef FDSelect3_4_Range<HBUINT16, HBUINT8> FDSelect3_Range;
struct FDSelect {
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
@ -664,7 +659,7 @@ struct FDSelect {
u.format3.sanitize (c, fdcount)));
}
inline bool serialize (hb_serialize_context_t *c, const FDSelect &src, unsigned int num_glyphs)
bool serialize (hb_serialize_context_t *c, const FDSelect &src, unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size (num_glyphs);
@ -674,10 +669,10 @@ struct FDSelect {
return_trace (true);
}
inline unsigned int calculate_serialized_size (unsigned int num_glyphs) const
unsigned int calculate_serialized_size (unsigned int num_glyphs) const
{ return get_size (num_glyphs); }
inline unsigned int get_size (unsigned int num_glyphs) const
unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = format.static_size;
if (format == 0)
@ -687,7 +682,7 @@ struct FDSelect {
return size;
}
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
if (this == &Null(FDSelect))
return 0;

View File

@ -163,13 +163,13 @@ hb_codepoint_t OT::cff1::lookup_standard_encoding_for_sid (hb_codepoint_t code)
struct Bounds
{
inline void init (void)
void init (void)
{
min.set_int (0x7FFFFFFF, 0x7FFFFFFF);
max.set_int (-0x80000000, -0x80000000);
}
inline void update (const Point &pt)
void update (const Point &pt)
{
if (pt.x < min.x) min.x = pt.x;
if (pt.x > max.x) max.x = pt.x;
@ -177,7 +177,7 @@ struct Bounds
if (pt.y > max.y) max.y = pt.y;
}
inline void merge (const Bounds &b)
void merge (const Bounds &b)
{
if (empty ())
*this = b;
@ -190,7 +190,7 @@ struct Bounds
}
}
inline void offset (const Point &delta)
void offset (const Point &delta)
{
if (!empty ())
{
@ -199,7 +199,7 @@ struct Bounds
}
}
inline bool empty (void) const
bool empty (void) const
{
return (min.x >= max.x) || (min.y >= max.y);
}
@ -210,16 +210,16 @@ struct Bounds
struct ExtentsParam
{
inline void init (const OT::cff1::accelerator_t *_cff)
void init (const OT::cff1::accelerator_t *_cff)
{
path_open = false;
cff = _cff;
bounds.init ();
}
inline void start_path (void) { path_open = true; }
inline void end_path (void) { path_open = false; }
inline bool is_path_open (void) const { return path_open; }
void start_path (void) { path_open = true; }
void end_path (void) { path_open = false; }
bool is_path_open (void) const { return path_open; }
bool path_open;
Bounds bounds;
@ -229,13 +229,13 @@ struct ExtentsParam
struct CFF1PathProcs_Extents : PathProcs<CFF1PathProcs_Extents, CFF1CSInterpEnv, ExtentsParam>
{
static inline void moveto (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt)
static void moveto (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt)
{
param.end_path ();
env.moveto (pt);
}
static inline void line (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt1)
static void line (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt1)
{
if (!param.is_path_open ())
{
@ -246,7 +246,7 @@ struct CFF1PathProcs_Extents : PathProcs<CFF1PathProcs_Extents, CFF1CSInterpEnv,
param.bounds.update (env.get_pt ());
}
static inline void curve (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt1, const Point &pt2, const Point &pt3)
static void curve (CFF1CSInterpEnv &env, ExtentsParam& param, const Point &pt1, const Point &pt2, const Point &pt3)
{
if (!param.is_path_open ())
{
@ -265,7 +265,7 @@ static bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyp
struct CFF1CSOpSet_Extents : CFF1CSOpSet<CFF1CSOpSet_Extents, ExtentsParam, CFF1PathProcs_Extents>
{
static inline void process_seac (CFF1CSInterpEnv &env, ExtentsParam& param)
static void process_seac (CFF1CSInterpEnv &env, ExtentsParam& param)
{
unsigned int n = env.argStack.get_count ();
Point delta;
@ -338,14 +338,14 @@ bool OT::cff1::accelerator_t::get_extents (hb_codepoint_t glyph, hb_glyph_extent
struct GetSeacParam
{
inline void init (const OT::cff1::accelerator_t *_cff)
void init (const OT::cff1::accelerator_t *_cff)
{
cff = _cff;
base = 0;
accent = 0;
}
inline bool has_seac (void) const
bool has_seac (void) const
{ return base && accent; }
const OT::cff1::accelerator_t *cff;
@ -355,7 +355,7 @@ struct GetSeacParam
struct CFF1CSOpSet_Seac : CFF1CSOpSet<CFF1CSOpSet_Seac, GetSeacParam>
{
static inline void process_seac (CFF1CSInterpEnv &env, GetSeacParam& param)
static void process_seac (CFF1CSInterpEnv &env, GetSeacParam& param)
{
unsigned int n = env.argStack.get_count ();
hb_codepoint_t base_char = (hb_codepoint_t)env.argStack[n-2].to_int ();

View File

@ -56,13 +56,13 @@ struct CFF1FDSelect : FDSelect {};
/* Encoding */
struct Encoding0 {
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && codes[nCodes - 1].sanitize (c));
}
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
assert (glyph > 0);
glyph--;
@ -74,7 +74,7 @@ struct Encoding0 {
return CFF_UNDEF_CODE;
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return HBUINT8::static_size * (nCodes + 1); }
HBUINT8 nCodes;
@ -84,7 +84,7 @@ struct Encoding0 {
};
struct Encoding1_Range {
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -97,16 +97,16 @@ struct Encoding1_Range {
};
struct Encoding1 {
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return HBUINT8::static_size + Encoding1_Range::static_size * nRanges; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && ((nRanges == 0) || (ranges[nRanges - 1]).sanitize (c)));
}
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
assert (glyph > 0);
glyph--;
@ -128,7 +128,7 @@ struct Encoding1 {
};
struct SuppEncoding {
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -141,20 +141,20 @@ struct SuppEncoding {
};
struct CFF1SuppEncData {
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && ((nSups == 0) || (supps[nSups - 1]).sanitize (c)));
}
inline void get_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
void get_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
{
for (unsigned int i = 0; i < nSups; i++)
if (sid == supps[i].glyph)
codes.push (supps[i].code);
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return HBUINT8::static_size + SuppEncoding::static_size * nSups; }
HBUINT8 nSups;
@ -164,7 +164,7 @@ struct CFF1SuppEncData {
};
struct Encoding {
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -179,7 +179,7 @@ struct Encoding {
}
/* serialize a fullset Encoding */
inline bool serialize (hb_serialize_context_t *c, const Encoding &src)
bool serialize (hb_serialize_context_t *c, const Encoding &src)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size ();
@ -190,11 +190,11 @@ struct Encoding {
}
/* serialize a subset Encoding */
inline bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int enc_count,
const hb_vector_t<code_pair>& code_ranges,
const hb_vector_t<code_pair>& supp_codes)
bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int enc_count,
const hb_vector_t<code_pair>& code_ranges,
const hb_vector_t<code_pair>& supp_codes)
{
TRACE_SERIALIZE (this);
Encoding *dest = c->extend_min (*this);
@ -243,10 +243,9 @@ struct Encoding {
}
/* parallel to above: calculate the size of a subset Encoding */
static inline unsigned int calculate_serialized_size (
uint8_t format,
unsigned int enc_count,
unsigned int supp_count)
static unsigned int calculate_serialized_size (uint8_t format,
unsigned int enc_count,
unsigned int supp_count)
{
unsigned int size = min_size;
if (format == 0)
@ -258,7 +257,7 @@ struct Encoding {
return size;
}
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{
unsigned int size = min_size;
if (table_format () == 0)
@ -270,7 +269,7 @@ struct Encoding {
return size;
}
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
if (table_format () == 0)
return u.format0.get_code (glyph);
@ -278,10 +277,10 @@ struct Encoding {
return u.format1.get_code (glyph);
}
inline uint8_t table_format (void) const { return (format & 0x7F); }
inline bool has_supplement (void) const { return (format & 0x80) != 0; }
uint8_t table_format (void) const { return (format & 0x7F); }
bool has_supplement (void) const { return (format & 0x80) != 0; }
inline void get_supplement_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
void get_supplement_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
{
codes.resize (0);
if (has_supplement ())
@ -289,7 +288,7 @@ struct Encoding {
}
protected:
inline const CFF1SuppEncData &suppEncData (void) const
const CFF1SuppEncData &suppEncData (void) const
{
if ((format & 0x7F) == 0)
return StructAfter<CFF1SuppEncData> (u.format0.codes[u.format0.nCodes-1]);
@ -311,13 +310,13 @@ struct Encoding {
/* Charset */
struct Charset0 {
inline bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && sids[num_glyphs - 1].sanitize (c));
}
inline hb_codepoint_t get_sid (hb_codepoint_t glyph) const
hb_codepoint_t get_sid (hb_codepoint_t glyph) const
{
if (glyph == 0)
return 0;
@ -325,7 +324,7 @@ struct Charset0 {
return sids[glyph - 1];
}
inline hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
{
if (sid == 0)
return 0;
@ -338,7 +337,7 @@ struct Charset0 {
return 0;
}
inline unsigned int get_size (unsigned int num_glyphs) const
unsigned int get_size (unsigned int num_glyphs) const
{
assert (num_glyphs > 0);
return HBUINT16::static_size * (num_glyphs - 1);
@ -351,7 +350,7 @@ struct Charset0 {
template <typename TYPE>
struct Charset_Range {
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -365,7 +364,7 @@ struct Charset_Range {
template <typename TYPE>
struct Charset1_2 {
inline bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this)))
@ -380,7 +379,7 @@ struct Charset1_2 {
return_trace (true);
}
inline hb_codepoint_t get_sid (hb_codepoint_t glyph) const
hb_codepoint_t get_sid (hb_codepoint_t glyph) const
{
if (glyph == 0) return 0;
glyph--;
@ -394,7 +393,7 @@ struct Charset1_2 {
return 0;
}
inline hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
{
if (sid == 0) return 0;
hb_codepoint_t glyph = 1;
@ -410,7 +409,7 @@ struct Charset1_2 {
return 0;
}
inline unsigned int get_size (unsigned int num_glyphs) const
unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = HBUINT8::static_size;
int glyph = (int)num_glyphs;
@ -437,7 +436,7 @@ typedef Charset_Range<HBUINT8> Charset1_Range;
typedef Charset_Range<HBUINT16> Charset2_Range;
struct Charset {
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -454,7 +453,7 @@ struct Charset {
}
/* serialize a fullset Charset */
inline bool serialize (hb_serialize_context_t *c, const Charset &src, unsigned int num_glyphs)
bool serialize (hb_serialize_context_t *c, const Charset &src, unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size (num_glyphs);
@ -465,10 +464,10 @@ struct Charset {
}
/* serialize a subset Charset */
inline bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int num_glyphs,
const hb_vector_t<code_pair>& sid_ranges)
bool serialize (hb_serialize_context_t *c,
uint8_t format,
unsigned int num_glyphs,
const hb_vector_t<code_pair>& sid_ranges)
{
TRACE_SERIALIZE (this);
Charset *dest = c->extend_min (*this);
@ -514,7 +513,7 @@ struct Charset {
}
/* parallel to above: calculate the size of a subset Charset */
static inline unsigned int calculate_serialized_size (
static unsigned int calculate_serialized_size (
uint8_t format,
unsigned int count)
{
@ -529,7 +528,7 @@ struct Charset {
return size;
}
inline unsigned int get_size (unsigned int num_glyphs) const
unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = min_size;
if (format == 0)
@ -541,7 +540,7 @@ struct Charset {
return size;
}
inline hb_codepoint_t get_sid (hb_codepoint_t glyph) const
hb_codepoint_t get_sid (hb_codepoint_t glyph) const
{
if (format == 0)
return u.format0.get_sid (glyph);
@ -551,7 +550,7 @@ struct Charset {
return u.format2.get_sid (glyph);
}
inline hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
{
if (format == 0)
return u.format0.get_glyph (sid, num_glyphs);
@ -573,7 +572,8 @@ struct Charset {
struct CFF1StringIndex : CFF1Index
{
inline bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings, unsigned int offSize_, const Remap &sidmap)
bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings,
unsigned int offSize_, const Remap &sidmap)
{
TRACE_SERIALIZE (this);
if (unlikely ((strings.count == 0) || (sidmap.get_count () == 0)))
@ -601,7 +601,7 @@ struct CFF1StringIndex : CFF1Index
}
/* in parallel to above */
inline unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const Remap &sidmap) const
unsigned int calculate_serialized_size (unsigned int &offSize /*OUT*/, const Remap &sidmap) const
{
offSize = 0;
if ((count == 0) || (sidmap.get_count () == 0))
@ -619,7 +619,7 @@ struct CFF1StringIndex : CFF1Index
struct CFF1TopDictInterpEnv : NumInterpEnv
{
inline CFF1TopDictInterpEnv (void)
CFF1TopDictInterpEnv (void)
: NumInterpEnv(), prev_offset(0), last_offset(0) {}
unsigned int prev_offset;
@ -645,19 +645,19 @@ struct NameDictValues
ValCount
};
inline void init (void)
void init (void)
{
for (unsigned int i = 0; i < ValCount; i++)
values[i] = CFF_UNDEF_SID;
}
inline unsigned int& operator[] (unsigned int i)
unsigned int& operator[] (unsigned int i)
{ assert (i < ValCount); return values[i]; }
inline unsigned int operator[] (unsigned int i) const
unsigned int operator[] (unsigned int i) const
{ assert (i < ValCount); return values[i]; }
static inline enum NameDictValIndex name_op_to_index (OpCode op)
static enum NameDictValIndex name_op_to_index (OpCode op)
{
switch (op) {
default: // can't happen - just make some compiler happy
@ -692,7 +692,7 @@ struct CFF1TopDictVal : OpStr
struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
{
inline void init (void)
void init (void)
{
TopDictValues<CFF1TopDictVal>::init ();
@ -704,13 +704,9 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
FDSelectOffset = 0;
privateDictInfo.init ();
}
void fini (void) { TopDictValues<CFF1TopDictVal>::fini (); }
inline void fini (void)
{
TopDictValues<CFF1TopDictVal>::fini ();
}
inline bool is_CID (void) const
bool is_CID (void) const
{ return nameSIDs[NameDictValues::registry] != CFF_UNDEF_SID; }
NameDictValues nameSIDs;
@ -726,7 +722,7 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
{
static inline void process_op (OpCode op, CFF1TopDictInterpEnv& env, CFF1TopDictValues& dictval)
static void process_op (OpCode op, CFF1TopDictInterpEnv& env, CFF1TopDictValues& dictval)
{
CFF1TopDictVal val;
val.last_arg_offset = (env.last_offset-1) - dictval.opStart; /* offset to the last argument */
@ -813,14 +809,14 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
struct CFF1FontDictValues : DictValues<OpStr>
{
inline void init (void)
void init (void)
{
DictValues<OpStr>::init ();
privateDictInfo.init ();
fontName = CFF_UNDEF_SID;
}
inline void fini (void)
void fini (void)
{
DictValues<OpStr>::fini ();
}
@ -831,7 +827,7 @@ struct CFF1FontDictValues : DictValues<OpStr>
struct CFF1FontDictOpSet : DictOpSet
{
static inline void process_op (OpCode op, NumInterpEnv& env, CFF1FontDictValues& dictval)
static void process_op (OpCode op, NumInterpEnv& env, CFF1FontDictValues& dictval)
{
switch (op) {
case OpCode_FontName:
@ -863,19 +859,19 @@ struct CFF1FontDictOpSet : DictOpSet
template <typename VAL>
struct CFF1PrivateDictValues_Base : DictValues<VAL>
{
inline void init (void)
void init (void)
{
DictValues<VAL>::init ();
subrsOffset = 0;
localSubrs = &Null(CFF1Subrs);
}
inline void fini (void)
void fini (void)
{
DictValues<VAL>::fini ();
}
inline unsigned int calculate_serialized_size (void) const
unsigned int calculate_serialized_size (void) const
{
unsigned int size = 0;
for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++)
@ -895,7 +891,7 @@ typedef CFF1PrivateDictValues_Base<NumDictVal> CFF1PrivateDictValues;
struct CFF1PrivateDictOpSet : DictOpSet
{
static inline void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues& dictval)
static void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues& dictval)
{
NumDictVal val;
val.init ();
@ -942,7 +938,7 @@ struct CFF1PrivateDictOpSet : DictOpSet
struct CFF1PrivateDictOpSet_Subset : DictOpSet
{
static inline void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues_Subset& dictval)
static void process_op (OpCode op, NumInterpEnv& env, CFF1PrivateDictValues_Subset& dictval)
{
switch (op) {
case OpCode_BlueValues:
@ -999,7 +995,7 @@ struct cff1
{
static const hb_tag_t tableTag = HB_OT_TAG_cff1;
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -1009,7 +1005,7 @@ struct cff1
template <typename PRIVOPSET, typename PRIVDICTVAL>
struct accelerator_templ_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
topDict.init ();
fontDicts.init ();
@ -1136,7 +1132,7 @@ struct cff1
}
}
inline void fini (void)
void fini (void)
{
sc.end_processing ();
topDict.fini ();
@ -1146,12 +1142,12 @@ struct cff1
blob = nullptr;
}
inline bool is_valid (void) const { return blob != nullptr; }
inline bool is_CID (void) const { return topDict.is_CID (); }
bool is_valid (void) const { return blob != nullptr; }
bool is_CID (void) const { return topDict.is_CID (); }
inline bool is_predef_charset (void) const { return topDict.CharsetOffset <= ExpertSubsetCharset; }
bool is_predef_charset (void) const { return topDict.CharsetOffset <= ExpertSubsetCharset; }
inline unsigned int std_code_to_glyph (hb_codepoint_t code) const
unsigned int std_code_to_glyph (hb_codepoint_t code) const
{
hb_codepoint_t sid = lookup_standard_encoding_for_sid (code);
if (unlikely (sid == CFF_UNDEF_SID))
@ -1194,7 +1190,7 @@ struct cff1
struct accelerator_subset_t : accelerator_templ_t<CFF1PrivateDictOpSet_Subset, CFF1PrivateDictValues_Subset>
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
SUPER::init (face);
if (blob == nullptr) return;
@ -1215,9 +1211,9 @@ struct cff1
}
}
inline bool is_predef_encoding (void) const { return topDict.EncodingOffset <= ExpertEncoding; }
bool is_predef_encoding (void) const { return topDict.EncodingOffset <= ExpertEncoding; }
inline hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
{
if (encoding != &Null(Encoding))
return encoding->get_code (glyph);
@ -1241,7 +1237,7 @@ struct cff1
}
}
inline hb_codepoint_t glyph_to_sid (hb_codepoint_t glyph) const
hb_codepoint_t glyph_to_sid (hb_codepoint_t glyph) const
{
if (charset != &Null(Charset))
return charset->get_sid (glyph);
@ -1272,7 +1268,7 @@ struct cff1
typedef accelerator_templ_t<CFF1PrivateDictOpSet_Subset, CFF1PrivateDictValues_Subset> SUPER;
};
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *cff_prime = nullptr;

View File

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

View File

@ -51,7 +51,7 @@ typedef FDSelect3_4_Range<HBUINT32, HBUINT16> FDSelect4_Range;
struct CFF2FDSelect
{
inline bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
@ -63,7 +63,7 @@ struct CFF2FDSelect
u.format4.sanitize (c, fdcount))));
}
inline bool serialize (hb_serialize_context_t *c, const CFF2FDSelect &src, unsigned int num_glyphs)
bool serialize (hb_serialize_context_t *c, const CFF2FDSelect &src, unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
unsigned int size = src.get_size (num_glyphs);
@ -73,10 +73,10 @@ struct CFF2FDSelect
return_trace (true);
}
inline unsigned int calculate_serialized_size (unsigned int num_glyphs) const
unsigned int calculate_serialized_size (unsigned int num_glyphs) const
{ return get_size (num_glyphs); }
inline unsigned int get_size (unsigned int num_glyphs) const
unsigned int get_size (unsigned int num_glyphs) const
{
unsigned int size = format.static_size;
if (format == 0)
@ -88,7 +88,7 @@ struct CFF2FDSelect
return size;
}
inline hb_codepoint_t get_fd (hb_codepoint_t glyph) const
hb_codepoint_t get_fd (hb_codepoint_t glyph) const
{
if (this == &Null(CFF2FDSelect))
return 0;
@ -112,13 +112,13 @@ struct CFF2FDSelect
struct CFF2VariationStore
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)) && c->check_range (&varStore, size) && varStore.sanitize (c));
}
inline bool serialize (hb_serialize_context_t *c, const CFF2VariationStore *varStore)
bool serialize (hb_serialize_context_t *c, const CFF2VariationStore *varStore)
{
TRACE_SERIALIZE (this);
unsigned int size_ = varStore->get_size ();
@ -128,7 +128,7 @@ struct CFF2VariationStore
return_trace (true);
}
inline unsigned int get_size (void) const { return HBUINT16::static_size + size; }
unsigned int get_size (void) const { return HBUINT16::static_size + size; }
HBUINT16 size;
VariationStore varStore;
@ -138,19 +138,15 @@ struct CFF2VariationStore
struct CFF2TopDictValues : TopDictValues<>
{
inline void init (void)
void init (void)
{
TopDictValues<>::init ();
vstoreOffset = 0;
FDSelectOffset = 0;
}
void fini (void) { TopDictValues<>::fini (); }
inline void fini (void)
{
TopDictValues<>::fini ();
}
inline unsigned int calculate_serialized_size (void) const
unsigned int calculate_serialized_size (void) const
{
unsigned int size = 0;
for (unsigned int i = 0; i < get_count (); i++)
@ -176,7 +172,7 @@ struct CFF2TopDictValues : TopDictValues<>
struct CFF2TopDictOpSet : TopDictOpSet<>
{
static inline void process_op (OpCode op, NumInterpEnv& env, CFF2TopDictValues& dictval)
static void process_op (OpCode op, NumInterpEnv& env, CFF2TopDictValues& dictval)
{
switch (op) {
case OpCode_FontMatrix:
@ -213,13 +209,13 @@ struct CFF2TopDictOpSet : TopDictOpSet<>
struct CFF2FontDictValues : DictValues<OpStr>
{
inline void init (void)
void init (void)
{
DictValues<OpStr>::init ();
privateDictInfo.init ();
}
inline void fini (void)
void fini (void)
{
DictValues<OpStr>::fini ();
}
@ -229,7 +225,7 @@ struct CFF2FontDictValues : DictValues<OpStr>
struct CFF2FontDictOpSet : DictOpSet
{
static inline void process_op (OpCode op, NumInterpEnv& env, CFF2FontDictValues& dictval)
static void process_op (OpCode op, NumInterpEnv& env, CFF2FontDictValues& dictval)
{
switch (op) {
case OpCode_Private:
@ -256,7 +252,7 @@ struct CFF2FontDictOpSet : DictOpSet
template <typename VAL>
struct CFF2PrivateDictValues_Base : DictValues<VAL>
{
inline void init (void)
void init (void)
{
DictValues<VAL>::init ();
subrsOffset = 0;
@ -264,12 +260,12 @@ struct CFF2PrivateDictValues_Base : DictValues<VAL>
ivs = 0;
}
inline void fini (void)
void fini (void)
{
DictValues<VAL>::fini ();
}
inline unsigned int calculate_serialized_size (void) const
unsigned int calculate_serialized_size (void) const
{
unsigned int size = 0;
for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++)
@ -290,14 +286,14 @@ typedef CFF2PrivateDictValues_Base<NumDictVal> CFF2PrivateDictValues;
struct CFF2PrivDictInterpEnv : NumInterpEnv
{
inline void init (const ByteStr &str)
void init (const ByteStr &str)
{
NumInterpEnv::init (str);
ivs = 0;
seen_vsindex = false;
}
inline void process_vsindex (void)
void process_vsindex (void)
{
if (likely (!seen_vsindex))
{
@ -306,8 +302,8 @@ struct CFF2PrivDictInterpEnv : NumInterpEnv
seen_vsindex = true;
}
inline unsigned int get_ivs (void) const { return ivs; }
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
unsigned int get_ivs (void) const { return ivs; }
void set_ivs (unsigned int ivs_) { ivs = ivs_; }
protected:
unsigned int ivs;
@ -316,7 +312,7 @@ struct CFF2PrivDictInterpEnv : NumInterpEnv
struct CFF2PrivateDictOpSet : DictOpSet
{
static inline void process_op (OpCode op, CFF2PrivDictInterpEnv& env, CFF2PrivateDictValues& dictval)
static void process_op (OpCode op, CFF2PrivDictInterpEnv& env, CFF2PrivateDictValues& dictval)
{
NumDictVal val;
val.init ();
@ -366,7 +362,7 @@ struct CFF2PrivateDictOpSet : DictOpSet
struct CFF2PrivateDictOpSet_Subset : DictOpSet
{
static inline void process_op (OpCode op, CFF2PrivDictInterpEnv& env, CFF2PrivateDictValues_Subset& dictval)
static void process_op (OpCode op, CFF2PrivDictInterpEnv& env, CFF2PrivateDictValues_Subset& dictval)
{
switch (op) {
case OpCode_BlueValues:
@ -422,7 +418,7 @@ struct cff2
{
static const hb_tag_t tableTag = HB_OT_TAG_cff2;
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -432,7 +428,7 @@ struct cff2
template <typename PRIVOPSET, typename PRIVDICTVAL>
struct accelerator_templ_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
topDict.init ();
fontDicts.init ();
@ -505,7 +501,7 @@ struct cff2
}
}
inline void fini (void)
void fini (void)
{
sc.end_processing ();
fontDicts.fini_deep ();
@ -514,7 +510,7 @@ struct cff2
blob = nullptr;
}
inline bool is_valid (void) const { return blob != nullptr; }
bool is_valid (void) const { return blob != nullptr; }
protected:
hb_blob_t *blob;
@ -544,7 +540,7 @@ struct cff2
typedef accelerator_templ_t<CFF2PrivateDictOpSet_Subset, CFF2PrivateDictValues_Subset> accelerator_subset_t;
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *cff2_prime = nullptr;

View File

@ -41,7 +41,7 @@ namespace OT {
struct CmapSubtableFormat0
{
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
hb_codepoint_t gid = codepoint < 256 ? glyphIdArray[codepoint] : 0;
if (!gid)
@ -49,14 +49,14 @@ struct CmapSubtableFormat0
*glyph = gid;
return true;
}
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
for (unsigned int i = 0; i < 256; i++)
if (glyphIdArray[i])
out->add (i);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -154,7 +154,7 @@ struct CmapSubtableFormat4
return_trace (true);
}
static inline size_t get_sub_table_size (const hb_vector_t<segment_plan> &segments)
static size_t get_sub_table_size (const hb_vector_t<segment_plan> &segments)
{
size_t segment_size = 0;
for (unsigned int i = 0; i < segments.len; i++)
@ -176,8 +176,8 @@ struct CmapSubtableFormat4
+ segment_size;
}
static inline bool create_sub_table_plan (const hb_subset_plan_t *plan,
hb_vector_t<segment_plan> *segments)
static bool create_sub_table_plan (const hb_subset_plan_t *plan,
hb_vector_t<segment_plan> *segments)
{
segment_plan *segment = nullptr;
hb_codepoint_t last_gid = 0;
@ -226,11 +226,11 @@ struct CmapSubtableFormat4
struct accelerator_t
{
inline accelerator_t (void) {}
inline accelerator_t (const CmapSubtableFormat4 *subtable) { init (subtable); }
inline ~accelerator_t (void) { fini (); }
accelerator_t (void) {}
accelerator_t (const CmapSubtableFormat4 *subtable) { init (subtable); }
~accelerator_t (void) { fini (); }
inline void init (const CmapSubtableFormat4 *subtable)
void init (const CmapSubtableFormat4 *subtable)
{
segCount = subtable->segCountX2 / 2;
endCount = subtable->values.arrayZ;
@ -240,9 +240,9 @@ struct CmapSubtableFormat4
glyphIdArray = idRangeOffset + segCount;
glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2;
}
inline void fini (void) {}
void fini (void) {}
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
/* Custom two-array bsearch. */
int min = 0, max = (int) this->segCount - 1;
@ -286,11 +286,11 @@ struct CmapSubtableFormat4
*glyph = gid;
return true;
}
static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph)
static bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph)
{
return ((const accelerator_t *) obj)->get_glyph (codepoint, glyph);
}
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
unsigned int count = this->segCount;
if (count && this->startCount[count - 1] == 0xFFFFu)
@ -327,18 +327,18 @@ struct CmapSubtableFormat4
unsigned int glyphIdArrayLength;
};
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
accelerator_t accel (this);
return accel.get_glyph_func (&accel, codepoint, glyph);
}
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
accelerator_t accel (this);
accel.collect_unicodes (out);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this)))
@ -403,7 +403,7 @@ struct CmapSubtableLongGroup
return 0;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -422,7 +422,7 @@ DECLARE_NULL_NAMESPACE_BYTES (OT, CmapSubtableLongGroup);
template <typename UINT>
struct CmapSubtableTrimmed
{
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
/* Rely on our implicit array bound-checking. */
hb_codepoint_t gid = glyphIdArray[codepoint - startCharCode];
@ -431,7 +431,7 @@ struct CmapSubtableTrimmed
*glyph = gid;
return true;
}
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
hb_codepoint_t start = startCharCode;
unsigned int count = glyphIdArray.len;
@ -440,7 +440,7 @@ struct CmapSubtableTrimmed
out->add (start + i);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && glyphIdArray.sanitize (c));
@ -466,7 +466,7 @@ struct CmapSubtableLongSegmented
{
friend struct cmap;
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
hb_codepoint_t gid = T::group_get_glyph (groups.bsearch (codepoint), codepoint);
if (!gid)
@ -475,7 +475,7 @@ struct CmapSubtableLongSegmented
return true;
}
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
for (unsigned int i = 0; i < this->groups.len; i++) {
out->add_range (this->groups[i].startCharCode,
@ -484,14 +484,14 @@ struct CmapSubtableLongSegmented
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && groups.sanitize (c));
}
inline bool serialize (hb_serialize_context_t *c,
const hb_vector_t<CmapSubtableLongGroup> &group_data)
bool serialize (hb_serialize_context_t *c,
const hb_vector_t<CmapSubtableLongGroup> &group_data)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -513,8 +513,8 @@ struct CmapSubtableLongSegmented
struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
{
static inline hb_codepoint_t group_get_glyph (const CmapSubtableLongGroup &group,
hb_codepoint_t u)
static hb_codepoint_t group_get_glyph (const CmapSubtableLongGroup &group,
hb_codepoint_t u)
{ return likely (group.startCharCode <= group.endCharCode) ?
group.glyphID + (u - group.startCharCode) : 0; }
@ -531,13 +531,13 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
return CmapSubtableLongSegmented<CmapSubtableFormat12>::serialize (c, groups);
}
static inline size_t get_sub_table_size (const hb_vector_t<CmapSubtableLongGroup> &groups)
static size_t get_sub_table_size (const hb_vector_t<CmapSubtableLongGroup> &groups)
{
return 16 + 12 * groups.len;
}
static inline bool create_sub_table_plan (const hb_subset_plan_t *plan,
hb_vector_t<CmapSubtableLongGroup> *groups)
static bool create_sub_table_plan (const hb_subset_plan_t *plan,
hb_vector_t<CmapSubtableLongGroup> *groups)
{
CmapSubtableLongGroup *group = nullptr;
@ -570,9 +570,9 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
}
private:
static inline bool _is_gid_consecutive (CmapSubtableLongGroup *group,
hb_codepoint_t cp,
hb_codepoint_t new_gid)
static bool _is_gid_consecutive (CmapSubtableLongGroup *group,
hb_codepoint_t cp,
hb_codepoint_t new_gid)
{
return (cp - 1 == group->endCharCode) &&
new_gid == group->glyphID + (cp - group->startCharCode);
@ -582,8 +582,8 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
struct CmapSubtableFormat13 : CmapSubtableLongSegmented<CmapSubtableFormat13>
{
static inline hb_codepoint_t group_get_glyph (const CmapSubtableLongGroup &group,
hb_codepoint_t u HB_UNUSED)
static hb_codepoint_t group_get_glyph (const CmapSubtableLongGroup &group,
hb_codepoint_t u HB_UNUSED)
{ return group.glyphID; }
};
@ -596,14 +596,14 @@ typedef enum
struct UnicodeValueRange
{
inline int cmp (const hb_codepoint_t &codepoint) const
int cmp (const hb_codepoint_t &codepoint) const
{
if (codepoint < startUnicodeValue) return -1;
if (codepoint > startUnicodeValue + additionalCount) return +1;
return 0;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -618,7 +618,7 @@ struct UnicodeValueRange
struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
{
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
@ -636,12 +636,12 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
struct UVSMapping
{
inline int cmp (const hb_codepoint_t &codepoint) const
int cmp (const hb_codepoint_t &codepoint) const
{
return unicodeValue.cmp (codepoint);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -655,7 +655,7 @@ struct UVSMapping
struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
{
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
@ -668,9 +668,9 @@ struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
struct VariationSelectorRecord
{
inline glyph_variant_t get_glyph (hb_codepoint_t codepoint,
hb_codepoint_t *glyph,
const void *base) const
glyph_variant_t get_glyph (hb_codepoint_t codepoint,
hb_codepoint_t *glyph,
const void *base) const
{
if ((base+defaultUVS).bfind (codepoint))
return GLYPH_VARIANT_USE_DEFAULT;
@ -683,18 +683,18 @@ struct VariationSelectorRecord
return GLYPH_VARIANT_NOT_FOUND;
}
inline void collect_unicodes (hb_set_t *out, const void *base) const
void collect_unicodes (hb_set_t *out, const void *base) const
{
(base+defaultUVS).collect_unicodes (out);
(base+nonDefaultUVS).collect_unicodes (out);
}
inline int cmp (const hb_codepoint_t &variation_selector) const
int cmp (const hb_codepoint_t &variation_selector) const
{
return varSelector.cmp (variation_selector);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -713,26 +713,26 @@ struct VariationSelectorRecord
struct CmapSubtableFormat14
{
inline glyph_variant_t get_glyph_variant (hb_codepoint_t codepoint,
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph) const
glyph_variant_t get_glyph_variant (hb_codepoint_t codepoint,
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph) const
{
return record.bsearch (variation_selector).get_glyph (codepoint, glyph, this);
}
inline void collect_variation_selectors (hb_set_t *out) const
void collect_variation_selectors (hb_set_t *out) const
{
unsigned int count = record.len;
for (unsigned int i = 0; i < count; i++)
out->add (record.arrayZ[i].varSelector);
}
inline void collect_variation_unicodes (hb_codepoint_t variation_selector,
hb_set_t *out) const
void collect_variation_unicodes (hb_codepoint_t variation_selector,
hb_set_t *out) const
{
record.bsearch (variation_selector).collect_unicodes (out, this);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -753,8 +753,8 @@ struct CmapSubtable
{
/* Note: We intentionally do NOT implement subtable formats 2 and 8. */
inline bool get_glyph (hb_codepoint_t codepoint,
hb_codepoint_t *glyph) const
bool get_glyph (hb_codepoint_t codepoint,
hb_codepoint_t *glyph) const
{
switch (u.format) {
case 0: return u.format0 .get_glyph (codepoint, glyph);
@ -767,7 +767,7 @@ struct CmapSubtable
default: return false;
}
}
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
switch (u.format) {
case 0: u.format0 .collect_unicodes (out); return;
@ -781,7 +781,7 @@ struct CmapSubtable
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
@ -815,7 +815,7 @@ struct CmapSubtable
struct EncodingRecord
{
inline int cmp (const EncodingRecord &other) const
int cmp (const EncodingRecord &other) const
{
int ret;
ret = platformID.cmp (other.platformID);
@ -825,7 +825,7 @@ struct EncodingRecord
return 0;
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -846,7 +846,7 @@ struct cmap
struct subset_plan
{
inline size_t final_size (void) const
size_t final_size (void) const
{
return 4 // header
+ 8 * 3 // 3 EncodingRecord
@ -858,8 +858,8 @@ struct cmap
hb_vector_t<CmapSubtableLongGroup> format12_groups;
};
inline bool _create_plan (const hb_subset_plan_t *plan,
subset_plan *cmap_plan) const
bool _create_plan (const hb_subset_plan_t *plan,
subset_plan *cmap_plan) const
{
if (unlikely (!CmapSubtableFormat4::create_sub_table_plan (plan, &cmap_plan->format4_segments)))
return false;
@ -867,10 +867,10 @@ struct cmap
return CmapSubtableFormat12::create_sub_table_plan (plan, &cmap_plan->format12_groups);
}
inline bool _subset (const hb_subset_plan_t *plan,
const subset_plan &cmap_subset_plan,
size_t dest_sz,
void *dest) const
bool _subset (const hb_subset_plan_t *plan,
const subset_plan &cmap_subset_plan,
size_t dest_sz,
void *dest) const
{
hb_serialize_context_t c (dest, dest_sz);
@ -928,7 +928,7 @@ struct cmap
return true;
}
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
subset_plan cmap_subset_plan;
@ -995,7 +995,7 @@ struct cmap
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
this->table = hb_sanitize_context_t ().reference_table<cmap> (face);
bool symbol;
@ -1031,22 +1031,19 @@ struct cmap
}
}
inline void fini (void)
{
this->table.destroy ();
}
void fini (void) { this->table.destroy (); }
inline bool get_nominal_glyph (hb_codepoint_t unicode,
bool get_nominal_glyph (hb_codepoint_t unicode,
hb_codepoint_t *glyph) const
{
if (unlikely (!this->get_glyph_funcZ)) return false;
return this->get_glyph_funcZ (this->get_glyph_data, unicode, glyph);
}
inline unsigned int get_nominal_glyphs (unsigned int count,
const hb_codepoint_t *first_unicode,
unsigned int unicode_stride,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride) const
unsigned int get_nominal_glyphs (unsigned int count,
const hb_codepoint_t *first_unicode,
unsigned int unicode_stride,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride) const
{
if (unlikely (!this->get_glyph_funcZ)) return 0;
@ -1064,9 +1061,9 @@ struct cmap
return done;
}
inline bool get_variation_glyph (hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph) const
bool get_variation_glyph (hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph) const
{
switch (this->subtable_uvs->get_glyph_variant (unicode,
variation_selector,
@ -1080,16 +1077,16 @@ struct cmap
return get_nominal_glyph (unicode, glyph);
}
inline void collect_unicodes (hb_set_t *out) const
void collect_unicodes (hb_set_t *out) const
{
subtable->collect_unicodes (out);
}
inline void collect_variation_selectors (hb_set_t *out) const
void collect_variation_selectors (hb_set_t *out) const
{
subtable_uvs->collect_variation_selectors (out);
}
inline void collect_variation_unicodes (hb_codepoint_t variation_selector,
hb_set_t *out) const
void collect_variation_unicodes (hb_codepoint_t variation_selector,
hb_set_t *out) const
{
subtable_uvs->collect_variation_unicodes (variation_selector, out);
}
@ -1100,16 +1097,16 @@ struct cmap
hb_codepoint_t *glyph);
template <typename Type>
static inline bool get_glyph_from (const void *obj,
hb_codepoint_t codepoint,
hb_codepoint_t *glyph)
static bool get_glyph_from (const void *obj,
hb_codepoint_t codepoint,
hb_codepoint_t *glyph)
{
const Type *typed_obj = (const Type *) obj;
return typed_obj->get_glyph (codepoint, glyph);
}
template <typename Type>
static inline bool get_glyph_from_symbol (const void *obj,
static bool get_glyph_from_symbol (const void *obj,
hb_codepoint_t codepoint,
hb_codepoint_t *glyph)
{
@ -1144,8 +1141,8 @@ struct cmap
protected:
inline const CmapSubtable *find_subtable (unsigned int platform_id,
unsigned int encoding_id) const
const CmapSubtable *find_subtable (unsigned int platform_id,
unsigned int encoding_id) const
{
EncodingRecord key;
key.platformID.set (platform_id);
@ -1160,7 +1157,7 @@ struct cmap
public:
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -45,13 +45,13 @@ namespace OT {
struct SmallGlyphMetrics
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
}
inline void get_extents (hb_glyph_extents_t *extents) const
void get_extents (hb_glyph_extents_t *extents) const
{
extents->x_bearing = bearingX;
extents->y_bearing = bearingY;
@ -79,7 +79,7 @@ struct BigGlyphMetrics : SmallGlyphMetrics
struct SBitLineMetrics
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -108,7 +108,7 @@ struct SBitLineMetrics
struct IndexSubtableHeader
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -124,7 +124,7 @@ struct IndexSubtableHeader
template <typename OffsetType>
struct IndexSubtableFormat1Or3
{
inline bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const
bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -155,7 +155,7 @@ struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<HBUINT16> {};
struct IndexSubtable
{
inline bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const
bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const
{
TRACE_SANITIZE (this);
if (!u.header.sanitize (c)) return_trace (false);
@ -166,7 +166,7 @@ struct IndexSubtable
}
}
inline bool get_extents (hb_glyph_extents_t *extents HB_UNUSED) const
bool get_extents (hb_glyph_extents_t *extents HB_UNUSED) const
{
switch (u.header.indexFormat) {
case 2: case 5: /* TODO */
@ -201,7 +201,7 @@ struct IndexSubtable
struct IndexSubtableRecord
{
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -209,8 +209,8 @@ struct IndexSubtableRecord
offsetToSubtable.sanitize (c, base, lastGlyphIndex - firstGlyphIndex + 1));
}
inline bool get_extents (hb_glyph_extents_t *extents,
const void *base) const
bool get_extents (hb_glyph_extents_t *extents,
const void *base) const
{
return (base+offsetToSubtable).get_extents (extents);
}
@ -237,7 +237,7 @@ struct IndexSubtableArray
{
friend struct CBDT;
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
{
TRACE_SANITIZE (this);
return_trace (indexSubtablesZ.sanitize (c, count, this));
@ -265,7 +265,7 @@ struct BitmapSizeTable
friend struct CBLC;
friend struct CBDT;
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -334,7 +334,7 @@ struct CBLC
enum { tableTag = HB_OT_TAG_CBLC };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -382,7 +382,7 @@ struct CBDT
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
cblc = hb_sanitize_context_t().reference_table<CBLC> (face);
cbdt = hb_sanitize_context_t().reference_table<CBDT> (face);
@ -390,14 +390,14 @@ struct CBDT
upem = hb_face_get_upem (face);
}
inline void fini (void)
void fini (void)
{
this->cblc.destroy ();
this->cbdt.destroy ();
}
inline bool get_extents (hb_font_t *font, hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
bool get_extents (hb_font_t *font, hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
{
const void *base;
const BitmapSizeTable &strike = this->cblc->choose_strike (font);
@ -452,7 +452,7 @@ struct CBDT
return true;
}
inline hb_blob_t* reference_png (hb_font_t *font,
hb_blob_t* reference_png (hb_font_t *font,
hb_codepoint_t glyph) const
{
const void *base;
@ -505,7 +505,7 @@ struct CBDT
return hb_blob_get_empty ();
}
inline bool has_data (void) const { return cbdt.get_length (); }
bool has_data (void) const { return cbdt.get_length (); }
private:
hb_blob_ptr_t<CBLC> cblc;
@ -514,7 +514,7 @@ struct CBDT
unsigned int upem;
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -39,7 +39,7 @@ namespace OT {
struct LayerRecord
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -63,10 +63,10 @@ struct LayerRecord
struct BaseGlyphRecord
{
inline int cmp (hb_codepoint_t g) const
int cmp (hb_codepoint_t g) const
{ return g < glyphId ? -1 : g > glyphId ? 1 : 0; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -89,12 +89,12 @@ struct COLR
{
enum { tableTag = HB_OT_TAG_COLR };
inline bool has_data (void) const { return numBaseGlyphs; }
bool has_data (void) const { return numBaseGlyphs; }
inline unsigned int get_glyph_layers (hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *count, /* IN/OUT. May be NULL. */
hb_ot_color_layer_t *layers /* OUT. May be NULL. */) const
unsigned int get_glyph_layers (hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *count, /* IN/OUT. May be NULL. */
hb_ot_color_layer_t *layers /* OUT. May be NULL. */) const
{
const BaseGlyphRecord &record = (this+baseGlyphsZ).bsearch (numBaseGlyphs, glyph);
@ -114,7 +114,7 @@ struct COLR
return glyph_layers.len;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -48,39 +48,36 @@ struct CPALV1Tail
friend struct CPAL;
private:
inline hb_ot_color_palette_flags_t
get_palette_flags (const void *base,
unsigned int palette_index,
unsigned int palette_count) const
hb_ot_color_palette_flags_t get_palette_flags (const void *base,
unsigned int palette_index,
unsigned int palette_count) const
{
if (!paletteFlagsZ) return HB_OT_COLOR_PALETTE_FLAG_DEFAULT;
return (hb_ot_color_palette_flags_t) (uint32_t)
(base+paletteFlagsZ).as_array (palette_count)[palette_index];
}
inline hb_ot_name_id_t
get_palette_name_id (const void *base,
unsigned int palette_index,
unsigned int palette_count) const
hb_ot_name_id_t get_palette_name_id (const void *base,
unsigned int palette_index,
unsigned int palette_count) const
{
if (!paletteLabelsZ) return HB_OT_NAME_ID_INVALID;
return (base+paletteLabelsZ).as_array (palette_count)[palette_index];
}
inline hb_ot_name_id_t
get_color_name_id (const void *base,
unsigned int color_index,
unsigned int color_count) const
hb_ot_name_id_t get_color_name_id (const void *base,
unsigned int color_index,
unsigned int color_count) const
{
if (!colorLabelsZ) return HB_OT_NAME_ID_INVALID;
return (base+colorLabelsZ).as_array (color_count)[color_index];
}
public:
inline bool sanitize (hb_sanitize_context_t *c,
const void *base,
unsigned int palette_count,
unsigned int color_count) const
bool sanitize (hb_sanitize_context_t *c,
const void *base,
unsigned int palette_count,
unsigned int color_count) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -112,27 +109,27 @@ struct CPAL
{
enum { tableTag = HB_OT_TAG_CPAL };
inline bool has_data (void) const { return numPalettes; }
bool has_data (void) const { return numPalettes; }
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return min_size + numPalettes * sizeof (colorRecordIndicesZ[0]); }
inline unsigned int get_palette_count (void) const { return numPalettes; }
inline unsigned int get_color_count (void) const { return numColors; }
unsigned int get_palette_count (void) const { return numPalettes; }
unsigned int get_color_count (void) const { return numColors; }
inline hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const
hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const
{ return v1 ().get_palette_flags (this, palette_index, numPalettes); }
inline hb_ot_name_id_t get_palette_name_id (unsigned int palette_index) const
hb_ot_name_id_t get_palette_name_id (unsigned int palette_index) const
{ return v1 ().get_palette_name_id (this, palette_index, numPalettes); }
inline hb_ot_name_id_t get_color_name_id (unsigned int color_index) const
hb_ot_name_id_t get_color_name_id (unsigned int color_index) const
{ return v1 ().get_color_name_id (this, color_index, numColors); }
inline unsigned int get_palette_colors (unsigned int palette_index,
unsigned int start_offset,
unsigned int *color_count, /* IN/OUT. May be NULL. */
hb_color_t *colors /* OUT. May be NULL. */) const
unsigned int get_palette_colors (unsigned int palette_index,
unsigned int start_offset,
unsigned int *color_count, /* IN/OUT. May be NULL. */
hb_color_t *colors /* OUT. May be NULL. */) const
{
if (unlikely (palette_index >= numPalettes))
{
@ -156,14 +153,14 @@ struct CPAL
}
private:
inline const CPALV1Tail& v1 (void) const
const CPALV1Tail& v1 (void) const
{
if (version == 0) return Null(CPALV1Tail);
return StructAfter<CPALV1Tail> (*this);
}
public:
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -62,20 +62,20 @@ struct SBIXGlyph
struct SBIXStrike
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
imageOffsetsZ.sanitize_shallow (c, c->get_num_glyphs () + 1));
}
inline hb_blob_t *get_glyph_blob (unsigned int glyph_id,
hb_blob_t *sbix_blob,
hb_tag_t file_type,
int *x_offset,
int *y_offset,
unsigned int num_glyphs,
unsigned int *strike_ppem) const
hb_blob_t *get_glyph_blob (unsigned int glyph_id,
hb_blob_t *sbix_blob,
hb_tag_t file_type,
int *x_offset,
int *y_offset,
unsigned int num_glyphs,
unsigned int *strike_ppem) const
{
if (unlikely (!ppem)) return hb_blob_get_empty (); /* To get Null() object out of the way. */
@ -132,23 +132,23 @@ struct sbix
{
enum { tableTag = HB_OT_TAG_sbix };
inline bool has_data (void) const { return version; }
bool has_data (void) const { return version; }
inline const SBIXStrike &get_strike (unsigned int i) const { return this+strikes[i]; }
const SBIXStrike &get_strike (unsigned int i) const { return this+strikes[i]; }
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
table = hb_sanitize_context_t().reference_table<sbix> (face);
num_glyphs = face->get_num_glyphs ();
}
inline void fini (void) { table.destroy (); }
void fini (void) { table.destroy (); }
inline bool has_data (void) const { return table->has_data (); }
bool has_data (void) const { return table->has_data (); }
inline bool get_extents (hb_font_t *font,
bool get_extents (hb_font_t *font,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
{
@ -156,11 +156,11 @@ struct sbix
return get_png_extents (font, glyph, extents);
}
inline hb_blob_t *reference_png (hb_font_t *font,
hb_codepoint_t glyph_id,
int *x_offset,
int *y_offset,
unsigned int *available_ppem) const
hb_blob_t *reference_png (hb_font_t *font,
hb_codepoint_t glyph_id,
int *x_offset,
int *y_offset,
unsigned int *available_ppem) const
{
return choose_strike (font).get_glyph_blob (glyph_id, table.get_blob (),
HB_TAG ('p','n','g',' '),
@ -170,7 +170,7 @@ struct sbix
private:
inline const SBIXStrike &choose_strike (hb_font_t *font) const
const SBIXStrike &choose_strike (hb_font_t *font) const
{
unsigned count = table->strikes.len;
if (unlikely (!count))
@ -220,9 +220,9 @@ struct sbix
DEFINE_SIZE_STATIC (29);
};
inline bool get_png_extents (hb_font_t *font,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
bool get_png_extents (hb_font_t *font,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
{
/* Following code is safe to call even without data.
* But faster to short-circuit. */
@ -261,7 +261,7 @@ struct sbix
unsigned int num_glyphs;
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -40,17 +40,17 @@ namespace OT {
struct SVGDocumentIndexEntry
{
inline int cmp (hb_codepoint_t g) const
int cmp (hb_codepoint_t g) const
{ return g < startGlyphID ? -1 : g > endGlyphID ? 1 : 0; }
inline hb_blob_t *reference_blob (hb_blob_t *svg_blob, unsigned int index_offset) const
hb_blob_t *reference_blob (hb_blob_t *svg_blob, unsigned int index_offset) const
{
return hb_blob_create_sub_blob (svg_blob,
index_offset + (unsigned int) svgDoc,
svgDocLength);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -75,31 +75,31 @@ struct SVG
{
enum { tableTag = HB_OT_TAG_SVG };
inline bool has_data (void) const { return svgDocEntries; }
bool has_data (void) const { return svgDocEntries; }
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{ table = hb_sanitize_context_t().reference_table<SVG> (face); }
inline void fini (void) { table.destroy (); }
void fini (void) { table.destroy (); }
inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const
hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const
{
return table->get_glyph_entry (glyph_id).reference_blob (table.get_blob (),
table->svgDocEntries);
}
inline bool has_data (void) const { return table->has_data (); }
bool has_data (void) const { return table->has_data (); }
private:
hb_blob_ptr_t<SVG> table;
};
inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const
const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const
{ return (this+svgDocEntries).bsearch (glyph_id); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -255,7 +255,7 @@ static void free_static_ot_funcs (void);
static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot_font_funcs_lazy_loader_t>
{
static inline hb_font_funcs_t *create (void)
static hb_font_funcs_t *create (void)
{
hb_font_funcs_t *funcs = hb_font_funcs_create ();

View File

@ -41,7 +41,7 @@ namespace OT {
struct GaspRange
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -59,10 +59,10 @@ struct gasp
{
enum { tableTag = HB_OT_TAG_gasp };
inline const GaspRange &get_gasp_range (unsigned int i) const
const GaspRange &get_gasp_range (unsigned int i) const
{ return gaspRanges[i]; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -47,7 +47,7 @@ struct loca
enum { tableTag = HB_OT_TAG_loca };
inline bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
{
TRACE_SANITIZE (this);
return_trace (true);
@ -73,7 +73,7 @@ struct glyf
{
enum { tableTag = HB_OT_TAG_glyf };
inline bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
{
TRACE_SANITIZE (this);
/* We don't check for anything specific here. The users of the
@ -81,7 +81,7 @@ struct glyf
return_trace (true);
}
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *glyf_prime = nullptr;
hb_blob_t *loca_prime = nullptr;
@ -153,7 +153,7 @@ struct glyf
HBUINT16 flags;
GlyphID glyphIndex;
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{
unsigned int size = min_size;
// arg1 and 2 are int16
@ -177,7 +177,7 @@ struct glyf
const char *glyph_end;
const CompositeGlyphHeader *current;
inline bool move_to_next (void)
bool move_to_next (void)
{
if (current->flags & CompositeGlyphHeader::MORE_COMPONENTS)
{
@ -191,7 +191,7 @@ struct glyf
return false;
}
inline bool in_range (const CompositeGlyphHeader *composite) const
bool in_range (const CompositeGlyphHeader *composite) const
{
return (const char *) composite >= glyph_start
&& ((const char *) composite + CompositeGlyphHeader::min_size) <= glyph_end
@ -199,7 +199,7 @@ struct glyf
}
};
static inline bool get_iterator (const char * glyph_data,
static bool get_iterator (const char * glyph_data,
unsigned int length,
CompositeGlyphHeader::Iterator *iterator /* OUT */)
{
@ -228,7 +228,7 @@ struct glyf
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
memset (this, 0, sizeof (accelerator_t));
@ -244,7 +244,7 @@ struct glyf
num_glyphs = MAX (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1;
}
inline void fini (void)
void fini (void)
{
loca_table.destroy ();
glyf_table.destroy ();
@ -255,8 +255,8 @@ struct glyf
* If true is returned a pointer to the composite glyph will be written into
* composite.
*/
inline bool get_composite (hb_codepoint_t glyph,
CompositeGlyphHeader::Iterator *composite /* OUT */) const
bool get_composite (hb_codepoint_t glyph,
CompositeGlyphHeader::Iterator *composite /* OUT */) const
{
if (unlikely (!num_glyphs))
return false;
@ -282,7 +282,7 @@ struct glyf
};
/* based on FontTools _g_l_y_f.py::trim */
inline bool remove_padding (unsigned int start_offset,
bool remove_padding (unsigned int start_offset,
unsigned int *end_offset) const
{
if (*end_offset - start_offset < GlyphHeader::static_size) return true;
@ -354,7 +354,7 @@ struct glyf
return true;
}
inline bool get_offsets (hb_codepoint_t glyph,
bool get_offsets (hb_codepoint_t glyph,
unsigned int *start_offset /* OUT */,
unsigned int *end_offset /* OUT */) const
{
@ -381,10 +381,10 @@ struct glyf
return true;
}
inline bool get_instruction_offsets (unsigned int start_offset,
unsigned int end_offset,
unsigned int *instruction_start /* OUT */,
unsigned int *instruction_end /* OUT */) const
bool get_instruction_offsets (unsigned int start_offset,
unsigned int end_offset,
unsigned int *instruction_start /* OUT */,
unsigned int *instruction_end /* OUT */) const
{
if (end_offset - start_offset < GlyphHeader::static_size)
{
@ -440,8 +440,7 @@ struct glyf
return true;
}
inline bool get_extents (hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
{
unsigned int start_offset, end_offset;
if (!get_offsets (glyph, &start_offset, &end_offset))

View File

@ -47,19 +47,19 @@ struct DeviceRecord
unsigned int sizeDeviceRecord;
hb_subset_plan_t *subset_plan;
inline void init (const DeviceRecord *source_device_record,
unsigned int sizeDeviceRecord,
hb_subset_plan_t *subset_plan)
void init (const DeviceRecord *source_device_record,
unsigned int sizeDeviceRecord,
hb_subset_plan_t *subset_plan)
{
this->source_device_record = source_device_record;
this->sizeDeviceRecord = sizeDeviceRecord;
this->subset_plan = subset_plan;
}
inline unsigned int len (void) const
unsigned int len (void) const
{ return this->subset_plan->glyphs.len; }
inline const HBUINT8* operator [] (unsigned int i) const
const HBUINT8* operator [] (unsigned int i) const
{
if (unlikely (i >= len ())) return nullptr;
hb_codepoint_t gid = this->subset_plan->glyphs [i];
@ -70,12 +70,10 @@ struct DeviceRecord
}
};
static inline unsigned int get_size (unsigned int count)
{
return hb_ceil_to_4 (min_size + count * HBUINT8::static_size);
}
static unsigned int get_size (unsigned int count)
{ return hb_ceil_to_4 (min_size + count * HBUINT8::static_size); }
inline bool serialize (hb_serialize_context_t *c, const SubsetView &subset_view)
bool serialize (hb_serialize_context_t *c, const SubsetView &subset_view)
{
TRACE_SERIALIZE (this);
@ -104,7 +102,7 @@ struct DeviceRecord
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c, unsigned int sizeDeviceRecord) const
bool sanitize (hb_sanitize_context_t *c, unsigned int sizeDeviceRecord) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -123,12 +121,10 @@ struct hdmx
{
enum { tableTag = HB_OT_TAG_hdmx };
inline unsigned int get_size (void) const
{
return min_size + numRecords * sizeDeviceRecord;
}
unsigned int get_size (void) const
{ return min_size + numRecords * sizeDeviceRecord; }
inline const DeviceRecord& operator [] (unsigned int i) const
const DeviceRecord& operator [] (unsigned int i) const
{
/* XXX Null(DeviceRecord) is NOT safe as it's num-glyphs lengthed.
* https://github.com/harfbuzz/harfbuzz/issues/1300 */
@ -136,7 +132,7 @@ struct hdmx
return StructAtOffset<DeviceRecord> (&this->firstDeviceRecord, i * sizeDeviceRecord);
}
inline bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan)
bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan)
{
TRACE_SERIALIZE (this);
@ -158,12 +154,12 @@ struct hdmx
return_trace (true);
}
static inline size_t get_subsetted_size (const hdmx *source_hdmx, hb_subset_plan_t *plan)
static size_t get_subsetted_size (const hdmx *source_hdmx, hb_subset_plan_t *plan)
{
return min_size + source_hdmx->numRecords * DeviceRecord::get_size (plan->glyphs.len);
}
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
size_t dest_size = get_subsetted_size (this, plan);
hdmx *dest = (hdmx *) malloc (dest_size);
@ -194,7 +190,7 @@ struct hdmx
return result;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -47,7 +47,7 @@ struct head
enum { tableTag = HB_OT_TAG_head };
inline unsigned int get_upem (void) const
unsigned int get_upem (void) const
{
unsigned int upem = unitsPerEm;
/* If no valid head table found, assume 1000, which matches typical Type1 usage. */
@ -63,11 +63,11 @@ struct head
CONDENSED = 1u<<5
};
inline bool is_bold (void) const { return macStyle & BOLD; }
inline bool is_italic (void) const { return macStyle & ITALIC; }
inline bool is_condensed (void) const { return macStyle & CONDENSED; }
bool is_bold (void) const { return macStyle & BOLD; }
bool is_italic (void) const { return macStyle & ITALIC; }
bool is_condensed (void) const { return macStyle & CONDENSED; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -45,7 +45,7 @@ namespace OT {
template <typename T>
struct _hea
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && likely (version.major == 1));

View File

@ -56,7 +56,7 @@ struct LongMetric
template <typename T, typename H>
struct hmtxvmtx
{
inline bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
{
TRACE_SANITIZE (this);
/* We don't check for anything specific here. The users of the
@ -65,7 +65,7 @@ struct hmtxvmtx
}
inline bool subset_update_header (hb_subset_plan_t *plan,
bool subset_update_header (hb_subset_plan_t *plan,
unsigned int num_hmetrics) const
{
hb_blob_t *src_blob = hb_sanitize_context_t ().reference_table<H> (plan->source, H::tableTag);
@ -86,7 +86,7 @@ struct hmtxvmtx
return result;
}
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
typename T::accelerator_t _mtx;
_mtx.init (plan->source);
@ -186,7 +186,7 @@ struct hmtxvmtx
{
friend struct hmtxvmtx;
inline void init (hb_face_t *face,
void init (hb_face_t *face,
unsigned int default_advance_ = 0)
{
default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face);
@ -234,14 +234,14 @@ struct hmtxvmtx
var_table = hb_sanitize_context_t().reference_table<HVARVVAR> (face, T::variationsTag);
}
inline void fini (void)
void fini (void)
{
table.destroy ();
var_table.destroy ();
}
/* TODO Add variations version. */
inline unsigned int get_side_bearing (hb_codepoint_t glyph) const
unsigned int get_side_bearing (hb_codepoint_t glyph) const
{
if (glyph < num_advances)
return table->longMetricZ[glyph].sb;
@ -253,7 +253,7 @@ struct hmtxvmtx
return bearings[glyph - num_advances];
}
inline unsigned int get_advance (hb_codepoint_t glyph) const
unsigned int get_advance (hb_codepoint_t glyph) const
{
if (unlikely (glyph >= num_metrics))
{
@ -269,8 +269,8 @@ struct hmtxvmtx
return table->longMetricZ[MIN (glyph, (uint32_t) num_advances - 1)].advance;
}
inline unsigned int get_advance (hb_codepoint_t glyph,
hb_font_t *font) const
unsigned int get_advance (hb_codepoint_t glyph,
hb_font_t *font) const
{
unsigned int advance = get_advance (glyph);
if (likely (glyph < num_metrics))

View File

@ -44,7 +44,7 @@ namespace OT {
template <typename KernSubTableHeader>
struct KernSubTableFormat3
{
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{
hb_array_t<const FWORD> kernValue = kernValueZ.as_array (kernValueCount);
hb_array_t<const HBUINT8> leftClass = StructAfter<const UnsizedArrayOf<HBUINT8> > (kernValue).as_array (glyphCount);
@ -59,7 +59,7 @@ struct KernSubTableFormat3
return kernValue[kernIndex[i]];
}
inline bool apply (AAT::hb_aat_apply_context_t *c) const
bool apply (AAT::hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -75,7 +75,7 @@ struct KernSubTableFormat3
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -109,10 +109,10 @@ struct KernSubTableFormat3
template <typename KernSubTableHeader>
struct KernSubTable
{
inline unsigned int get_size (void) const { return u.header.length; }
inline unsigned int get_type (void) const { return u.header.format; }
unsigned int get_size (void) const { return u.header.length; }
unsigned int get_type (void) const { return u.header.format; }
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{
switch (get_type ()) {
/* This method hooks up to hb_font_t's get_h_kerning. Only support Format0. */
@ -122,7 +122,7 @@ struct KernSubTable
}
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
@ -135,7 +135,7 @@ struct KernSubTable
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!u.header.sanitize (c) ||
@ -163,8 +163,8 @@ struct KernOTSubTableHeader
enum { apple = false };
typedef AAT::ObsoleteTypes Types;
inline unsigned int tuple_count (void) const { return 0; }
inline bool is_horizontal (void) const { return (coverage & Horizontal); }
unsigned int tuple_count (void) const { return 0; }
bool is_horizontal (void) const { return (coverage & Horizontal); }
enum Coverage
{
@ -178,7 +178,7 @@ struct KernOTSubTableHeader
Variation = 0x00u,
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -218,8 +218,8 @@ struct KernAATSubTableHeader
enum { apple = true };
typedef AAT::ObsoleteTypes Types;
inline unsigned int tuple_count (void) const { return 0; }
inline bool is_horizontal (void) const { return !(coverage & Vertical); }
unsigned int tuple_count (void) const { return 0; }
bool is_horizontal (void) const { return !(coverage & Vertical); }
enum Coverage
{
@ -231,7 +231,7 @@ struct KernAATSubTableHeader
Backwards = 0x00u,
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -271,10 +271,10 @@ struct kern
{
enum { tableTag = HB_OT_TAG_kern };
inline bool has_data (void) const { return u.version32; }
inline unsigned int get_type (void) const { return u.major; }
bool has_data (void) const { return u.version32; }
unsigned int get_type (void) const { return u.major; }
inline bool has_state_machine (void) const
bool has_state_machine (void) const
{
switch (get_type ()) {
case 0: return u.ot.has_state_machine ();
@ -283,7 +283,7 @@ struct kern
}
}
inline bool has_cross_stream (void) const
bool has_cross_stream (void) const
{
switch (get_type ()) {
case 0: return u.ot.has_cross_stream ();
@ -292,7 +292,7 @@ struct kern
}
}
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{
switch (get_type ()) {
case 0: return u.ot.get_h_kerning (left, right);
@ -301,11 +301,11 @@ struct kern
}
}
inline bool apply (AAT::hb_aat_apply_context_t *c) const
bool apply (AAT::hb_aat_apply_context_t *c) const
{ return dispatch (c); }
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
@ -316,7 +316,7 @@ struct kern
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.version32.sanitize (c)) return_trace (false);

View File

@ -44,9 +44,9 @@ namespace OT {
struct BaseCoordFormat1
{
inline hb_position_t get_coord (void) const { return coordinate; }
hb_position_t get_coord (void) const { return coordinate; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -61,13 +61,13 @@ struct BaseCoordFormat1
struct BaseCoordFormat2
{
inline hb_position_t get_coord (void) const
hb_position_t get_coord (void) const
{
/* TODO */
return coordinate;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -85,9 +85,9 @@ struct BaseCoordFormat2
struct BaseCoordFormat3
{
inline hb_position_t get_coord (hb_font_t *font,
const VariationStore &var_store,
hb_direction_t direction) const
hb_position_t get_coord (hb_font_t *font,
const VariationStore &var_store,
hb_direction_t direction) const
{
const Device &device = this+deviceTable;
return coordinate + (HB_DIRECTION_IS_VERTICAL (direction) ?
@ -96,7 +96,7 @@ struct BaseCoordFormat3
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -116,9 +116,9 @@ struct BaseCoordFormat3
struct BaseCoord
{
inline hb_position_t get_coord (hb_font_t *font,
const VariationStore &var_store,
hb_direction_t direction) const
hb_position_t get_coord (hb_font_t *font,
const VariationStore &var_store,
hb_direction_t direction) const
{
switch (u.format) {
case 1: return u.format1.get_coord ();
@ -128,7 +128,7 @@ struct BaseCoord
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!u.format.sanitize (c))) return_trace (false);
@ -162,13 +162,13 @@ struct FeatMinMaxRecord
0;
}
inline void get_min_max (const BaseCoord **min, const BaseCoord **max) const
void get_min_max (const BaseCoord **min, const BaseCoord **max) const
{
if (likely (min)) *min = &(this+minCoord);
if (likely (max)) *max = &(this+maxCoord);
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -194,7 +194,7 @@ struct FeatMinMaxRecord
struct MinMax
{
inline void get_min_max (hb_tag_t feature_tag,
void get_min_max (hb_tag_t feature_tag,
const BaseCoord **min,
const BaseCoord **max) const
{
@ -213,7 +213,7 @@ struct MinMax
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -241,13 +241,13 @@ struct MinMax
struct BaseValues
{
inline const BaseCoord &get_base_coord (int baseline_tag_index) const
const BaseCoord &get_base_coord (int baseline_tag_index) const
{
if (baseline_tag_index == -1) baseline_tag_index = defaultIndex;
return this+baseCoords[baseline_tag_index];
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -280,10 +280,10 @@ struct BaseLangSysRecord
0;
}
inline const MinMax &get_min_max (void) const
const MinMax &get_min_max (void) const
{ return this+minMax; }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -301,7 +301,7 @@ struct BaseLangSysRecord
struct BaseScript
{
inline const MinMax &get_min_max (hb_tag_t language_tag) const
const MinMax &get_min_max (hb_tag_t language_tag) const
{
/* TODO Replace hb_bsearch() with .bsearch(). */
const BaseLangSysRecord* record = (const BaseLangSysRecord *)
@ -312,12 +312,12 @@ struct BaseScript
return record ? record->get_min_max () : this+defaultMinMax;
}
inline const BaseCoord &get_base_coord (int baseline_tag_index) const
const BaseCoord &get_base_coord (int baseline_tag_index) const
{ return (this+baseValues).get_base_coord (baseline_tag_index); }
inline bool is_empty (void) const { return !baseValues; }
bool is_empty (void) const { return !baseValues; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -354,10 +354,10 @@ struct BaseScriptRecord
0;
}
inline const BaseScript &get_base_script (const BaseScriptList *list) const
const BaseScript &get_base_script (const BaseScriptList *list) const
{ return list+baseScript; }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -376,7 +376,7 @@ struct BaseScriptRecord
struct BaseScriptList
{
inline const BaseScriptRecord *find_record (hb_tag_t script) const
const BaseScriptRecord *find_record (hb_tag_t script) const
{
/* TODO Replace hb_bsearch() with .bsearch(). */
return (const BaseScriptRecord *) hb_bsearch (&script, baseScriptRecords.arrayZ,
@ -386,7 +386,7 @@ struct BaseScriptList
}
/* TODO: Or client should handle fallback? */
inline const BaseScript &get_base_script (hb_tag_t script) const
const BaseScript &get_base_script (hb_tag_t script) const
{
const BaseScriptRecord *record = find_record (script);
if (!record) record = find_record ((hb_script_t) HB_TAG ('D','F','L','T'));
@ -394,7 +394,7 @@ struct BaseScriptList
return record ? record->get_base_script (this) : Null (BaseScript);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -411,7 +411,7 @@ struct BaseScriptList
struct Axis
{
inline bool get_baseline (hb_ot_layout_baseline_t baseline,
bool get_baseline (hb_ot_layout_baseline_t baseline,
hb_tag_t script_tag,
hb_tag_t language_tag,
const BaseCoord **coord) const
@ -424,11 +424,11 @@ struct Axis
return true;
}
inline bool get_min_max (hb_tag_t script_tag,
hb_tag_t language_tag,
hb_tag_t feature_tag,
const BaseCoord **min_coord,
const BaseCoord **max_coord) const
bool get_min_max (hb_tag_t script_tag,
hb_tag_t language_tag,
hb_tag_t feature_tag,
const BaseCoord **min_coord,
const BaseCoord **max_coord) const
{
const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag);
if (base_script.is_empty ()) return false;
@ -438,7 +438,7 @@ struct Axis
return true;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
@ -466,18 +466,18 @@ struct BASE
{
enum { tableTag = HB_OT_TAG_BASE };
inline const Axis &get_axis (hb_direction_t direction) const
const Axis &get_axis (hb_direction_t direction) const
{ return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; }
inline const VariationStore &get_var_store (void) const
const VariationStore &get_var_store (void) const
{ return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; }
inline bool get_baseline (hb_font_t *font,
hb_ot_layout_baseline_t baseline,
hb_direction_t direction,
hb_tag_t script_tag,
hb_tag_t language_tag,
hb_position_t *base) const
bool get_baseline (hb_font_t *font,
hb_ot_layout_baseline_t baseline,
hb_direction_t direction,
hb_tag_t script_tag,
hb_tag_t language_tag,
hb_position_t *base) const
{
const BaseCoord *base_coord;
if (!get_axis (direction).get_baseline (baseline, script_tag, language_tag, &base_coord))
@ -490,13 +490,13 @@ struct BASE
}
/* TODO: Expose this separately sometime? */
inline bool get_min_max (hb_font_t *font,
hb_direction_t direction,
hb_tag_t script_tag,
hb_tag_t language_tag,
hb_tag_t feature_tag,
hb_position_t *min,
hb_position_t *max)
bool get_min_max (hb_font_t *font,
hb_direction_t direction,
hb_tag_t script_tag,
hb_tag_t language_tag,
hb_tag_t feature_tag,
hb_position_t *min,
hb_position_t *max)
{
const BaseCoord *min_coord, *max_coord;
if (!get_axis (direction).get_min_max (script_tag, language_tag, feature_tag,
@ -509,7 +509,7 @@ struct BASE
return true;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

File diff suppressed because it is too large Load Diff

View File

@ -46,10 +46,10 @@ typedef ArrayOf<HBUINT16> AttachPoint; /* Array of contour point indices--in
struct AttachList
{
inline unsigned int get_attach_points (hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *point_count /* IN/OUT */,
unsigned int *point_array /* OUT */) const
unsigned int get_attach_points (hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *point_count /* IN/OUT */,
unsigned int *point_array /* OUT */) const
{
unsigned int index = (this+coverage).get_coverage (glyph_id);
if (index == NOT_COVERED)
@ -72,7 +72,7 @@ struct AttachList
return points.len;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && attachPoint.sanitize (c, this));
@ -98,12 +98,12 @@ struct CaretValueFormat1
friend struct CaretValue;
private:
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction) const
hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction) const
{
return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate) : font->em_scale_y (coordinate);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -121,14 +121,14 @@ struct CaretValueFormat2
friend struct CaretValue;
private:
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
{
hb_position_t x, y;
font->get_glyph_contour_point_for_origin (glyph_id, caretValuePoint, direction, &x, &y);
return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -145,14 +145,15 @@ struct CaretValueFormat3
{
friend struct CaretValue;
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, const VariationStore &var_store) const
hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction,
const VariationStore &var_store) const
{
return HB_DIRECTION_IS_HORIZONTAL (direction) ?
font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font, var_store) :
font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font, var_store);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && deviceTable.sanitize (c, this));
@ -171,7 +172,7 @@ struct CaretValueFormat3
struct CaretValue
{
inline hb_position_t get_caret_value (hb_font_t *font,
hb_position_t get_caret_value (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
const VariationStore &var_store) const
@ -184,7 +185,7 @@ struct CaretValue
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
@ -209,13 +210,13 @@ struct CaretValue
struct LigGlyph
{
inline unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
const VariationStore &var_store,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
const VariationStore &var_store,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
{
if (caret_count)
{
@ -228,7 +229,7 @@ struct LigGlyph
return carets.len;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (carets.sanitize (c, this));
@ -245,13 +246,13 @@ struct LigGlyph
struct LigCaretList
{
inline unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
const VariationStore &var_store,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
const VariationStore &var_store,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
{
unsigned int index = (this+coverage).get_coverage (glyph_id);
if (index == NOT_COVERED)
@ -264,7 +265,7 @@ struct LigCaretList
return lig_glyph.get_lig_carets (font, direction, glyph_id, var_store, start_offset, caret_count, caret_array);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && ligGlyph.sanitize (c, this));
@ -284,10 +285,10 @@ struct LigCaretList
struct MarkGlyphSetsFormat1
{
inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
{ return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this));
@ -304,7 +305,7 @@ struct MarkGlyphSetsFormat1
struct MarkGlyphSets
{
inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
{
switch (u.format) {
case 1: return u.format1.covers (set_index, glyph_id);
@ -312,7 +313,7 @@ struct MarkGlyphSets
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
@ -350,47 +351,47 @@ struct GDEF
ComponentGlyph = 4
};
inline bool has_data (void) const { return version.to_int (); }
inline bool has_glyph_classes (void) const { return glyphClassDef != 0; }
inline unsigned int get_glyph_class (hb_codepoint_t glyph) const
bool has_data (void) const { return version.to_int (); }
bool has_glyph_classes (void) const { return glyphClassDef != 0; }
unsigned int get_glyph_class (hb_codepoint_t glyph) const
{ return (this+glyphClassDef).get_class (glyph); }
inline void get_glyphs_in_class (unsigned int klass, hb_set_t *glyphs) const
void get_glyphs_in_class (unsigned int klass, hb_set_t *glyphs) const
{ (this+glyphClassDef).add_class (glyphs, klass); }
inline bool has_mark_attachment_types (void) const { return markAttachClassDef != 0; }
inline unsigned int get_mark_attachment_type (hb_codepoint_t glyph) const
bool has_mark_attachment_types (void) const { return markAttachClassDef != 0; }
unsigned int get_mark_attachment_type (hb_codepoint_t glyph) const
{ return (this+markAttachClassDef).get_class (glyph); }
inline bool has_attach_points (void) const { return attachList != 0; }
inline unsigned int get_attach_points (hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *point_count /* IN/OUT */,
unsigned int *point_array /* OUT */) const
bool has_attach_points (void) const { return attachList != 0; }
unsigned int get_attach_points (hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *point_count /* IN/OUT */,
unsigned int *point_array /* OUT */) const
{ return (this+attachList).get_attach_points (glyph_id, start_offset, point_count, point_array); }
inline bool has_lig_carets (void) const { return ligCaretList != 0; }
inline unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
bool has_lig_carets (void) const { return ligCaretList != 0; }
unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
{ return (this+ligCaretList).get_lig_carets (font,
direction, glyph_id, get_var_store(),
start_offset, caret_count, caret_array); }
inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef != 0; }
inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef != 0; }
bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
{ return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef).covers (set_index, glyph_id); }
inline bool has_var_store (void) const { return version.to_int () >= 0x00010003u && varStore != 0; }
inline const VariationStore &get_var_store (void) const
bool has_var_store (void) const { return version.to_int () >= 0x00010003u && varStore != 0; }
const VariationStore &get_var_store (void) const
{ return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); }
/* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
* glyph class and other bits, and high 8-bit the mark attachment type (if any).
* Not to be confused with lookup_props which is very similar. */
inline unsigned int get_glyph_props (hb_codepoint_t glyph) const
unsigned int get_glyph_props (hb_codepoint_t glyph) const
{
unsigned int klass = get_glyph_class (glyph);
@ -413,7 +414,7 @@ struct GDEF
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
this->table = hb_sanitize_context_t().reference_table<GDEF> (face);
if (unlikely (this->table->is_blacklisted (this->table.get_blob (), face)))
@ -423,22 +424,19 @@ struct GDEF
}
}
inline void fini (void)
{
this->table.destroy ();
}
void fini (void) { this->table.destroy (); }
hb_blob_ptr_t<GDEF> table;
};
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{
return min_size +
(version.to_int () >= 0x00010002u ? markGlyphSetsDef.static_size : 0) +
(version.to_int () >= 0x00010003u ? varStore.static_size : 0);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
struct GDEF *out = c->serializer->embed (*this);
@ -458,7 +456,7 @@ struct GDEF
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&

View File

@ -98,9 +98,9 @@ struct ValueFormat : HBUINT16
* PosTable (may be NULL) */
#endif
inline unsigned int get_len (void) const
unsigned int get_len (void) const
{ return hb_popcount ((unsigned int) *this); }
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return get_len () * Value::static_size; }
bool apply_value (hb_ot_apply_context_t *c,
@ -158,7 +158,7 @@ struct ValueFormat : HBUINT16
}
private:
inline bool sanitize_value_devices (hb_sanitize_context_t *c, const void *base, const Value *values) const
bool sanitize_value_devices (hb_sanitize_context_t *c, const void *base, const Value *values) const
{
unsigned int format = *this;
@ -175,15 +175,15 @@ struct ValueFormat : HBUINT16
return true;
}
static inline OffsetTo<Device>& get_device (Value* value)
static OffsetTo<Device>& get_device (Value* value)
{ return *CastP<OffsetTo<Device> > (value); }
static inline const OffsetTo<Device>& get_device (const Value* value, bool *worked=nullptr)
static const OffsetTo<Device>& get_device (const Value* value, bool *worked=nullptr)
{
if (worked) *worked |= *value;
return *CastP<OffsetTo<Device> > (value);
}
static inline const HBINT16& get_short (const Value* value, bool *worked=nullptr)
static const HBINT16& get_short (const Value* value, bool *worked=nullptr)
{
if (worked) *worked |= *value;
return *CastP<HBINT16> (value);
@ -191,18 +191,19 @@ struct ValueFormat : HBUINT16
public:
inline bool has_device (void) const {
bool has_device (void) const
{
unsigned int format = *this;
return (format & devices) != 0;
}
inline bool sanitize_value (hb_sanitize_context_t *c, const void *base, const Value *values) const
bool sanitize_value (hb_sanitize_context_t *c, const void *base, const Value *values) const
{
TRACE_SANITIZE (this);
return_trace (c->check_range (values, get_size ()) && (!has_device () || sanitize_value_devices (c, base, values)));
}
inline bool sanitize_values (hb_sanitize_context_t *c, const void *base, const Value *values, unsigned int count) const
bool sanitize_values (hb_sanitize_context_t *c, const void *base, const Value *values, unsigned int count) const
{
TRACE_SANITIZE (this);
unsigned int len = get_len ();
@ -221,7 +222,7 @@ struct ValueFormat : HBUINT16
}
/* Just sanitize referenced Device tables. Doesn't check the values themselves. */
inline bool sanitize_values_stride_unsafe (hb_sanitize_context_t *c, const void *base, const Value *values, unsigned int count, unsigned int stride) const
bool sanitize_values_stride_unsafe (hb_sanitize_context_t *c, const void *base, const Value *values, unsigned int count, unsigned int stride) const
{
TRACE_SANITIZE (this);
@ -240,15 +241,15 @@ struct ValueFormat : HBUINT16
struct AnchorFormat1
{
inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED,
float *x, float *y) const
void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED,
float *x, float *y) const
{
hb_font_t *font = c->font;
*x = font->em_fscale_x (xCoordinate);
*y = font->em_fscale_y (yCoordinate);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -264,8 +265,8 @@ struct AnchorFormat1
struct AnchorFormat2
{
inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id,
float *x, float *y) const
void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id,
float *x, float *y) const
{
hb_font_t *font = c->font;
unsigned int x_ppem = font->x_ppem;
@ -279,7 +280,7 @@ struct AnchorFormat2
*y = ret && y_ppem ? cy : font->em_fscale_y (yCoordinate);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -296,8 +297,8 @@ struct AnchorFormat2
struct AnchorFormat3
{
inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED,
float *x, float *y) const
void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED,
float *x, float *y) const
{
hb_font_t *font = c->font;
*x = font->em_fscale_x (xCoordinate);
@ -309,7 +310,7 @@ struct AnchorFormat3
*y += (this+yDeviceTable).get_y_delta (font, c->var_store);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && xDeviceTable.sanitize (c, this) && yDeviceTable.sanitize (c, this));
@ -333,8 +334,8 @@ struct AnchorFormat3
struct Anchor
{
inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id,
float *x, float *y) const
void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id,
float *x, float *y) const
{
*x = *y = 0;
switch (u.format) {
@ -345,7 +346,7 @@ struct Anchor
}
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
@ -371,14 +372,16 @@ struct Anchor
struct AnchorMatrix
{
inline const Anchor& get_anchor (unsigned int row, unsigned int col, unsigned int cols, bool *found) const {
const Anchor& get_anchor (unsigned int row, unsigned int col,
unsigned int cols, bool *found) const
{
*found = false;
if (unlikely (row >= rows || col >= cols)) return Null(Anchor);
*found = !matrixZ[row * cols + col].is_null ();
return this+matrixZ[row * cols + col];
}
inline bool sanitize (hb_sanitize_context_t *c, unsigned int cols) const
bool sanitize (hb_sanitize_context_t *c, unsigned int cols) const
{
TRACE_SANITIZE (this);
if (!c->check_struct (this)) return_trace (false);
@ -404,7 +407,7 @@ struct MarkRecord
{
friend struct MarkArray;
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && markAnchor.sanitize (c, base));
@ -421,10 +424,10 @@ struct MarkRecord
struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage order */
{
inline bool apply (hb_ot_apply_context_t *c,
unsigned int mark_index, unsigned int glyph_index,
const AnchorMatrix &anchors, unsigned int class_count,
unsigned int glyph_pos) const
bool apply (hb_ot_apply_context_t *c,
unsigned int mark_index, unsigned int glyph_index,
const AnchorMatrix &anchors, unsigned int class_count,
unsigned int glyph_pos) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -455,7 +458,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (ArrayOf<MarkRecord>::sanitize (c, this));
@ -467,19 +470,19 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
struct SinglePosFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+coverage).intersects (glyphs); }
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -492,14 +495,14 @@ struct SinglePosFormat1
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -523,19 +526,19 @@ struct SinglePosFormat1
struct SinglePosFormat2
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+coverage).intersects (glyphs); }
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -552,14 +555,14 @@ struct SinglePosFormat2
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -584,7 +587,7 @@ struct SinglePosFormat2
struct SinglePos
{
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -622,7 +625,7 @@ struct PairSet
{
friend struct PairPosFormat1;
inline bool intersects (const hb_set_t *glyphs,
bool intersects (const hb_set_t *glyphs,
const ValueFormat *valueFormats) const
{
unsigned int len1 = valueFormats[0].get_len ();
@ -640,7 +643,7 @@ struct PairSet
return false;
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c,
void collect_glyphs (hb_collect_glyphs_context_t *c,
const ValueFormat *valueFormats) const
{
TRACE_COLLECT_GLYPHS (this);
@ -652,7 +655,7 @@ struct PairSet
c->input->add_array (&record->secondGlyph, len, record_size);
}
inline bool apply (hb_ot_apply_context_t *c,
bool apply (hb_ot_apply_context_t *c,
const ValueFormat *valueFormats,
unsigned int pos) const
{
@ -702,7 +705,7 @@ struct PairSet
unsigned int stride; /* 1 + len1 + len2 */
};
inline bool sanitize (hb_sanitize_context_t *c, const sanitize_closure_t *closure) const
bool sanitize (hb_sanitize_context_t *c, const sanitize_closure_t *closure) const
{
TRACE_SANITIZE (this);
if (!(c->check_struct (this)
@ -728,7 +731,7 @@ struct PairSet
struct PairPosFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
unsigned int count = pairSet.len;
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
@ -742,7 +745,7 @@ struct PairPosFormat1
return false;
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
@ -751,10 +754,10 @@ struct PairPosFormat1
(this+pairSet[i]).collect_glyphs (c, valueFormat);
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -768,14 +771,14 @@ struct PairPosFormat1
return_trace ((this+pairSet[index]).apply (c, valueFormat, skippy_iter.idx));
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -814,23 +817,23 @@ struct PairPosFormat1
struct PairPosFormat2
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
return (this+coverage).intersects (glyphs) &&
(this+classDef2).intersects (glyphs);
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
if (unlikely (!(this+classDef2).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -862,14 +865,14 @@ struct PairPosFormat2
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!(c->check_struct (this)
@ -922,7 +925,7 @@ struct PairPosFormat2
struct PairPos
{
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -946,7 +949,7 @@ struct EntryExitRecord
{
friend struct CursivePosFormat1;
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (entryAnchor.sanitize (c, base) && exitAnchor.sanitize (c, base));
@ -970,19 +973,19 @@ reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direc
struct CursivePosFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+coverage).intersects (glyphs); }
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -1083,14 +1086,14 @@ struct CursivePosFormat1
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && entryExitRecord.sanitize (c, this));
@ -1111,7 +1114,7 @@ struct CursivePosFormat1
struct CursivePos
{
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -1136,21 +1139,21 @@ typedef AnchorMatrix BaseArray; /* base-major--
struct MarkBasePosFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+markCoverage).intersects (glyphs) &&
(this+baseCoverage).intersects (glyphs); }
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+markCoverage).add_coverage (c->input))) return;
if (unlikely (!(this+baseCoverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+markCoverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -1190,14 +1193,14 @@ struct MarkBasePosFormat1
return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx));
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -1229,7 +1232,7 @@ struct MarkBasePosFormat1
struct MarkBasePos
{
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -1259,21 +1262,21 @@ typedef OffsetListOf<LigatureAttach> LigatureArray;
struct MarkLigPosFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+markCoverage).intersects (glyphs) &&
(this+ligatureCoverage).intersects (glyphs); }
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+markCoverage).add_coverage (c->input))) return;
if (unlikely (!(this+ligatureCoverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+markCoverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -1316,14 +1319,14 @@ struct MarkLigPosFormat1
return_trace ((this+markArray).apply (c, mark_index, comp_index, lig_attach, classCount, j));
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -1356,7 +1359,7 @@ struct MarkLigPosFormat1
struct MarkLigPos
{
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -1381,21 +1384,21 @@ typedef AnchorMatrix Mark2Array; /* mark2-major--
struct MarkMarkPosFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+mark1Coverage).intersects (glyphs) &&
(this+mark2Coverage).intersects (glyphs); }
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+mark1Coverage).add_coverage (c->input))) return;
if (unlikely (!(this+mark2Coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+mark1Coverage; }
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
@ -1439,14 +1442,14 @@ struct MarkMarkPosFormat1
return_trace ((this+mark1Array).apply (c, mark1_index, mark2_index, this+mark2Array, classCount, j));
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -1480,7 +1483,7 @@ struct MarkMarkPosFormat1
struct MarkMarkPos
{
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -1532,7 +1535,7 @@ struct PosLookupSubTable
};
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
{
TRACE_DISPATCH (this, lookup_type);
switch (lookup_type) {
@ -1570,34 +1573,34 @@ struct PosLookup : Lookup
{
typedef struct PosLookupSubTable SubTable;
inline const SubTable& get_subtable (unsigned int i) const
const SubTable& get_subtable (unsigned int i) const
{ return Lookup::get_subtable<SubTable> (i); }
inline bool is_reverse (void) const
bool is_reverse (void) const
{
return false;
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
return_trace (dispatch (c));
}
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
hb_intersects_context_t c (glyphs);
return dispatch (&c);
}
inline hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const
hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
return_trace (dispatch (c));
}
template <typename set_t>
inline void add_coverage (set_t *glyphs) const
void add_coverage (set_t *glyphs) const
{
hb_add_coverage_context_t<set_t> c (glyphs);
dispatch (&c);
@ -1606,16 +1609,16 @@ struct PosLookup : Lookup
static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index);
template <typename context_t>
static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{ return Lookup::dispatch<SubTable> (c); }
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{ return Lookup::subset<SubTable> (c); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{ return Lookup::sanitize<SubTable> (c); }
};
@ -1628,17 +1631,17 @@ struct GPOS : GSUBGPOS
{
enum { tableTag = HB_OT_TAG_GPOS };
inline const PosLookup& get_lookup (unsigned int i) const
const PosLookup& get_lookup (unsigned int i) const
{ return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer);
static inline void position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer);
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{ return GSUBGPOS::subset<PosLookup> (c); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{ return GSUBGPOS::sanitize<PosLookup> (c); }
HB_INTERNAL bool is_blacklisted (hb_blob_t *blob,

View File

@ -42,10 +42,10 @@ static inline void SingleSubst_serialize (hb_serialize_context_t *c,
struct SingleSubstFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+coverage).intersects (glyphs); }
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
@ -58,7 +58,7 @@ struct SingleSubstFormat1
}
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
@ -71,16 +71,16 @@ struct SingleSubstFormat1
}
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
hb_codepoint_t glyph_id = c->buffer->cur().codepoint;
@ -95,10 +95,10 @@ struct SingleSubstFormat1
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
unsigned int num_glyphs,
int delta)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
unsigned int num_glyphs,
int delta)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -107,7 +107,7 @@ struct SingleSubstFormat1
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
const hb_set_t &glyphset = *c->plan->glyphset;
@ -132,7 +132,7 @@ struct SingleSubstFormat1
return_trace (from.len);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && deltaGlyphID.sanitize (c));
@ -151,10 +151,10 @@ struct SingleSubstFormat1
struct SingleSubstFormat2
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+coverage).intersects (glyphs); }
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = substitute.len;
@ -167,7 +167,7 @@ struct SingleSubstFormat2
}
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
@ -180,16 +180,16 @@ struct SingleSubstFormat2
}
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
@ -202,10 +202,10 @@ struct SingleSubstFormat2
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
unsigned int num_glyphs)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -214,7 +214,7 @@ struct SingleSubstFormat2
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
const hb_set_t &glyphset = *c->plan->glyphset;
@ -238,7 +238,7 @@ struct SingleSubstFormat2
return_trace (from.len);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && substitute.sanitize (c));
@ -258,10 +258,10 @@ struct SingleSubstFormat2
struct SingleSubst
{
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
unsigned int num_glyphs)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
@ -286,7 +286,7 @@ struct SingleSubst
}
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -319,7 +319,7 @@ SingleSubst_serialize (hb_serialize_context_t *c,
struct Sequence
{
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = substitute.len;
@ -327,13 +327,13 @@ struct Sequence
c->out->add (substitute[i]);
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
c->output->add_array (substitute.arrayZ, substitute.len);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
unsigned int count = substitute.len;
@ -365,9 +365,9 @@ struct Sequence
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
unsigned int num_glyphs)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -375,7 +375,7 @@ struct Sequence
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (substitute.sanitize (c));
@ -390,10 +390,10 @@ struct Sequence
struct MultipleSubstFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+coverage).intersects (glyphs); }
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = sequence.len;
@ -406,7 +406,7 @@ struct MultipleSubstFormat1
}
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
@ -415,16 +415,16 @@ struct MultipleSubstFormat1
(this+sequence[i]).collect_glyphs (c);
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -434,11 +434,11 @@ struct MultipleSubstFormat1
return_trace ((this+sequence[index]).apply (c));
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -452,14 +452,14 @@ struct MultipleSubstFormat1
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && sequence.sanitize (c, this));
@ -479,11 +479,11 @@ struct MultipleSubstFormat1
struct MultipleSubst
{
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
@ -496,7 +496,7 @@ struct MultipleSubst
}
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -515,7 +515,7 @@ struct MultipleSubst
struct AlternateSet
{
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = alternates.len;
@ -523,13 +523,13 @@ struct AlternateSet
c->out->add (alternates[i]);
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
c->output->add_array (alternates.arrayZ, alternates.len);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
unsigned int count = alternates.len;
@ -554,9 +554,9 @@ struct AlternateSet
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
unsigned int num_glyphs)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -564,7 +564,7 @@ struct AlternateSet
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (alternates.sanitize (c));
@ -580,10 +580,10 @@ struct AlternateSet
struct AlternateSubstFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{ return (this+coverage).intersects (glyphs); }
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = alternateSet.len;
@ -596,7 +596,7 @@ struct AlternateSubstFormat1
}
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
@ -609,16 +609,16 @@ struct AlternateSubstFormat1
}
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -628,11 +628,11 @@ struct AlternateSubstFormat1
return_trace ((this+alternateSet[index]).apply (c));
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -646,14 +646,14 @@ struct AlternateSubstFormat1
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && alternateSet.sanitize (c, this));
@ -673,11 +673,11 @@ struct AlternateSubstFormat1
struct AlternateSubst
{
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
@ -690,7 +690,7 @@ struct AlternateSubst
}
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -710,7 +710,7 @@ struct AlternateSubst
struct Ligature
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
unsigned int count = component.lenP1;
for (unsigned int i = 1; i < count; i++)
@ -719,7 +719,7 @@ struct Ligature
return true;
}
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = component.lenP1;
@ -729,14 +729,14 @@ struct Ligature
c->out->add (ligGlyph);
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
c->input->add_array (component.arrayZ, component.lenP1 ? component.lenP1 - 1 : 0);
c->output->add (ligGlyph);
}
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
if (c->len != component.lenP1)
@ -749,7 +749,7 @@ struct Ligature
return_trace (true);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
unsigned int count = component.lenP1;
@ -788,10 +788,10 @@ struct Ligature
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
GlyphID ligature,
Supplier<GlyphID> &components, /* Starting from second */
unsigned int num_components /* Including first component */)
bool serialize (hb_serialize_context_t *c,
GlyphID ligature,
Supplier<GlyphID> &components, /* Starting from second */
unsigned int num_components /* Including first component */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -801,7 +801,7 @@ struct Ligature
}
public:
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (ligGlyph.sanitize (c) && component.sanitize (c));
@ -819,7 +819,7 @@ struct Ligature
struct LigatureSet
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
unsigned int num_ligs = ligature.len;
for (unsigned int i = 0; i < num_ligs; i++)
@ -828,7 +828,7 @@ struct LigatureSet
return false;
}
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int num_ligs = ligature.len;
@ -836,7 +836,7 @@ struct LigatureSet
(this+ligature[i]).closure (c);
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
unsigned int num_ligs = ligature.len;
@ -844,7 +844,7 @@ struct LigatureSet
(this+ligature[i]).collect_glyphs (c);
}
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
unsigned int num_ligs = ligature.len;
@ -857,7 +857,7 @@ struct LigatureSet
return_trace (false);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
unsigned int num_ligs = ligature.len;
@ -870,11 +870,11 @@ struct LigatureSet
return_trace (false);
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &ligatures,
Supplier<unsigned int> &component_count_list,
unsigned int num_ligatures,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &ligatures,
Supplier<unsigned int> &component_count_list,
unsigned int num_ligatures,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -889,7 +889,7 @@ struct LigatureSet
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (ligature.sanitize (c, this));
@ -905,7 +905,7 @@ struct LigatureSet
struct LigatureSubstFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
unsigned int count = ligatureSet.len;
for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ())
@ -919,7 +919,7 @@ struct LigatureSubstFormat1
return false;
}
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
unsigned int count = ligatureSet.len;
@ -932,7 +932,7 @@ struct LigatureSubstFormat1
}
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
@ -945,10 +945,10 @@ struct LigatureSubstFormat1
}
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
unsigned int index = (this+coverage).get_coverage (c->glyphs[0]);
@ -958,7 +958,7 @@ struct LigatureSubstFormat1
return_trace (lig_set.would_apply (c));
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -969,13 +969,13 @@ struct LigatureSubstFormat1
return_trace (lig_set.apply (c));
}
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -991,14 +991,14 @@ struct LigatureSubstFormat1
return_trace (true);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && ligatureSet.sanitize (c, this));
@ -1018,13 +1018,13 @@ struct LigatureSubstFormat1
struct LigatureSubst
{
inline bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
bool serialize (hb_serialize_context_t *c,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
@ -1043,7 +1043,7 @@ struct LigatureSubst
}
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -1069,13 +1069,13 @@ struct ExtensionSubst : Extension<ExtensionSubst>
{
typedef struct SubstLookupSubTable SubTable;
inline bool is_reverse (void) const;
bool is_reverse (void) const;
};
struct ReverseChainSingleSubstFormat1
{
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
if (!(this+coverage).intersects (glyphs))
return false;
@ -1097,7 +1097,7 @@ struct ReverseChainSingleSubstFormat1
return true;
}
inline void closure (hb_closure_context_t *c) const
void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
@ -1125,7 +1125,7 @@ struct ReverseChainSingleSubstFormat1
}
}
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
@ -1146,16 +1146,16 @@ struct ReverseChainSingleSubstFormat1
c->output->add_array (substitute.arrayZ, substitute.len);
}
inline const Coverage &get_coverage (void) const
const Coverage &get_coverage (void) const
{ return this+coverage; }
inline bool would_apply (hb_would_apply_context_t *c) const
bool would_apply (hb_would_apply_context_t *c) const
{
TRACE_WOULD_APPLY (this);
return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
if (unlikely (c->nesting_level_left != HB_MAX_NESTING_LEVEL))
@ -1188,14 +1188,14 @@ struct ReverseChainSingleSubstFormat1
return_trace (false);
}
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
// TODO(subset)
return_trace (false);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!(coverage.sanitize (c, this) && backtrack.sanitize (c, this)))
@ -1230,7 +1230,7 @@ struct ReverseChainSingleSubstFormat1
struct ReverseChainSingleSubst
{
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{
TRACE_DISPATCH (this, u.format);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
@ -1270,7 +1270,7 @@ struct SubstLookupSubTable
};
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
{
TRACE_DISPATCH (this, lookup_type);
switch (lookup_type) {
@ -1306,13 +1306,13 @@ struct SubstLookup : Lookup
{
typedef SubstLookupSubTable SubTable;
inline const SubTable& get_subtable (unsigned int i) const
const SubTable& get_subtable (unsigned int i) const
{ return Lookup::get_subtable<SubTable> (i); }
inline static bool lookup_type_is_reverse (unsigned int lookup_type)
static bool lookup_type_is_reverse (unsigned int lookup_type)
{ return lookup_type == SubTable::ReverseChainSingle; }
inline bool is_reverse (void) const
bool is_reverse (void) const
{
unsigned int type = get_type ();
if (unlikely (type == SubTable::Extension))
@ -1320,19 +1320,19 @@ struct SubstLookup : Lookup
return lookup_type_is_reverse (type);
}
inline bool apply (hb_ot_apply_context_t *c) const
bool apply (hb_ot_apply_context_t *c) const
{
TRACE_APPLY (this);
return_trace (dispatch (c));
}
inline bool intersects (const hb_set_t *glyphs) const
bool intersects (const hb_set_t *glyphs) const
{
hb_intersects_context_t c (glyphs);
return dispatch (&c);
}
inline hb_closure_context_t::return_t closure (hb_closure_context_t *c, unsigned int this_index) const
hb_closure_context_t::return_t closure (hb_closure_context_t *c, unsigned int this_index) const
{
TRACE_CLOSURE (this);
if (!c->should_visit_lookup (this_index))
@ -1347,7 +1347,7 @@ struct SubstLookup : Lookup
return_trace (ret);
}
inline hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const
hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
c->set_recurse_func (dispatch_recurse_func<hb_collect_glyphs_context_t>);
@ -1355,14 +1355,14 @@ struct SubstLookup : Lookup
}
template <typename set_t>
inline void add_coverage (set_t *glyphs) const
void add_coverage (set_t *glyphs) const
{
hb_add_coverage_context_t<set_t> c (glyphs);
dispatch (&c);
}
inline bool would_apply (hb_would_apply_context_t *c,
const hb_ot_layout_lookup_accelerator_t *accel) const
bool would_apply (hb_would_apply_context_t *c,
const hb_ot_layout_lookup_accelerator_t *accel) const
{
TRACE_WOULD_APPLY (this);
if (unlikely (!c->len)) return_trace (false);
@ -1372,27 +1372,27 @@ struct SubstLookup : Lookup
static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index);
inline SubTable& serialize_subtable (hb_serialize_context_t *c,
SubTable& serialize_subtable (hb_serialize_context_t *c,
unsigned int i)
{ return get_subtables<SubTable> ()[i].serialize (c, this); }
inline bool serialize_single (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
unsigned int num_glyphs)
bool serialize_single (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<GlyphID> &substitutes,
unsigned int num_glyphs)
{
TRACE_SERIALIZE (this);
if (unlikely (!Lookup::serialize (c, SubTable::Single, lookup_props, 1))) return_trace (false);
return_trace (serialize_subtable (c, 0).u.single.serialize (c, glyphs, substitutes, num_glyphs));
}
inline bool serialize_multiple (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
bool serialize_multiple (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &substitute_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &substitute_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!Lookup::serialize (c, SubTable::Multiple, lookup_props, 1))) return_trace (false);
@ -1403,12 +1403,12 @@ struct SubstLookup : Lookup
substitute_glyphs_list));
}
inline bool serialize_alternate (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
bool serialize_alternate (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &glyphs,
Supplier<unsigned int> &alternate_len_list,
unsigned int num_glyphs,
Supplier<GlyphID> &alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!Lookup::serialize (c, SubTable::Alternate, lookup_props, 1))) return_trace (false);
@ -1419,14 +1419,14 @@ struct SubstLookup : Lookup
alternate_glyphs_list));
}
inline bool serialize_ligature (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
bool serialize_ligature (hb_serialize_context_t *c,
uint32_t lookup_props,
Supplier<GlyphID> &first_glyphs,
Supplier<unsigned int> &ligature_per_first_glyph_count_list,
unsigned int num_first_glyphs,
Supplier<GlyphID> &ligatures_list,
Supplier<unsigned int> &component_count_list,
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!Lookup::serialize (c, SubTable::Ligature, lookup_props, 1))) return_trace (false);
@ -1440,9 +1440,9 @@ struct SubstLookup : Lookup
}
template <typename context_t>
static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
static inline hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
static hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
{
if (!c->should_visit_lookup (lookup_index))
return HB_VOID;
@ -1458,13 +1458,13 @@ struct SubstLookup : Lookup
}
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c) const
typename context_t::return_t dispatch (context_t *c) const
{ return Lookup::dispatch<SubTable> (c); }
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{ return Lookup::subset<SubTable> (c); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{ return Lookup::sanitize<SubTable> (c); }
};
@ -1477,13 +1477,13 @@ struct GSUB : GSUBGPOS
{
enum { tableTag = HB_OT_TAG_GSUB };
inline const SubstLookup& get_lookup (unsigned int i) const
const SubstLookup& get_lookup (unsigned int i) const
{ return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
inline bool subset (hb_subset_context_t *c) const
bool subset (hb_subset_context_t *c) const
{ return GSUBGPOS::subset<SubstLookup> (c); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{ return GSUBGPOS::sanitize<SubstLookup> (c); }
HB_INTERNAL bool is_blacklisted (hb_blob_t *blob,

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ typedef OffsetListOf<PosLookup> JstfMax;
struct JstfPriority
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -123,8 +123,8 @@ struct JstfPriority
struct JstfLangSys : OffsetListOf<JstfPriority>
{
inline bool sanitize (hb_sanitize_context_t *c,
const Record_sanitize_closure_t * = nullptr) const
bool sanitize (hb_sanitize_context_t *c,
const Record_sanitize_closure_t * = nullptr) const
{
TRACE_SANITIZE (this);
return_trace (OffsetListOf<JstfPriority>::sanitize (c));
@ -145,27 +145,27 @@ typedef SortedArrayOf<GlyphID> ExtenderGlyphs;
struct JstfScript
{
inline unsigned int get_lang_sys_count (void) const
unsigned int get_lang_sys_count (void) const
{ return langSys.len; }
inline const Tag& get_lang_sys_tag (unsigned int i) const
const Tag& get_lang_sys_tag (unsigned int i) const
{ return langSys.get_tag (i); }
inline unsigned int get_lang_sys_tags (unsigned int start_offset,
unsigned int *lang_sys_count /* IN/OUT */,
hb_tag_t *lang_sys_tags /* OUT */) const
unsigned int get_lang_sys_tags (unsigned int start_offset,
unsigned int *lang_sys_count /* IN/OUT */,
hb_tag_t *lang_sys_tags /* OUT */) const
{ return langSys.get_tags (start_offset, lang_sys_count, lang_sys_tags); }
inline const JstfLangSys& get_lang_sys (unsigned int i) const
const JstfLangSys& get_lang_sys (unsigned int i) const
{
if (i == Index::NOT_FOUND_INDEX) return get_default_lang_sys ();
return this+langSys[i].offset;
}
inline bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
{ return langSys.find_index (tag, index); }
inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
inline const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
inline bool sanitize (hb_sanitize_context_t *c,
const Record_sanitize_closure_t * = nullptr) const
bool sanitize (hb_sanitize_context_t *c,
const Record_sanitize_closure_t * = nullptr) const
{
TRACE_SANITIZE (this);
return_trace (extenderGlyphs.sanitize (c, this) &&
@ -197,20 +197,20 @@ struct JSTF
{
enum { tableTag = HB_OT_TAG_JSTF };
inline unsigned int get_script_count (void) const
unsigned int get_script_count (void) const
{ return scriptList.len; }
inline const Tag& get_script_tag (unsigned int i) const
const Tag& get_script_tag (unsigned int i) const
{ return scriptList.get_tag (i); }
inline unsigned int get_script_tags (unsigned int start_offset,
unsigned int *script_count /* IN/OUT */,
hb_tag_t *script_tags /* OUT */) const
unsigned int get_script_tags (unsigned int start_offset,
unsigned int *script_count /* IN/OUT */,
hb_tag_t *script_tags /* OUT */) const
{ return scriptList.get_tags (start_offset, script_count, script_tags); }
inline const JstfScript& get_script (unsigned int i) const
const JstfScript& get_script (unsigned int i) const
{ return this+scriptList[i].offset; }
inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
bool find_script_index (hb_tag_t tag, unsigned int *index) const
{ return scriptList.find_index (tag, index); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&

View File

@ -57,7 +57,7 @@ struct hb_ot_map_t
unsigned int auto_zwj : 1;
unsigned int random : 1;
inline int cmp (const hb_tag_t tag_) const
int cmp (const hb_tag_t tag_) const
{ return tag_ < tag ? -1 : tag_ > tag ? 1 : 0; }
};
@ -83,7 +83,7 @@ struct hb_ot_map_t
pause_func_t pause_func;
};
inline void init (void)
void init (void)
{
memset (this, 0, sizeof (*this));
@ -94,7 +94,7 @@ struct hb_ot_map_t
stages[table_index].init ();
}
}
inline void fini (void)
void fini (void)
{
features.fini ();
for (unsigned int table_index = 0; table_index < 2; table_index++)
@ -104,36 +104,42 @@ struct hb_ot_map_t
}
}
inline hb_mask_t get_global_mask (void) const { return global_mask; }
hb_mask_t get_global_mask (void) const { return global_mask; }
inline hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = nullptr) const {
hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = nullptr) const
{
const feature_map_t *map = features.bsearch (feature_tag);
if (shift) *shift = map ? map->shift : 0;
return map ? map->mask : 0;
}
inline bool needs_fallback (hb_tag_t feature_tag) const {
bool needs_fallback (hb_tag_t feature_tag) const
{
const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->needs_fallback : false;
}
inline hb_mask_t get_1_mask (hb_tag_t feature_tag) const {
hb_mask_t get_1_mask (hb_tag_t feature_tag) const
{
const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->_1_mask : 0;
}
inline unsigned int get_feature_index (unsigned int table_index, hb_tag_t feature_tag) const {
unsigned int get_feature_index (unsigned int table_index, hb_tag_t feature_tag) const
{
const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->index[table_index] : HB_OT_LAYOUT_NO_FEATURE_INDEX;
}
inline unsigned int get_feature_stage (unsigned int table_index, hb_tag_t feature_tag) const {
unsigned int get_feature_stage (unsigned int table_index, hb_tag_t feature_tag) const
{
const feature_map_t *map = features.bsearch (feature_tag);
return map ? map->stage[table_index] : (unsigned int) -1;
}
inline void get_stage_lookups (unsigned int table_index, unsigned int stage,
const struct lookup_map_t **plookups, unsigned int *lookup_count) const {
void get_stage_lookups (unsigned int table_index, unsigned int stage,
const struct lookup_map_t **plookups, unsigned int *lookup_count) const
{
if (unlikely (stage == (unsigned int) -1)) {
*plookups = nullptr;
*lookup_count = 0;
@ -203,20 +209,20 @@ struct hb_ot_map_builder_t
hb_ot_map_feature_flags_t flags=F_NONE,
unsigned int value=1);
inline void add_feature (const hb_ot_map_feature_t &feat)
void add_feature (const hb_ot_map_feature_t &feat)
{ add_feature (feat.tag, feat.flags); }
inline void enable_feature (hb_tag_t tag,
void enable_feature (hb_tag_t tag,
hb_ot_map_feature_flags_t flags=F_NONE,
unsigned int value=1)
{ add_feature (tag, F_GLOBAL | flags, value); }
inline void disable_feature (hb_tag_t tag)
void disable_feature (hb_tag_t tag)
{ add_feature (tag, F_GLOBAL, 0); }
inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func)
void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func)
{ add_pause (0, pause_func); }
inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func)
void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func)
{ add_pause (1, pause_func); }
HB_INTERNAL void compile (hb_ot_map_t &m,

View File

@ -36,12 +36,12 @@ namespace OT {
struct MathValueRecord
{
inline hb_position_t get_x_value (hb_font_t *font, const void *base) const
hb_position_t get_x_value (hb_font_t *font, const void *base) const
{ return font->em_scale_x (value) + (base+deviceTable).get_x_delta (font); }
inline hb_position_t get_y_value (hb_font_t *font, const void *base) const
hb_position_t get_y_value (hb_font_t *font, const void *base) const
{ return font->em_scale_y (value) + (base+deviceTable).get_y_delta (font); }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && deviceTable.sanitize (c, base));
@ -59,7 +59,7 @@ struct MathValueRecord
struct MathConstants
{
inline bool sanitize_math_value_records (hb_sanitize_context_t *c) const
bool sanitize_math_value_records (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -71,13 +71,13 @@ struct MathConstants
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && sanitize_math_value_records (c));
}
inline hb_position_t get_value (hb_ot_math_constant_t constant,
hb_position_t get_value (hb_ot_math_constant_t constant,
hb_font_t *font) const
{
switch (constant) {
@ -165,7 +165,7 @@ struct MathConstants
struct MathItalicsCorrectionInfo
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -173,8 +173,8 @@ struct MathItalicsCorrectionInfo
italicsCorrection.sanitize (c, this));
}
inline hb_position_t get_value (hb_codepoint_t glyph,
hb_font_t *font) const
hb_position_t get_value (hb_codepoint_t glyph,
hb_font_t *font) const
{
unsigned int index = (this+coverage).get_coverage (glyph);
return italicsCorrection[index].get_x_value (font, this);
@ -196,7 +196,7 @@ struct MathItalicsCorrectionInfo
struct MathTopAccentAttachment
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -204,8 +204,8 @@ struct MathTopAccentAttachment
topAccentAttachment.sanitize (c, this));
}
inline hb_position_t get_value (hb_codepoint_t glyph,
hb_font_t *font) const
hb_position_t get_value (hb_codepoint_t glyph,
hb_font_t *font) const
{
unsigned int index = (this+topAccentCoverage).get_coverage (glyph);
if (index == NOT_COVERED)
@ -229,7 +229,7 @@ struct MathTopAccentAttachment
struct MathKern
{
inline bool sanitize_math_value_records (hb_sanitize_context_t *c) const
bool sanitize_math_value_records (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
unsigned int count = 2 * heightCount + 1;
@ -238,7 +238,7 @@ struct MathKern
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -246,7 +246,7 @@ struct MathKern
sanitize_math_value_records (c));
}
inline hb_position_t get_value (hb_position_t correction_height, hb_font_t *font) const
hb_position_t get_value (hb_position_t correction_height, hb_font_t *font) const
{
const MathValueRecord* correctionHeight = mathValueRecordsZ.arrayZ;
const MathValueRecord* kernValue = mathValueRecordsZ.arrayZ + heightCount;
@ -294,7 +294,7 @@ struct MathKern
struct MathKernInfoRecord
{
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
@ -306,10 +306,10 @@ struct MathKernInfoRecord
return_trace (true);
}
inline hb_position_t get_kerning (hb_ot_math_kern_t kern,
hb_position_t correction_height,
hb_font_t *font,
const void *base) const
hb_position_t get_kerning (hb_ot_math_kern_t kern,
hb_position_t correction_height,
hb_font_t *font,
const void *base) const
{
unsigned int idx = kern;
if (unlikely (idx >= ARRAY_LENGTH (mathKern))) return 0;
@ -327,7 +327,7 @@ struct MathKernInfoRecord
struct MathKernInfo
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -335,10 +335,10 @@ struct MathKernInfo
mathKernInfoRecords.sanitize (c, this));
}
inline hb_position_t get_kerning (hb_codepoint_t glyph,
hb_ot_math_kern_t kern,
hb_position_t correction_height,
hb_font_t *font) const
hb_position_t get_kerning (hb_codepoint_t glyph,
hb_ot_math_kern_t kern,
hb_position_t correction_height,
hb_font_t *font) const
{
unsigned int index = (this+mathKernCoverage).get_coverage (glyph);
return mathKernInfoRecords[index].get_kerning (kern, correction_height, font, this);
@ -361,7 +361,7 @@ struct MathKernInfo
struct MathGlyphInfo
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -371,21 +371,21 @@ struct MathGlyphInfo
mathKernInfo.sanitize (c, this));
}
inline hb_position_t
hb_position_t
get_italics_correction (hb_codepoint_t glyph, hb_font_t *font) const
{ return (this+mathItalicsCorrectionInfo).get_value (glyph, font); }
inline hb_position_t
hb_position_t
get_top_accent_attachment (hb_codepoint_t glyph, hb_font_t *font) const
{ return (this+mathTopAccentAttachment).get_value (glyph, font); }
inline bool is_extended_shape (hb_codepoint_t glyph) const
bool is_extended_shape (hb_codepoint_t glyph) const
{ return (this+extendedShapeCoverage).get_coverage (glyph) != NOT_COVERED; }
inline hb_position_t get_kerning (hb_codepoint_t glyph,
hb_ot_math_kern_t kern,
hb_position_t correction_height,
hb_font_t *font) const
hb_position_t get_kerning (hb_codepoint_t glyph,
hb_ot_math_kern_t kern,
hb_position_t correction_height,
hb_font_t *font) const
{ return (this+mathKernInfo).get_kerning (glyph, kern, correction_height, font); }
protected:
@ -416,7 +416,7 @@ struct MathGlyphVariantRecord
{
friend struct MathGlyphConstruction;
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -446,15 +446,15 @@ struct PartFlags : HBUINT16
struct MathGlyphPartRecord
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
}
inline void extract (hb_ot_math_glyph_part_t &out,
int scale,
hb_font_t *font) const
void extract (hb_ot_math_glyph_part_t &out,
int scale,
hb_font_t *font) const
{
out.glyph = glyph;
@ -491,7 +491,7 @@ struct MathGlyphPartRecord
struct MathGlyphAssembly
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -499,12 +499,12 @@ struct MathGlyphAssembly
partRecords.sanitize (c));
}
inline unsigned int get_parts (hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *parts_count, /* IN/OUT */
hb_ot_math_glyph_part_t *parts /* OUT */,
hb_position_t *italics_correction /* OUT */) const
unsigned int get_parts (hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *parts_count, /* IN/OUT */
hb_ot_math_glyph_part_t *parts /* OUT */,
hb_position_t *italics_correction /* OUT */) const
{
if (parts_count)
{
@ -535,7 +535,7 @@ struct MathGlyphAssembly
struct MathGlyphConstruction
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -543,14 +543,14 @@ struct MathGlyphConstruction
mathGlyphVariantRecord.sanitize (c));
}
inline const MathGlyphAssembly &get_assembly (void) const
const MathGlyphAssembly &get_assembly (void) const
{ return this+glyphAssembly; }
inline unsigned int get_variants (hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *variants_count, /* IN/OUT */
hb_ot_math_glyph_variant_t *variants /* OUT */) const
unsigned int get_variants (hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *variants_count, /* IN/OUT */
hb_ot_math_glyph_variant_t *variants /* OUT */) const
{
if (variants_count)
{
@ -580,7 +580,7 @@ struct MathGlyphConstruction
struct MathVariants
{
inline bool sanitize_offsets (hb_sanitize_context_t *c) const
bool sanitize_offsets (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
unsigned int count = vertGlyphCount + horizGlyphCount;
@ -589,7 +589,7 @@ struct MathVariants
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -599,20 +599,20 @@ struct MathVariants
sanitize_offsets (c));
}
inline hb_position_t get_min_connector_overlap (hb_direction_t direction,
hb_position_t get_min_connector_overlap (hb_direction_t direction,
hb_font_t *font) const
{ return font->em_scale_dir (minConnectorOverlap, direction); }
inline unsigned int get_glyph_variants (hb_codepoint_t glyph,
hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *variants_count, /* IN/OUT */
hb_ot_math_glyph_variant_t *variants /* OUT */) const
unsigned int get_glyph_variants (hb_codepoint_t glyph,
hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *variants_count, /* IN/OUT */
hb_ot_math_glyph_variant_t *variants /* OUT */) const
{ return get_glyph_construction (glyph, direction, font)
.get_variants (direction, font, start_offset, variants_count, variants); }
inline unsigned int get_glyph_parts (hb_codepoint_t glyph,
unsigned int get_glyph_parts (hb_codepoint_t glyph,
hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
@ -626,10 +626,10 @@ struct MathVariants
italics_correction); }
private:
inline const MathGlyphConstruction &
get_glyph_construction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_font_t *font HB_UNUSED) const
const MathGlyphConstruction &
get_glyph_construction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_font_t *font HB_UNUSED) const
{
bool vertical = HB_DIRECTION_IS_VERTICAL (direction);
unsigned int count = vertical ? vertGlyphCount : horizGlyphCount;
@ -682,9 +682,9 @@ struct MATH
{
enum { tableTag = HB_OT_TAG_MATH };
inline bool has_data (void) const { return version.to_int (); }
bool has_data (void) const { return version.to_int (); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&
@ -694,14 +694,14 @@ struct MATH
mathVariants.sanitize (c, this));
}
inline hb_position_t get_constant (hb_ot_math_constant_t constant,
hb_position_t get_constant (hb_ot_math_constant_t constant,
hb_font_t *font) const
{ return (this+mathConstants).get_value (constant, font); }
inline const MathGlyphInfo &get_glyph_info (void) const
const MathGlyphInfo &get_glyph_info (void) const
{ return this+mathGlyphInfo; }
inline const MathVariants &get_variants (void) const
const MathVariants &get_variants (void) const
{ return this+mathVariants; }
protected:

View File

@ -41,7 +41,7 @@ namespace OT {
struct maxpV1Tail
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -73,17 +73,17 @@ struct maxp
{
enum { tableTag = HB_OT_TAG_maxp };
inline unsigned int get_num_glyphs (void) const
unsigned int get_num_glyphs (void) const
{
return numGlyphs;
}
inline void set_num_glyphs (unsigned int count)
void set_num_glyphs (unsigned int count)
{
numGlyphs.set (count);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this)))
@ -97,7 +97,7 @@ struct maxp
return_trace (likely (version.major == 0 && version.minor == 0x5000u));
}
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *maxp_blob = hb_sanitize_context_t().reference_table<maxp> (plan->source);
hb_blob_t *maxp_prime_blob = hb_blob_copy_writable_or_fail (maxp_blob);
@ -117,7 +117,7 @@ struct maxp
return result;
}
static inline void drop_hint_fields (hb_subset_plan_t *plan HB_UNUSED, maxp *maxp_prime)
static void drop_hint_fields (hb_subset_plan_t *plan HB_UNUSED, maxp *maxp_prime)
{
if (maxp_prime->version.major == 1)
{

View File

@ -49,7 +49,7 @@ namespace OT {
struct NameRecord
{
inline hb_language_t language (hb_face_t *face) const
hb_language_t language (hb_face_t *face) const
{
unsigned int p = platformID;
unsigned int l = languageID;
@ -66,7 +66,7 @@ struct NameRecord
return HB_LANGUAGE_INVALID;
}
inline uint16_t score (void) const
uint16_t score (void) const
{
/* Same order as in cmap::find_best_subtable(). */
unsigned int p = platformID;
@ -93,7 +93,7 @@ struct NameRecord
return UNSUPPORTED;
}
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
/* We can check from base all the way up to the end of string... */
@ -153,10 +153,11 @@ struct name
{
enum { tableTag = HB_OT_TAG_name };
inline unsigned int get_size (void) const
unsigned int get_size (void) const
{ return min_size + count * nameRecordZ.item_size; }
inline bool sanitize_records (hb_sanitize_context_t *c) const {
bool sanitize_records (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
const void *string_pool = (this+stringOffset).arrayZ;
unsigned int _count = count;
@ -166,7 +167,7 @@ struct name
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -177,7 +178,7 @@ struct name
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
this->table = hb_sanitize_context_t().reference_table<name> (face);
assert (this->table.get_length () >= this->table->stringOffset);
@ -217,13 +218,13 @@ struct name
this->names.resize (j);
}
inline void fini (void)
void fini (void)
{
this->names.fini ();
this->table.destroy ();
}
inline int get_index (hb_ot_name_id_t name_id,
int get_index (hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *width=nullptr) const
{
@ -243,7 +244,7 @@ struct name
return entry->entry_index;
}
inline hb_bytes_t get_name (unsigned int idx) const
hb_bytes_t get_name (unsigned int idx) const
{
const hb_array_t<const NameRecord> all_names (table->nameRecordZ.arrayZ, table->count);
const NameRecord &record = all_names[idx];

View File

@ -44,7 +44,7 @@ namespace OT {
struct OS2V1Tail
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -59,7 +59,7 @@ struct OS2V1Tail
struct OS2V2Tail
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -77,7 +77,7 @@ struct OS2V2Tail
struct OS2V5Tail
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -94,11 +94,11 @@ struct OS2
{
enum { tableTag = HB_OT_TAG_OS2 };
inline bool has_data (void) const { return this != &Null (OS2); }
bool has_data (void) const { return this != &Null (OS2); }
inline const OS2V1Tail &v1 (void) const { return version >= 1 ? v1X : Null (OS2V1Tail); }
inline const OS2V2Tail &v2 (void) const { return version >= 2 ? v2X : Null (OS2V2Tail); }
inline const OS2V5Tail &v5 (void) const { return version >= 5 ? v5X : Null (OS2V5Tail); }
const OS2V1Tail &v1 (void) const { return version >= 1 ? v1X : Null (OS2V1Tail); }
const OS2V2Tail &v2 (void) const { return version >= 2 ? v2X : Null (OS2V2Tail); }
const OS2V5Tail &v5 (void) const { return version >= 5 ? v5X : Null (OS2V5Tail); }
enum selection_flag_t {
ITALIC = 1u<<0,
@ -113,9 +113,9 @@ struct OS2
OBLIQUE = 1u<<9
};
inline bool is_italic (void) const { return fsSelection & ITALIC; }
inline bool is_oblique (void) const { return fsSelection & OBLIQUE; }
inline bool is_typo_metrics (void) const { return fsSelection & USE_TYPO_METRICS; }
bool is_italic (void) const { return fsSelection & ITALIC; }
bool is_oblique (void) const { return fsSelection & OBLIQUE; }
bool is_typo_metrics (void) const { return fsSelection & USE_TYPO_METRICS; }
enum width_class_t {
FWIDTH_ULTRA_CONDENSED = 1, /* 50% */
@ -129,7 +129,7 @@ struct OS2
FWIDTH_ULTRA_EXPANDED = 9 /* 200% */
};
inline float get_width (void) const
float get_width (void) const
{
switch (usWidthClass) {
case FWIDTH_ULTRA_CONDENSED:return 50.f;
@ -145,7 +145,7 @@ struct OS2
}
}
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *os2_blob = hb_sanitize_context_t ().reference_table<OS2> (plan->source);
hb_blob_t *os2_prime_blob = hb_blob_create_sub_blob (os2_blob, 0, -1);
@ -170,8 +170,8 @@ struct OS2
return result;
}
inline void _update_unicode_ranges (const hb_set_t *codepoints,
HBUINT32 ulUnicodeRange[4]) const
void _update_unicode_ranges (const hb_set_t *codepoints,
HBUINT32 ulUnicodeRange[4]) const
{
for (unsigned int i = 0; i < 4; i++)
ulUnicodeRange[i].set (0);
@ -196,7 +196,7 @@ struct OS2
}
}
static inline void find_min_and_max_codepoint (const hb_set_t *codepoints,
static void find_min_and_max_codepoint (const hb_set_t *codepoints,
uint16_t *min_cp, /* OUT */
uint16_t *max_cp /* OUT */)
{
@ -215,10 +215,10 @@ struct OS2
};
// https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681
inline font_page_t get_font_page (void) const
font_page_t get_font_page (void) const
{ return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this))) return_trace (false);

View File

@ -51,7 +51,7 @@ struct postV2Tail
{
friend struct post;
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (glyphNameIndex.sanitize (c));
@ -73,7 +73,7 @@ struct post
{
enum { tableTag = HB_OT_TAG_post };
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
unsigned int post_prime_length;
hb_blob_t *post_blob = hb_sanitize_context_t ().reference_table<post>(plan->source);
@ -97,7 +97,7 @@ struct post
struct accelerator_t
{
inline void init (hb_face_t *face)
void init (hb_face_t *face)
{
index_to_offset.init ();
@ -118,15 +118,15 @@ struct post
data += 1 + *data)
index_to_offset.push (data - pool);
}
inline void fini (void)
void fini (void)
{
index_to_offset.fini ();
free (gids_sorted_by_name.get ());
table.destroy ();
}
inline bool get_glyph_name (hb_codepoint_t glyph,
char *buf, unsigned int buf_len) const
bool get_glyph_name (hb_codepoint_t glyph,
char *buf, unsigned int buf_len) const
{
hb_bytes_t s = find_glyph_name (glyph);
if (!s.len) return false;
@ -137,8 +137,8 @@ struct post
return true;
}
inline bool get_glyph_from_name (const char *name, int len,
hb_codepoint_t *glyph) const
bool get_glyph_from_name (const char *name, int len,
hb_codepoint_t *glyph) const
{
unsigned int count = get_glyph_count ();
if (unlikely (!count)) return false;
@ -180,7 +180,7 @@ struct post
protected:
inline unsigned int get_glyph_count (void) const
unsigned int get_glyph_count (void) const
{
if (version == 0x00010000)
return NUM_FORMAT1_NAMES;
@ -191,7 +191,7 @@ struct post
return 0;
}
static inline int cmp_gids (const void *pa, const void *pb, void *arg)
static int cmp_gids (const void *pa, const void *pb, void *arg)
{
const accelerator_t *thiz = (const accelerator_t *) arg;
uint16_t a = * (const uint16_t *) pa;
@ -199,7 +199,7 @@ struct post
return thiz->find_glyph_name (b).cmp (thiz->find_glyph_name (a));
}
static inline int cmp_key (const void *pk, const void *po, void *arg)
static int cmp_key (const void *pk, const void *po, void *arg)
{
const accelerator_t *thiz = (const accelerator_t *) arg;
const hb_bytes_t *key = (const hb_bytes_t *) pk;
@ -207,7 +207,7 @@ struct post
return thiz->find_glyph_name (o).cmp (*key);
}
inline hb_bytes_t find_glyph_name (hb_codepoint_t glyph) const
hb_bytes_t find_glyph_name (hb_codepoint_t glyph) const
{
if (version == 0x00010000)
{
@ -245,7 +245,7 @@ struct post
hb_atomic_ptr_t<uint16_t *> gids_sorted_by_name;
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -226,7 +226,7 @@ override_features_indic (hb_ot_shape_planner_t *plan)
struct would_substitute_feature_t
{
inline void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_)
void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_)
{
zero_context = zero_context_;
map->get_stage_lookups (0/*GSUB*/,
@ -234,9 +234,9 @@ struct would_substitute_feature_t
&lookups, &count);
}
inline bool would_substitute (const hb_codepoint_t *glyphs,
unsigned int glyphs_count,
hb_face_t *face) const
bool would_substitute (const hb_codepoint_t *glyphs,
unsigned int glyphs_count,
hb_face_t *face) const
{
for (unsigned int i = 0; i < count; i++)
if (hb_ot_layout_lookup_would_substitute_fast (face, lookups[i].index, glyphs, glyphs_count, zero_context))
@ -252,7 +252,7 @@ struct would_substitute_feature_t
struct indic_shape_plan_t
{
inline bool load_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const
bool load_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const
{
hb_codepoint_t glyph = virama_glyph.get_relaxed ();
if (unlikely (glyph == (hb_codepoint_t) -1))

View File

@ -151,7 +151,7 @@ override_features_khmer (hb_ot_shape_planner_t *plan)
struct would_substitute_feature_t
{
inline void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_)
void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_)
{
zero_context = zero_context_;
map->get_stage_lookups (0/*GSUB*/,
@ -159,9 +159,9 @@ struct would_substitute_feature_t
&lookups, &count);
}
inline bool would_substitute (const hb_codepoint_t *glyphs,
unsigned int glyphs_count,
hb_face_t *face) const
bool would_substitute (const hb_codepoint_t *glyphs,
unsigned int glyphs_count,
hb_face_t *face) const
{
for (unsigned int i = 0; i < count; i++)
if (hb_ot_layout_lookup_would_substitute_fast (face, lookups[i].index, glyphs, glyphs_count, zero_context))
@ -177,7 +177,7 @@ struct would_substitute_feature_t
struct khmer_shape_plan_t
{
inline bool get_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const
bool get_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const
{
hb_codepoint_t glyph = virama_glyph;
if (unlikely (virama_glyph == (hb_codepoint_t) -1))

View File

@ -37,7 +37,7 @@ struct hb_ot_shape_plan_key_t
{
unsigned int variations_index[2];
inline void init (hb_face_t *face,
void init (hb_face_t *face,
const int *coords,
unsigned int num_coords)
{
@ -49,7 +49,7 @@ struct hb_ot_shape_plan_key_t
&variations_index[table_index]);
}
inline bool equal (const hb_ot_shape_plan_key_t *other)
bool equal (const hb_ot_shape_plan_key_t *other)
{
return 0 == memcmp (this, other, sizeof (*this));
}
@ -85,7 +85,7 @@ struct hb_ot_shape_plan_t
bool apply_morx : 1;
bool apply_trak : 1;
inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
{
unsigned int table_index;
switch (table_tag) {

View File

@ -59,7 +59,7 @@ enum
struct AxisValueFormat1
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -82,7 +82,7 @@ struct AxisValueFormat1
struct AxisValueFormat2
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -109,7 +109,7 @@ struct AxisValueFormat2
struct AxisValueFormat3
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -134,7 +134,7 @@ struct AxisValueFormat3
struct AxisValueRecord
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -151,7 +151,7 @@ struct AxisValueRecord
struct AxisValueFormat4
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -175,7 +175,7 @@ struct AxisValueFormat4
struct AxisValue
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (c->check_struct (this)))
@ -206,7 +206,7 @@ struct AxisValue
struct StatAxisRecord
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
@ -227,7 +227,7 @@ struct STAT
{
enum { tableTag = HB_OT_TAG_STAT };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&

View File

@ -42,7 +42,7 @@ namespace OT {
struct AxisValueMap
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -59,7 +59,7 @@ struct AxisValueMap
struct SegmentMaps : ArrayOf<AxisValueMap>
{
inline int map (int value) const
int map (int value) const
{
/* The following special-cases are not part of OpenType, which requires
* that at least -1, 0, and +1 must be mapped. But we include these as
@ -101,7 +101,7 @@ struct avar
{
enum { tableTag = HB_OT_TAG_avar };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!(version.sanitize (c) &&
@ -121,7 +121,7 @@ struct avar
return_trace (true);
}
inline void map_coords (int *coords, unsigned int coords_length) const
void map_coords (int *coords, unsigned int coords_length) const
{
unsigned int count = MIN<unsigned int> (coords_length, axisCount);

View File

@ -44,10 +44,10 @@ struct InstanceRecord
{
friend struct fvar;
inline hb_array_t<const Fixed> get_coordinates (unsigned int axis_count) const
hb_array_t<const Fixed> get_coordinates (unsigned int axis_count) const
{ return coordinatesZ.as_array (axis_count); }
inline bool sanitize (hb_sanitize_context_t *c, unsigned int axis_count) const
bool sanitize (hb_sanitize_context_t *c, unsigned int axis_count) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -75,7 +75,7 @@ struct AxisRecord
AXIS_FLAG_HIDDEN = 0x0001,
};
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -98,9 +98,9 @@ struct fvar
{
enum { tableTag = HB_OT_TAG_fvar };
inline bool has_data (void) const { return version.to_int (); }
bool has_data (void) const { return version.to_int (); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&
@ -112,10 +112,9 @@ struct fvar
c->check_range (get_instance (0), instanceCount, instanceSize));
}
inline unsigned int get_axis_count (void) const
{ return axisCount; }
unsigned int get_axis_count (void) const { return axisCount; }
inline void get_axis_deprecated (unsigned int axis_index,
void get_axis_deprecated (unsigned int axis_index,
hb_ot_var_axis_t *info) const
{
const AxisRecord &axis = get_axes ()[axis_index];
@ -127,8 +126,8 @@ struct fvar
info->max_value = MAX<float> (info->default_value, axis.maxValue / 65536.);
}
inline void get_axis_info (unsigned int axis_index,
hb_ot_var_axis_info_t *info) const
void get_axis_info (unsigned int axis_index,
hb_ot_var_axis_info_t *info) const
{
const AxisRecord &axis = get_axes ()[axis_index];
info->axis_index = axis_index;
@ -142,9 +141,9 @@ struct fvar
info->reserved = 0;
}
inline unsigned int get_axes_deprecated (unsigned int start_offset,
unsigned int *axes_count /* IN/OUT */,
hb_ot_var_axis_t *axes_array /* OUT */) const
unsigned int get_axes_deprecated (unsigned int start_offset,
unsigned int *axes_count /* IN/OUT */,
hb_ot_var_axis_t *axes_array /* OUT */) const
{
if (axes_count)
{
@ -164,9 +163,9 @@ struct fvar
return axisCount;
}
inline unsigned int get_axis_infos (unsigned int start_offset,
unsigned int *axes_count /* IN/OUT */,
hb_ot_var_axis_info_t *axes_array /* OUT */) const
unsigned int get_axis_infos (unsigned int start_offset,
unsigned int *axes_count /* IN/OUT */,
hb_ot_var_axis_info_t *axes_array /* OUT */) const
{
if (axes_count)
{
@ -186,9 +185,9 @@ struct fvar
return axisCount;
}
inline bool find_axis_deprecated (hb_tag_t tag,
unsigned int *axis_index,
hb_ot_var_axis_t *info) const
bool find_axis_deprecated (hb_tag_t tag,
unsigned int *axis_index,
hb_ot_var_axis_t *info) const
{
const AxisRecord *axes = get_axes ();
unsigned int count = get_axis_count ();
@ -205,8 +204,8 @@ struct fvar
return false;
}
inline bool find_axis_info (hb_tag_t tag,
hb_ot_var_axis_info_t *info) const
bool find_axis_info (hb_tag_t tag,
hb_ot_var_axis_info_t *info) const
{
const AxisRecord *axes = get_axes ();
unsigned int count = get_axis_count ();
@ -219,7 +218,7 @@ struct fvar
return false;
}
inline int normalize_axis_value (unsigned int axis_index, float v) const
int normalize_axis_value (unsigned int axis_index, float v) const
{
hb_ot_var_axis_info_t axis;
get_axis_info (axis_index, &axis);
@ -235,17 +234,17 @@ struct fvar
return (int) (v * 16384.f + (v >= 0.f ? .5f : -.5f));
}
inline unsigned int get_instance_count (void) const
unsigned int get_instance_count (void) const
{ return instanceCount; }
inline hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int instance_index) const
hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int instance_index) const
{
const InstanceRecord *instance = get_instance (instance_index);
if (unlikely (!instance)) return HB_OT_NAME_ID_INVALID;
return instance->subfamilyNameID;
}
inline hb_ot_name_id_t get_instance_postscript_name_id (unsigned int instance_index) const
hb_ot_name_id_t get_instance_postscript_name_id (unsigned int instance_index) const
{
const InstanceRecord *instance = get_instance (instance_index);
if (unlikely (!instance)) return HB_OT_NAME_ID_INVALID;
@ -254,7 +253,7 @@ struct fvar
return HB_OT_NAME_ID_INVALID;
}
inline unsigned int get_instance_coords (unsigned int instance_index,
unsigned int get_instance_coords (unsigned int instance_index,
unsigned int *coords_length, /* IN/OUT */
float *coords /* OUT */) const
{
@ -277,10 +276,10 @@ struct fvar
}
protected:
inline hb_array_t<const AxisRecord> get_axes (void) const
hb_array_t<const AxisRecord> get_axes (void) const
{ return hb_array (&(this+firstAxis), axisCount); }
inline const InstanceRecord *get_instance (unsigned int i) const
const InstanceRecord *get_instance (unsigned int i) const
{
if (unlikely (i >= instanceCount)) return nullptr;
return &StructAtOffset<InstanceRecord> (&StructAfter<InstanceRecord> (get_axes ()),

View File

@ -35,7 +35,7 @@ namespace OT {
struct DeltaSetIndexMap
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
@ -73,10 +73,10 @@ struct DeltaSetIndexMap
}
protected:
inline unsigned int get_width (void) const
unsigned int get_width (void) const
{ return ((format >> 4) & 3) + 1; }
inline unsigned int get_inner_bitcount (void) const
unsigned int get_inner_bitcount (void) const
{ return (format & 0xF) + 1; }
protected:
@ -105,7 +105,7 @@ struct HVARVVAR
enum { HVARTag = HB_OT_TAG_HVAR };
enum { VVARTag = HB_OT_TAG_VVAR };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&
@ -116,14 +116,14 @@ struct HVARVVAR
rsbMap.sanitize (c, this));
}
inline float get_advance_var (hb_codepoint_t glyph,
const int *coords, unsigned int coord_count) const
float get_advance_var (hb_codepoint_t glyph,
const int *coords, unsigned int coord_count) const
{
unsigned int varidx = (this+advMap).map (glyph);
return (this+varStore).get_delta (varidx, coords, coord_count);
}
inline bool has_sidebearing_deltas (void) const
bool has_sidebearing_deltas (void) const
{ return lsbMap && rsbMap; }
protected:
@ -148,7 +148,7 @@ struct HVAR : HVARVVAR {
struct VVAR : HVARVVAR {
enum { tableTag = HB_OT_TAG_VVAR };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (static_cast<const HVARVVAR *> (this)->sanitize (c) &&

View File

@ -35,7 +35,7 @@ namespace OT {
struct VariationValueRecord
{
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -60,7 +60,7 @@ struct MVAR
{
enum { tableTag = HB_OT_TAG_MVAR };
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&
@ -73,8 +73,8 @@ struct MVAR
valueRecordSize));
}
inline float get_var (hb_tag_t tag,
const int *coords, unsigned int coord_count) const
float get_var (hb_tag_t tag,
const int *coords, unsigned int coord_count) const
{
const VariationValueRecord *record;
record = (VariationValueRecord *) bsearch (&tag, valuesZ.arrayZ,
@ -87,7 +87,7 @@ struct MVAR
}
protected:
static inline int tag_compare (const void *pa, const void *pb)
static int tag_compare (const void *pa, const void *pb)
{
const hb_tag_t *a = (const hb_tag_t *) pa;
const Tag *b = (const Tag *) pb;

View File

@ -39,9 +39,9 @@ namespace OT {
struct VertOriginMetric
{
inline int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
@ -59,9 +59,9 @@ struct VORG
{
enum { tableTag = HB_OT_TAG_VORG };
inline bool has_data (void) const { return version.to_int (); }
bool has_data (void) const { return version.to_int (); }
inline int get_y_origin (hb_codepoint_t glyph) const
int get_y_origin (hb_codepoint_t glyph) const
{
unsigned int i;
if (!vertYOrigins.bfind (glyph, &i))
@ -69,11 +69,11 @@ struct VORG
return vertYOrigins[i].vertOriginY;
}
inline bool _subset (const hb_subset_plan_t *plan HB_UNUSED,
const VORG *vorg_table,
const hb_vector_t<VertOriginMetric> &subset_metrics,
unsigned int dest_sz,
void *dest) const
bool _subset (const hb_subset_plan_t *plan HB_UNUSED,
const VORG *vorg_table,
const hb_vector_t<VertOriginMetric> &subset_metrics,
unsigned int dest_sz,
void *dest) const
{
hb_serialize_context_t c (dest, dest_sz);
@ -102,7 +102,7 @@ struct VORG
return success;
}
inline bool subset (hb_subset_plan_t *plan) const
bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *vorg_blob = hb_sanitize_context_t().reference_table<VORG> (plan->source);
const VORG *vorg_table = vorg_blob->as<VORG> ();
@ -159,7 +159,7 @@ struct VORG
return success;
}
inline bool sanitize (hb_sanitize_context_t *c) const
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -61,15 +61,12 @@ struct hb_set_digest_lowest_bits_t
static_assert ((shift < sizeof (hb_codepoint_t) * 8), "");
static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8), "");
inline void init (void) {
mask = 0;
}
void init (void) { mask = 0; }
inline void add (hb_codepoint_t g) {
mask |= mask_for (g);
}
void add (hb_codepoint_t g) { mask |= mask_for (g); }
inline bool add_range (hb_codepoint_t a, hb_codepoint_t b) {
bool add_range (hb_codepoint_t a, hb_codepoint_t b)
{
if ((b >> shift) - (a >> shift) >= mask_bits - 1)
mask = (mask_t) -1;
else {
@ -81,7 +78,7 @@ struct hb_set_digest_lowest_bits_t
}
template <typename T>
inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
{
for (unsigned int i = 0; i < count; i++)
{
@ -90,7 +87,7 @@ struct hb_set_digest_lowest_bits_t
}
}
template <typename T>
inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
{
for (unsigned int i = 0; i < count; i++)
{
@ -100,51 +97,53 @@ struct hb_set_digest_lowest_bits_t
return true;
}
inline bool may_have (hb_codepoint_t g) const {
return !!(mask & mask_for (g));
}
bool may_have (hb_codepoint_t g) const
{ return !!(mask & mask_for (g)); }
private:
static inline mask_t mask_for (hb_codepoint_t g) {
return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1));
}
static mask_t mask_for (hb_codepoint_t g)
{ return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1)); }
mask_t mask;
};
template <typename head_t, typename tail_t>
struct hb_set_digest_combiner_t
{
inline void init (void) {
void init (void)
{
head.init ();
tail.init ();
}
inline void add (hb_codepoint_t g) {
void add (hb_codepoint_t g)
{
head.add (g);
tail.add (g);
}
inline bool add_range (hb_codepoint_t a, hb_codepoint_t b) {
bool add_range (hb_codepoint_t a, hb_codepoint_t b)
{
head.add_range (a, b);
tail.add_range (a, b);
return true;
}
template <typename T>
inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
{
head.add_array (array, count, stride);
tail.add_array (array, count, stride);
}
template <typename T>
inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
{
head.add_sorted_array (array, count, stride);
tail.add_sorted_array (array, count, stride);
return true;
}
inline bool may_have (hb_codepoint_t g) const {
bool may_have (hb_codepoint_t g) const
{
return head.may_have (g) && tail.may_have (g);
}

View File

@ -40,12 +40,12 @@
struct hb_set_t
{
HB_NO_COPY_ASSIGN (hb_set_t);
inline hb_set_t (void) { init (); }
inline ~hb_set_t (void) { fini (); }
hb_set_t (void) { init (); }
~hb_set_t (void) { fini (); }
struct page_map_t
{
inline int cmp (const page_map_t &o) const { return (int) o.major - (int) major; }
int cmp (const page_map_t &o) const { return (int) o.major - (int) major; }
uint32_t major;
uint32_t index;
@ -53,13 +53,13 @@ struct hb_set_t
struct page_t
{
inline void init0 (void) { v.clear (); }
inline void init1 (void) { v.clear (0xFF); }
void init0 (void) { v.clear (); }
void init1 (void) { v.clear (0xFF); }
inline unsigned int len (void) const
unsigned int len (void) const
{ return ARRAY_LENGTH_CONST (v); }
inline bool is_empty (void) const
bool is_empty (void) const
{
for (unsigned int i = 0; i < len (); i++)
if (v[i])
@ -67,11 +67,11 @@ struct hb_set_t
return true;
}
inline void add (hb_codepoint_t g) { elt (g) |= mask (g); }
inline void del (hb_codepoint_t g) { elt (g) &= ~mask (g); }
inline bool has (hb_codepoint_t g) const { return !!(elt (g) & mask (g)); }
void add (hb_codepoint_t g) { elt (g) |= mask (g); }
void del (hb_codepoint_t g) { elt (g) &= ~mask (g); }
bool has (hb_codepoint_t g) const { return !!(elt (g) & mask (g)); }
inline void add_range (hb_codepoint_t a, hb_codepoint_t b)
void add_range (hb_codepoint_t a, hb_codepoint_t b)
{
elt_t *la = &elt (a);
elt_t *lb = &elt (b);
@ -88,12 +88,12 @@ struct hb_set_t
}
}
inline bool is_equal (const page_t *other) const
bool is_equal (const page_t *other) const
{
return 0 == hb_memcmp (&v, &other->v, sizeof (v));
}
inline unsigned int get_population (void) const
unsigned int get_population (void) const
{
unsigned int pop = 0;
for (unsigned int i = 0; i < len (); i++)
@ -101,7 +101,7 @@ struct hb_set_t
return pop;
}
inline bool next (hb_codepoint_t *codepoint) const
bool next (hb_codepoint_t *codepoint) const
{
unsigned int m = (*codepoint + 1) & MASK;
if (!m)
@ -123,7 +123,7 @@ struct hb_set_t
*codepoint = INVALID;
return false;
}
inline bool previous (hb_codepoint_t *codepoint) const
bool previous (hb_codepoint_t *codepoint) const
{
unsigned int m = (*codepoint - 1) & MASK;
if (m == MASK)
@ -145,14 +145,14 @@ struct hb_set_t
*codepoint = INVALID;
return false;
}
inline hb_codepoint_t get_min (void) const
hb_codepoint_t get_min (void) const
{
for (unsigned int i = 0; i < len (); i++)
if (v[i])
return i * ELT_BITS + elt_get_min (v[i]);
return INVALID;
}
inline hb_codepoint_t get_max (void) const
hb_codepoint_t get_max (void) const
{
for (int i = len () - 1; i >= 0; i--)
if (v[i])
@ -164,8 +164,8 @@ struct hb_set_t
enum { PAGE_BITS = 512 };
static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, "");
static inline unsigned int elt_get_min (const elt_t &elt) { return hb_ctz (elt); }
static inline unsigned int elt_get_max (const elt_t &elt) { return hb_bit_storage (elt) - 1; }
static unsigned int elt_get_min (const elt_t &elt) { return hb_ctz (elt); }
static unsigned int elt_get_max (const elt_t &elt) { return hb_bit_storage (elt) - 1; }
typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t;
@ -189,31 +189,31 @@ struct hb_set_t
hb_vector_t<page_map_t, 1> page_map;
hb_vector_t<page_t, 1> pages;
inline void init_shallow (void)
void init_shallow (void)
{
successful = true;
population = 0;
page_map.init ();
pages.init ();
}
inline void init (void)
void init (void)
{
hb_object_init (this);
init_shallow ();
}
inline void fini_shallow (void)
void fini_shallow (void)
{
population = 0;
page_map.fini ();
pages.fini ();
}
inline void fini (void)
void fini (void)
{
hb_object_fini (this);
fini_shallow ();
}
inline bool resize (unsigned int count)
bool resize (unsigned int count)
{
if (unlikely (!successful)) return false;
if (!pages.resize (count) || !page_map.resize (count))
@ -225,7 +225,7 @@ struct hb_set_t
return true;
}
inline void clear (void)
void clear (void)
{
if (unlikely (hb_object_is_immutable (this)))
return;
@ -234,7 +234,7 @@ struct hb_set_t
page_map.resize (0);
pages.resize (0);
}
inline bool is_empty (void) const
bool is_empty (void) const
{
unsigned int count = pages.len;
for (unsigned int i = 0; i < count; i++)
@ -243,9 +243,9 @@ struct hb_set_t
return true;
}
inline void dirty (void) { population = (unsigned int) -1; }
void dirty (void) { population = (unsigned int) -1; }
inline void add (hb_codepoint_t g)
void add (hb_codepoint_t g)
{
if (unlikely (!successful)) return;
if (unlikely (g == INVALID)) return;
@ -253,7 +253,7 @@ struct hb_set_t
page_t *page = page_for_insert (g); if (unlikely (!page)) return;
page->add (g);
}
inline bool add_range (hb_codepoint_t a, hb_codepoint_t b)
bool add_range (hb_codepoint_t a, hb_codepoint_t b)
{
if (unlikely (!successful)) return true; /* https://github.com/harfbuzz/harfbuzz/issues/657 */
if (unlikely (a > b || a == INVALID || b == INVALID)) return false;
@ -283,7 +283,7 @@ struct hb_set_t
}
template <typename T>
inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
{
if (unlikely (!successful)) return;
if (!count) return;
@ -309,7 +309,7 @@ struct hb_set_t
/* Might return false if array looks unsorted.
* Used for faster rejection of corrupt data. */
template <typename T>
inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
{
if (unlikely (!successful)) return true; /* https://github.com/harfbuzz/harfbuzz/issues/657 */
if (!count) return true;
@ -337,7 +337,7 @@ struct hb_set_t
return true;
}
inline void del (hb_codepoint_t g)
void del (hb_codepoint_t g)
{
/* TODO perform op even if !successful. */
if (unlikely (!successful)) return;
@ -347,7 +347,7 @@ struct hb_set_t
dirty ();
page->del (g);
}
inline void del_range (hb_codepoint_t a, hb_codepoint_t b)
void del_range (hb_codepoint_t a, hb_codepoint_t b)
{
/* TODO perform op even if !successful. */
/* TODO Optimize, like add_range(). */
@ -355,20 +355,20 @@ struct hb_set_t
for (unsigned int i = a; i < b + 1; i++)
del (i);
}
inline bool has (hb_codepoint_t g) const
bool has (hb_codepoint_t g) const
{
const page_t *page = page_for (g);
if (!page)
return false;
return page->has (g);
}
inline bool intersects (hb_codepoint_t first,
bool intersects (hb_codepoint_t first,
hb_codepoint_t last) const
{
hb_codepoint_t c = first - 1;
return next (&c) && c <= last;
}
inline void set (const hb_set_t *other)
void set (const hb_set_t *other)
{
if (unlikely (!successful)) return;
unsigned int count = other->pages.len;
@ -379,7 +379,7 @@ struct hb_set_t
memcpy ((void *) page_map, (const void *) other->page_map, count * page_map.item_size);
}
inline bool is_equal (const hb_set_t *other) const
bool is_equal (const hb_set_t *other) const
{
if (get_population () != other->get_population ())
return false;
@ -406,7 +406,7 @@ struct hb_set_t
return true;
}
inline bool is_subset (const hb_set_t *larger_set) const
bool is_subset (const hb_set_t *larger_set) const
{
if (get_population () > larger_set->get_population ())
return false;
@ -421,7 +421,7 @@ struct hb_set_t
}
template <class Op>
inline void process (const hb_set_t *other)
void process (const hb_set_t *other)
{
if (unlikely (!successful)) return;
@ -519,23 +519,23 @@ struct hb_set_t
resize (newCount);
}
inline void union_ (const hb_set_t *other)
void union_ (const hb_set_t *other)
{
process<HbOpOr> (other);
}
inline void intersect (const hb_set_t *other)
void intersect (const hb_set_t *other)
{
process<HbOpAnd> (other);
}
inline void subtract (const hb_set_t *other)
void subtract (const hb_set_t *other)
{
process<HbOpMinus> (other);
}
inline void symmetric_difference (const hb_set_t *other)
void symmetric_difference (const hb_set_t *other)
{
process<HbOpXor> (other);
}
inline bool next (hb_codepoint_t *codepoint) const
bool next (hb_codepoint_t *codepoint) const
{
if (unlikely (*codepoint == INVALID)) {
*codepoint = get_min ();
@ -566,7 +566,7 @@ struct hb_set_t
*codepoint = INVALID;
return false;
}
inline bool previous (hb_codepoint_t *codepoint) const
bool previous (hb_codepoint_t *codepoint) const
{
if (unlikely (*codepoint == INVALID)) {
*codepoint = get_max ();
@ -597,7 +597,7 @@ struct hb_set_t
*codepoint = INVALID;
return false;
}
inline bool next_range (hb_codepoint_t *first, hb_codepoint_t *last) const
bool next_range (hb_codepoint_t *first, hb_codepoint_t *last) const
{
hb_codepoint_t i;
@ -615,7 +615,7 @@ struct hb_set_t
return true;
}
inline bool previous_range (hb_codepoint_t *first, hb_codepoint_t *last) const
bool previous_range (hb_codepoint_t *first, hb_codepoint_t *last) const
{
hb_codepoint_t i;
@ -634,7 +634,7 @@ struct hb_set_t
return true;
}
inline unsigned int get_population (void) const
unsigned int get_population (void) const
{
if (population != (unsigned int) -1)
return population;
@ -647,7 +647,7 @@ struct hb_set_t
population = pop;
return pop;
}
inline hb_codepoint_t get_min (void) const
hb_codepoint_t get_min (void) const
{
unsigned int count = pages.len;
for (unsigned int i = 0; i < count; i++)
@ -655,7 +655,7 @@ struct hb_set_t
return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min ();
return INVALID;
}
inline hb_codepoint_t get_max (void) const
hb_codepoint_t get_max (void) const
{
unsigned int count = pages.len;
for (int i = count - 1; i >= 0; i++)
@ -666,7 +666,7 @@ struct hb_set_t
static const hb_codepoint_t INVALID = HB_SET_VALUE_INVALID;
inline page_t *page_for_insert (hb_codepoint_t g)
page_t *page_for_insert (hb_codepoint_t g)
{
page_map_t map = {get_major (g), pages.len};
unsigned int i;
@ -683,7 +683,7 @@ struct hb_set_t
}
return &pages[page_map[i].index];
}
inline page_t *page_for (hb_codepoint_t g)
page_t *page_for (hb_codepoint_t g)
{
page_map_t key = {get_major (g)};
const page_map_t *found = page_map.bsearch (key);
@ -691,7 +691,7 @@ struct hb_set_t
return &pages[found->index];
return nullptr;
}
inline const page_t *page_for (hb_codepoint_t g) const
const page_t *page_for (hb_codepoint_t g) const
{
page_map_t key = {get_major (g)};
const page_map_t *found = page_map.bsearch (key);
@ -699,10 +699,10 @@ struct hb_set_t
return &pages[found->index];
return nullptr;
}
inline page_t &page_at (unsigned int i) { return pages[page_map[i].index]; }
inline const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
inline unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
inline hb_codepoint_t major_start (unsigned int major) const { return major * page_t::PAGE_BITS; }
page_t &page_at (unsigned int i) { return pages[page_map[i].index]; }
const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
hb_codepoint_t major_start (unsigned int major) const { return major * page_t::PAGE_BITS; }
};

View File

@ -57,7 +57,7 @@ static const char *nil_shaper_list[] = {nullptr};
static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
hb_shaper_list_lazy_loader_t>
{
static inline const char ** create (void)
static const char ** create (void)
{
const char **shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *));
if (unlikely (!shaper_list))
@ -75,14 +75,10 @@ static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
return shaper_list;
}
static inline void destroy (const char **l)
{
free (l);
}
static inline const char ** get_null (void)
{
return nil_shaper_list;
}
static void destroy (const char **l)
{ free (l); }
static const char ** get_null (void)
{ return nil_shaper_list; }
} static_shaper_list;
#if HB_USE_ATEXIT

View File

@ -42,7 +42,7 @@ static void free_static_shapers (void);
static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_t,
hb_shapers_lazy_loader_t>
{
static inline hb_shaper_entry_t *create (void)
static hb_shaper_entry_t *create (void)
{
char *env = getenv ("HB_SHAPER_LIST");
if (!env || !*env)
@ -86,14 +86,10 @@ static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_
return shapers;
}
static inline void destroy (const hb_shaper_entry_t *p)
{
free ((void *) p);
}
static inline const hb_shaper_entry_t *get_null (void)
{
return all_shapers;
}
static void destroy (const hb_shaper_entry_t *p)
{ free ((void *) p); }
static const hb_shaper_entry_t *get_null (void)
{ return all_shapers; }
} static_shapers;
#if HB_USE_ATEXIT

View File

@ -96,10 +96,10 @@ template <enum hb_shaper_order_t order, typename Object> struct hb_shaper_object
hb_##object##_t, WheresData> \
{ \
typedef HB_SHAPER_DATA_TYPE(shaper, object) Type; \
static inline Type* create (hb_##object##_t *data) \
static Type* create (hb_##object##_t *data) \
{ return HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (data); } \
static inline Type *get_null (void) { return nullptr; } \
static inline void destroy (Type *p) { HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (p); } \
static Type *get_null (void) { return nullptr; } \
static void destroy (Type *p) { HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (p); } \
}; \
\
static_assert (true, "") /* Require semicolon. */
@ -108,14 +108,14 @@ template <enum hb_shaper_order_t order, typename Object> struct hb_shaper_object
template <typename Object>
struct hb_shaper_object_dataset_t
{
inline void init0 (Object *parent_data)
void init0 (Object *parent_data)
{
this->parent_data = parent_data;
#define HB_SHAPER_IMPLEMENT(shaper) shaper.init0 ();
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
}
inline void fini (void)
void fini (void)
{
#define HB_SHAPER_IMPLEMENT(shaper) shaper.fini ();
#include "hb-shaper-list.hh"

View File

@ -37,22 +37,22 @@ namespace CFF {
/* Used for writing a temporary charstring */
struct StrEncoder
{
inline StrEncoder (StrBuff &buff_)
StrEncoder (StrBuff &buff_)
: buff (buff_), error (false)
{}
inline void reset (void)
void reset (void)
{
buff.resize (0);
}
inline void encode_byte (unsigned char b)
void encode_byte (unsigned char b)
{
if (unlikely (buff.push ((const char)b) == &Crap(char)))
set_error ();
}
inline void encode_int (int v)
void encode_int (int v)
{
if ((-1131 <= v) && (v <= 1131))
{
@ -83,7 +83,7 @@ struct StrEncoder
}
}
inline void encode_num (const Number& n)
void encode_num (const Number& n)
{
if (n.in_int_range ())
{
@ -100,7 +100,7 @@ struct StrEncoder
}
}
inline void encode_op (OpCode op)
void encode_op (OpCode op)
{
if (Is_OpCode_ESC (op))
{
@ -111,7 +111,7 @@ struct StrEncoder
encode_byte (op);
}
inline void copy_str (const ByteStr &str)
void copy_str (const ByteStr &str)
{
unsigned int offset = buff.len;
buff.resize (offset + str.len);
@ -123,17 +123,17 @@ struct StrEncoder
memcpy (&buff[offset], &str.str[0], str.len);
}
inline bool is_error (void) const { return error; }
bool is_error (void) const { return error; }
protected:
inline void set_error (void) { error = true; }
void set_error (void) { error = true; }
StrBuff &buff;
bool error;
};
struct CFFSubTableOffsets {
inline CFFSubTableOffsets (void)
CFFSubTableOffsets (void)
: privateDictsOffset (0)
{
@ -145,7 +145,7 @@ struct CFFSubTableOffsets {
localSubrsInfos.init ();
}
inline ~CFFSubTableOffsets (void)
~CFFSubTableOffsets (void)
{
localSubrsInfos.fini ();
}
@ -162,9 +162,9 @@ struct CFFSubTableOffsets {
template <typename OPSTR=OpStr>
struct CFFTopDict_OpSerializer : OpSerializer
{
inline bool serialize (hb_serialize_context_t *c,
const OPSTR &opstr,
const CFFSubTableOffsets &offsets) const
bool serialize (hb_serialize_context_t *c,
const OPSTR &opstr,
const CFFSubTableOffsets &offsets) const
{
TRACE_SERIALIZE (this);
@ -185,7 +185,7 @@ struct CFFTopDict_OpSerializer : OpSerializer
return_trace (true);
}
inline unsigned int calculate_serialized_size (const OPSTR &opstr) const
unsigned int calculate_serialized_size (const OPSTR &opstr) const
{
switch (opstr.op)
{
@ -202,9 +202,9 @@ struct CFFTopDict_OpSerializer : OpSerializer
struct CFFFontDict_OpSerializer : OpSerializer
{
inline bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const TableInfo &privateDictInfo) const
bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const TableInfo &privateDictInfo) const
{
TRACE_SERIALIZE (this);
@ -231,7 +231,7 @@ struct CFFFontDict_OpSerializer : OpSerializer
return_trace (true);
}
inline unsigned int calculate_serialized_size (const OpStr &opstr) const
unsigned int calculate_serialized_size (const OpStr &opstr) const
{
if (opstr.op == OpCode_Private)
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Private);
@ -242,12 +242,12 @@ struct CFFFontDict_OpSerializer : OpSerializer
struct CFFPrivateDict_OpSerializer : OpSerializer
{
inline CFFPrivateDict_OpSerializer (bool desubroutinize_, bool drop_hints_)
CFFPrivateDict_OpSerializer (bool desubroutinize_, bool drop_hints_)
: desubroutinize (desubroutinize_), drop_hints (drop_hints_) {}
inline bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const unsigned int subrsOffset) const
bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const unsigned int subrsOffset) const
{
TRACE_SERIALIZE (this);
@ -264,8 +264,8 @@ struct CFFPrivateDict_OpSerializer : OpSerializer
return_trace (copy_opstr (c, opstr));
}
inline unsigned int calculate_serialized_size (const OpStr &opstr,
bool has_localsubr=true) const
unsigned int calculate_serialized_size (const OpStr &opstr,
bool has_localsubr=true) const
{
if (drop_hints && DictOpSet::is_hint_op (opstr.op))
return 0;
@ -294,7 +294,7 @@ struct FlattenParam
template <typename ACC, typename ENV, typename OPSET>
struct SubrFlattener
{
inline SubrFlattener (const ACC &acc_,
SubrFlattener (const ACC &acc_,
const hb_vector_t<hb_codepoint_t> &glyphs_,
bool drop_hints_)
: acc (acc_),
@ -302,7 +302,7 @@ struct SubrFlattener
drop_hints (drop_hints_)
{}
inline bool flatten (StrBuffArray &flat_charstrings)
bool flatten (StrBuffArray &flat_charstrings)
{
if (!flat_charstrings.resize (glyphs.len))
return false;
@ -331,14 +331,14 @@ struct SubrFlattener
struct SubrClosures
{
inline SubrClosures (void)
SubrClosures (void)
: valid (false),
global_closure (nullptr)
{
local_closures.init ();
}
inline void init (unsigned int fd_count)
void init (unsigned int fd_count)
{
valid = true;
global_closure = hb_set_create ();
@ -355,7 +355,7 @@ struct SubrClosures
}
}
inline void fini (void)
void fini (void)
{
hb_set_destroy (global_closure);
for (unsigned int i = 0; i < local_closures.len; i++)
@ -363,7 +363,7 @@ struct SubrClosures
local_closures.fini ();
}
inline void reset (void)
void reset (void)
{
hb_set_clear (global_closure);
for (unsigned int i = 0; i < local_closures.len; i++)
@ -378,7 +378,7 @@ struct SubrClosures
struct ParsedCSOp : OpStr
{
inline void init (unsigned int subr_num_ = 0)
void init (unsigned int subr_num_ = 0)
{
OpStr::init ();
subr_num = subr_num_;
@ -387,17 +387,17 @@ struct ParsedCSOp : OpStr
skip_flag = false;
}
inline void fini (void)
void fini (void)
{
OpStr::fini ();
}
inline bool for_drop (void) const { return drop_flag; }
inline void set_drop (void) { if (!for_keep ()) drop_flag = true; }
inline bool for_keep (void) const { return keep_flag; }
inline void set_keep (void) { keep_flag = true; }
inline bool for_skip (void) const { return skip_flag; }
inline void set_skip (void) { skip_flag = true; }
bool for_drop (void) const { return drop_flag; }
void set_drop (void) { if (!for_keep ()) drop_flag = true; }
bool for_keep (void) const { return keep_flag; }
void set_keep (void) { keep_flag = true; }
bool for_skip (void) const { return skip_flag; }
void set_skip (void) { skip_flag = true; }
unsigned int subr_num;
@ -409,7 +409,7 @@ struct ParsedCSOp : OpStr
struct ParsedCStr : ParsedValues<ParsedCSOp>
{
inline void init (void)
void init (void)
{
SUPER::init ();
parsed = false;
@ -417,13 +417,13 @@ struct ParsedCStr : ParsedValues<ParsedCSOp>
has_prefix_ = false;
}
inline void add_op (OpCode op, const SubByteStr& substr)
void add_op (OpCode op, const SubByteStr& substr)
{
if (!is_parsed ())
SUPER::add_op (op, substr);
}
inline void add_call_op (OpCode op, const SubByteStr& substr, unsigned int subr_num)
void add_call_op (OpCode op, const SubByteStr& substr, unsigned int subr_num)
{
if (!is_parsed ())
{
@ -437,28 +437,28 @@ struct ParsedCStr : ParsedValues<ParsedCSOp>
}
}
inline void set_prefix (const Number &num, OpCode op = OpCode_Invalid)
void set_prefix (const Number &num, OpCode op = OpCode_Invalid)
{
has_prefix_ = true;
prefix_op_ = op;
prefix_num_ = num;
}
inline bool at_end (unsigned int pos) const
bool at_end (unsigned int pos) const
{
return ((pos + 1 >= values.len) /* CFF2 */
|| (values[pos + 1].op == OpCode_return));
}
inline bool is_parsed (void) const { return parsed; }
inline void set_parsed (void) { parsed = true; }
inline bool is_hint_dropped (void) const { return hint_dropped; }
inline void set_hint_dropped (void) { hint_dropped = true; }
inline bool is_vsindex_dropped (void) const { return vsindex_dropped; }
inline void set_vsindex_dropped (void) { vsindex_dropped = true; }
inline bool has_prefix (void) const { return has_prefix_; }
inline OpCode prefix_op (void) const { return prefix_op_; }
inline const Number &prefix_num (void) const { return prefix_num_; }
bool is_parsed (void) const { return parsed; }
void set_parsed (void) { parsed = true; }
bool is_hint_dropped (void) const { return hint_dropped; }
void set_hint_dropped (void) { hint_dropped = true; }
bool is_vsindex_dropped (void) const { return vsindex_dropped; }
void set_vsindex_dropped (void) { vsindex_dropped = true; }
bool has_prefix (void) const { return has_prefix_; }
OpCode prefix_op (void) const { return prefix_op_; }
const Number &prefix_num (void) const { return prefix_num_; }
protected:
bool parsed;
@ -474,18 +474,14 @@ struct ParsedCStr : ParsedValues<ParsedCSOp>
struct ParsedCStrs : hb_vector_t<ParsedCStr>
{
inline void init (unsigned int len_ = 0)
void init (unsigned int len_ = 0)
{
SUPER::init ();
resize (len_);
for (unsigned int i = 0; i < len; i++)
(*this)[i].init ();
}
inline void fini (void)
{
SUPER::fini_deep ();
}
void fini (void) { SUPER::fini_deep (); }
private:
typedef hb_vector_t<ParsedCStr> SUPER;
@ -493,7 +489,7 @@ struct ParsedCStrs : hb_vector_t<ParsedCStr>
struct SubrSubsetParam
{
inline void init (ParsedCStr *parsed_charstring_,
void init (ParsedCStr *parsed_charstring_,
ParsedCStrs *parsed_global_subrs_, ParsedCStrs *parsed_local_subrs_,
hb_set_t *global_closure_, hb_set_t *local_closure_,
bool drop_hints_)
@ -507,7 +503,7 @@ struct SubrSubsetParam
drop_hints = drop_hints_;
}
inline ParsedCStr *get_parsed_str_for_context (CallContext &context)
ParsedCStr *get_parsed_str_for_context (CallContext &context)
{
switch (context.type)
{
@ -528,7 +524,7 @@ struct SubrSubsetParam
}
template <typename ENV>
inline void set_current_str (ENV &env, bool calling)
void set_current_str (ENV &env, bool calling)
{
ParsedCStr *parsed_str = get_parsed_str_for_context (env.context);
if (likely (parsed_str != nullptr))
@ -557,7 +553,7 @@ struct SubrSubsetParam
struct SubrRemap : Remap
{
inline void create (hb_set_t *closure)
void create (hb_set_t *closure)
{
/* create a remapping of subroutine numbers from old to new.
* no optimization based on usage counts. fonttools doesn't appear doing that either.
@ -577,7 +573,7 @@ struct SubrRemap : Remap
bias = 32768;
}
inline hb_codepoint_t operator[] (unsigned int old_num) const
hb_codepoint_t operator[] (unsigned int old_num) const
{
if (old_num >= len)
return CFF_UNDEF_CODE;
@ -585,7 +581,7 @@ struct SubrRemap : Remap
return Remap::operator[] (old_num);
}
inline int biased_num (unsigned int old_num) const
int biased_num (unsigned int old_num) const
{
hb_codepoint_t new_num = (*this)[old_num];
return (int)new_num - bias;
@ -597,32 +593,29 @@ struct SubrRemap : Remap
struct SubrRemaps
{
inline SubrRemaps (void)
SubrRemaps (void)
{
global_remap.init ();
local_remaps.init ();
}
inline ~SubrRemaps (void)
{
fini ();
}
~SubrRemaps (void) { fini (); }
inline void init (unsigned int fdCount)
void init (unsigned int fdCount)
{
local_remaps.resize (fdCount);
for (unsigned int i = 0; i < fdCount; i++)
local_remaps[i].init ();
}
inline void create (SubrClosures& closures)
void create (SubrClosures& closures)
{
global_remap.create (closures.global_closure);
for (unsigned int i = 0; i < local_remaps.len; i++)
local_remaps[i].create (closures.local_closures[i]);
}
inline void fini (void)
void fini (void)
{
global_remap.fini ();
local_remaps.fini_deep ();
@ -635,14 +628,14 @@ struct SubrRemaps
template <typename SUBSETTER, typename SUBRS, typename ACC, typename ENV, typename OPSET>
struct SubrSubsetter
{
inline SubrSubsetter (void)
SubrSubsetter (void)
{
parsed_charstrings.init ();
parsed_global_subrs.init ();
parsed_local_subrs.init ();
}
inline ~SubrSubsetter (void)
~SubrSubsetter (void)
{
closures.fini ();
remaps.fini ();
@ -665,7 +658,7 @@ struct SubrSubsetter
* Assumption: a callsubr/callgsubr operator must immediately follow a (biased) subroutine number
* within the same charstring/subroutine, e.g., not split across a charstring and a subroutine.
*/
inline bool subset (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, bool drop_hints)
bool subset (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, bool drop_hints)
{
closures.init (acc.fdCount);
remaps.init (acc.fdCount);
@ -749,7 +742,7 @@ struct SubrSubsetter
return true;
}
inline bool encode_charstrings (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, StrBuffArray &buffArray) const
bool encode_charstrings (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, StrBuffArray &buffArray) const
{
if (unlikely (!buffArray.resize (glyphs.len)))
return false;
@ -764,7 +757,7 @@ struct SubrSubsetter
return true;
}
inline bool encode_subrs (const ParsedCStrs &subrs, const SubrRemap& remap, unsigned int fd, StrBuffArray &buffArray) const
bool encode_subrs (const ParsedCStrs &subrs, const SubrRemap& remap, unsigned int fd, StrBuffArray &buffArray) const
{
unsigned int count = remap.get_count ();
@ -782,12 +775,12 @@ struct SubrSubsetter
return true;
}
inline bool encode_globalsubrs (StrBuffArray &buffArray)
bool encode_globalsubrs (StrBuffArray &buffArray)
{
return encode_subrs (parsed_global_subrs, remaps.global_remap, 0, buffArray);
}
inline bool encode_localsubrs (unsigned int fd, StrBuffArray &buffArray) const
bool encode_localsubrs (unsigned int fd, StrBuffArray &buffArray) const
{
return encode_subrs (parsed_local_subrs[fd], remaps.local_remaps[fd], fd, buffArray);
}
@ -795,7 +788,7 @@ struct SubrSubsetter
protected:
struct DropHintsParam
{
inline DropHintsParam (void)
DropHintsParam (void)
: seen_moveto (false),
ends_in_hint (false),
vsindex_dropped (false) {}
@ -805,9 +798,9 @@ struct SubrSubsetter
bool vsindex_dropped;
};
inline bool drop_hints_in_subr (ParsedCStr &str, unsigned int pos,
ParsedCStrs &subrs, unsigned int subr_num,
const SubrSubsetParam &param, DropHintsParam &drop)
bool drop_hints_in_subr (ParsedCStr &str, unsigned int pos,
ParsedCStrs &subrs, unsigned int subr_num,
const SubrSubsetParam &param, DropHintsParam &drop)
{
drop.ends_in_hint = false;
bool has_hint = drop_hints_in_str (subrs[subr_num], param, drop);
@ -827,7 +820,7 @@ struct SubrSubsetter
}
/* returns true if it sees a hint op before the first moveto */
inline bool drop_hints_in_str (ParsedCStr &str, const SubrSubsetParam &param, DropHintsParam &drop)
bool drop_hints_in_str (ParsedCStr &str, const SubrSubsetParam &param, DropHintsParam &drop)
{
bool seen_hint = false;
@ -900,16 +893,16 @@ struct SubrSubsetter
return seen_hint;
}
inline void collect_subr_refs_in_subr (ParsedCStr &str, unsigned int pos,
unsigned int subr_num, ParsedCStrs &subrs,
hb_set_t *closure,
const SubrSubsetParam &param)
void collect_subr_refs_in_subr (ParsedCStr &str, unsigned int pos,
unsigned int subr_num, ParsedCStrs &subrs,
hb_set_t *closure,
const SubrSubsetParam &param)
{
hb_set_add (closure, subr_num);
collect_subr_refs_in_str (subrs[subr_num], param);
}
inline void collect_subr_refs_in_str (ParsedCStr &str, const SubrSubsetParam &param)
void collect_subr_refs_in_str (ParsedCStr &str, const SubrSubsetParam &param)
{
for (unsigned int pos = 0; pos < str.values.len; pos++)
{
@ -935,7 +928,7 @@ struct SubrSubsetter
}
}
inline bool encode_str (const ParsedCStr &str, const unsigned int fd, StrBuff &buff) const
bool encode_str (const ParsedCStr &str, const unsigned int fd, StrBuff &buff) const
{
buff.init ();
StrEncoder encoder (buff);

View File

@ -36,7 +36,7 @@ using namespace CFF;
struct RemapSID : Remap
{
inline unsigned int add (unsigned int sid)
unsigned int add (unsigned int sid)
{
if ((sid != CFF_UNDEF_SID) && !is_std_std (sid))
return offset_sid (Remap::add (unoffset_sid (sid)));
@ -44,7 +44,7 @@ struct RemapSID : Remap
return sid;
}
inline unsigned int operator[] (unsigned int sid) const
unsigned int operator[] (unsigned int sid) const
{
if (is_std_std (sid) || (sid == CFF_UNDEF_SID))
return sid;
@ -54,14 +54,14 @@ struct RemapSID : Remap
static const unsigned int num_std_strings = 391;
static inline bool is_std_std (unsigned int sid) { return sid < num_std_strings; }
static inline unsigned int offset_sid (unsigned int sid) { return sid + num_std_strings; }
static inline unsigned int unoffset_sid (unsigned int sid) { return sid - num_std_strings; }
static bool is_std_std (unsigned int sid) { return sid < num_std_strings; }
static unsigned int offset_sid (unsigned int sid) { return sid + num_std_strings; }
static unsigned int unoffset_sid (unsigned int sid) { return sid - num_std_strings; }
};
struct CFF1SubTableOffsets : CFFSubTableOffsets
{
inline CFF1SubTableOffsets (void)
CFF1SubTableOffsets (void)
: CFFSubTableOffsets (),
nameIndexOffset (0),
encodingOffset (0)
@ -81,31 +81,28 @@ struct CFF1SubTableOffsets : CFFSubTableOffsets
/* a copy of a parsed out CFF1TopDictValues augmented with additional operators */
struct CFF1TopDictValuesMod : CFF1TopDictValues
{
inline void init (const CFF1TopDictValues *base_= &Null(CFF1TopDictValues))
void init (const CFF1TopDictValues *base_= &Null(CFF1TopDictValues))
{
SUPER::init ();
base = base_;
}
inline void fini (void)
{
SUPER::fini ();
}
void fini (void) { SUPER::fini (); }
inline unsigned get_count (void) const
unsigned get_count (void) const
{
return base->get_count () + SUPER::get_count ();
}
inline const CFF1TopDictVal &get_value (unsigned int i) const
const CFF1TopDictVal &get_value (unsigned int i) const
{
if (i < base->get_count ())
return (*base)[i];
else
return SUPER::values[i - base->get_count ()];
}
inline const CFF1TopDictVal &operator [] (unsigned int i) const { return get_value (i); }
const CFF1TopDictVal &operator [] (unsigned int i) const { return get_value (i); }
inline void reassignSIDs (const RemapSID& sidmap)
void reassignSIDs (const RemapSID& sidmap)
{
for (unsigned int i = 0; i < NameDictValues::ValCount; i++)
nameSIDs[i] = sidmap[base->nameSIDs[i]];
@ -118,7 +115,7 @@ struct CFF1TopDictValuesMod : CFF1TopDictValues
struct TopDictModifiers
{
inline TopDictModifiers (const CFF1SubTableOffsets &offsets_,
TopDictModifiers (const CFF1SubTableOffsets &offsets_,
const unsigned int (&nameSIDs_)[NameDictValues::ValCount])
: offsets (offsets_),
nameSIDs (nameSIDs_)
@ -130,9 +127,9 @@ struct TopDictModifiers
struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal>
{
inline bool serialize (hb_serialize_context_t *c,
const CFF1TopDictVal &opstr,
const TopDictModifiers &mod) const
bool serialize (hb_serialize_context_t *c,
const CFF1TopDictVal &opstr,
const TopDictModifiers &mod) const
{
TRACE_SERIALIZE (this);
@ -188,7 +185,7 @@ struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal>
return_trace (true);
}
inline unsigned int calculate_serialized_size (const CFF1TopDictVal &opstr) const
unsigned int calculate_serialized_size (const CFF1TopDictVal &opstr) const
{
OpCode op = opstr.op;
switch (op)
@ -222,21 +219,21 @@ struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal>
struct FontDictValuesMod
{
inline void init (const CFF1FontDictValues *base_,
unsigned int fontName_,
const TableInfo &privateDictInfo_)
void init (const CFF1FontDictValues *base_,
unsigned int fontName_,
const TableInfo &privateDictInfo_)
{
base = base_;
fontName = fontName_;
privateDictInfo = privateDictInfo_;
}
inline unsigned get_count (void) const
unsigned get_count (void) const
{
return base->get_count ();
}
inline const OpStr &operator [] (unsigned int i) const { return (*base)[i]; }
const OpStr &operator [] (unsigned int i) const { return (*base)[i]; }
const CFF1FontDictValues *base;
TableInfo privateDictInfo;
@ -245,9 +242,9 @@ struct FontDictValuesMod
struct CFF1FontDict_OpSerializer : CFFFontDict_OpSerializer
{
inline bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const FontDictValuesMod &mod) const
bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const FontDictValuesMod &mod) const
{
TRACE_SERIALIZE (this);
@ -257,7 +254,7 @@ struct CFF1FontDict_OpSerializer : CFFFontDict_OpSerializer
return_trace (SUPER::serialize (c, opstr, mod.privateDictInfo));
}
inline unsigned int calculate_serialized_size (const OpStr &opstr) const
unsigned int calculate_serialized_size (const OpStr &opstr) const
{
if (opstr.op == OpCode_FontName)
return OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_FontName);
@ -271,7 +268,7 @@ struct CFF1FontDict_OpSerializer : CFFFontDict_OpSerializer
struct CFF1CSOpSet_Flatten : CFF1CSOpSet<CFF1CSOpSet_Flatten, FlattenParam>
{
static inline void flush_args_and_op (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param)
static void flush_args_and_op (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param)
{
if (env.arg_start > 0)
flush_width (env, param);
@ -297,7 +294,7 @@ struct CFF1CSOpSet_Flatten : CFF1CSOpSet<CFF1CSOpSet_Flatten, FlattenParam>
break;
}
}
static inline void flush_args (CFF1CSInterpEnv &env, FlattenParam& param)
static void flush_args (CFF1CSInterpEnv &env, FlattenParam& param)
{
StrEncoder encoder (param.flatStr);
for (unsigned int i = env.arg_start; i < env.argStack.get_count (); i++)
@ -305,20 +302,20 @@ struct CFF1CSOpSet_Flatten : CFF1CSOpSet<CFF1CSOpSet_Flatten, FlattenParam>
SUPER::flush_args (env, param);
}
static inline void flush_op (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param)
static void flush_op (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param)
{
StrEncoder encoder (param.flatStr);
encoder.encode_op (op);
}
static inline void flush_width (CFF1CSInterpEnv &env, FlattenParam& param)
static void flush_width (CFF1CSInterpEnv &env, FlattenParam& param)
{
assert (env.has_width);
StrEncoder encoder (param.flatStr);
encoder.encode_num (env.width);
}
static inline void flush_hintmask (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param)
static void flush_hintmask (OpCode op, CFF1CSInterpEnv &env, FlattenParam& param)
{
SUPER::flush_hintmask (op, env, param);
if (!param.drop_hints)
@ -336,7 +333,7 @@ struct CFF1CSOpSet_Flatten : CFF1CSOpSet<CFF1CSOpSet_Flatten, FlattenParam>
struct RangeList : hb_vector_t<code_pair>
{
/* replace the first glyph ID in the "glyph" field each range with a nLeft value */
inline bool finalize (unsigned int last_glyph)
bool finalize (unsigned int last_glyph)
{
bool two_byte = false;
for (unsigned int i = (*this).len; i > 0; i--)
@ -354,7 +351,7 @@ struct RangeList : hb_vector_t<code_pair>
struct CFF1CSOpSet_SubrSubset : CFF1CSOpSet<CFF1CSOpSet_SubrSubset, SubrSubsetParam>
{
static inline void process_op (OpCode op, CFF1CSInterpEnv &env, SubrSubsetParam& param)
static void process_op (OpCode op, CFF1CSInterpEnv &env, SubrSubsetParam& param)
{
switch (op) {
@ -387,9 +384,9 @@ struct CFF1CSOpSet_SubrSubset : CFF1CSOpSet<CFF1CSOpSet_SubrSubset, SubrSubsetPa
}
protected:
static inline void process_call_subr (OpCode op, CSType type,
CFF1CSInterpEnv &env, SubrSubsetParam& param,
CFF1BiasedSubrs& subrs, hb_set_t *closure)
static void process_call_subr (OpCode op, CSType type,
CFF1CSInterpEnv &env, SubrSubsetParam& param,
CFF1BiasedSubrs& subrs, hb_set_t *closure)
{
SubByteStr substr = env.substr;
env.callSubr (subrs, type);
@ -404,7 +401,7 @@ struct CFF1CSOpSet_SubrSubset : CFF1CSOpSet<CFF1CSOpSet_SubrSubset, SubrSubsetPa
struct CFF1SubrSubsetter : SubrSubsetter<CFF1SubrSubsetter, CFF1Subrs, const OT::cff1::accelerator_subset_t, CFF1CSInterpEnv, CFF1CSOpSet_SubrSubset>
{
static inline void finalize_parsed_str (CFF1CSInterpEnv &env, SubrSubsetParam& param, ParsedCStr &charstring)
static void finalize_parsed_str (CFF1CSInterpEnv &env, SubrSubsetParam& param, ParsedCStr &charstring)
{
/* insert width at the beginning of the charstring as necessary */
if (env.has_width)
@ -426,7 +423,7 @@ struct CFF1SubrSubsetter : SubrSubsetter<CFF1SubrSubsetter, CFF1Subrs, const OT:
};
struct cff_subset_plan {
inline cff_subset_plan (void)
cff_subset_plan (void)
: final_size (0),
offsets (),
orig_fdcount (0),
@ -452,7 +449,7 @@ struct cff_subset_plan {
topDictModSIDs[i] = CFF_UNDEF_SID;
}
inline ~cff_subset_plan (void)
~cff_subset_plan (void)
{
topdict_sizes.fini ();
topdict_mod.fini ();
@ -469,7 +466,7 @@ struct cff_subset_plan {
fontdicts_mod.fini ();
}
inline unsigned int plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
unsigned int plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
{
const Encoding *encoding = acc.encoding;
unsigned int size0, size1, supp_size;
@ -530,7 +527,7 @@ struct cff_subset_plan {
subset_enc_supp_codes.len);
}
inline unsigned int plan_subset_charset (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
unsigned int plan_subset_charset (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
{
unsigned int size0, size_ranges;
hb_codepoint_t sid, last_sid = CFF_UNDEF_CODE;
@ -573,7 +570,7 @@ struct cff_subset_plan {
subset_charset_format? subset_charset_ranges.len: plan->glyphs.len);
}
inline bool collect_sids_in_dicts (const OT::cff1::accelerator_subset_t &acc)
bool collect_sids_in_dicts (const OT::cff1::accelerator_subset_t &acc)
{
if (unlikely (!sidmap.reset (acc.stringIndex->count)))
return false;
@ -596,7 +593,7 @@ struct cff_subset_plan {
return true;
}
inline bool create (const OT::cff1::accelerator_subset_t &acc,
bool create (const OT::cff1::accelerator_subset_t &acc,
hb_subset_plan_t *plan)
{
/* make sure notdef is first */
@ -831,7 +828,7 @@ struct cff_subset_plan {
&& (fontdicts_mod.len == subset_fdcount));
}
inline unsigned int get_final_size (void) const { return final_size; }
unsigned int get_final_size (void) const { return final_size; }
unsigned int final_size;
hb_vector_t<unsigned int> topdict_sizes;

View File

@ -36,7 +36,7 @@ using namespace CFF;
struct CFF2SubTableOffsets : CFFSubTableOffsets
{
inline CFF2SubTableOffsets (void)
CFF2SubTableOffsets (void)
: CFFSubTableOffsets (),
varStoreOffset (0)
{}
@ -46,9 +46,9 @@ struct CFF2SubTableOffsets : CFFSubTableOffsets
struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<>
{
inline bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const CFF2SubTableOffsets &offsets) const
bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const CFF2SubTableOffsets &offsets) const
{
TRACE_SERIALIZE (this);
@ -62,7 +62,7 @@ struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<>
}
}
inline unsigned int calculate_serialized_size (const OpStr &opstr) const
unsigned int calculate_serialized_size (const OpStr &opstr) const
{
switch (opstr.op)
{
@ -77,7 +77,7 @@ struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<>
struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
{
static inline void flush_args_and_op (OpCode op, CFF2CSInterpEnv &env, FlattenParam& param)
static void flush_args_and_op (OpCode op, CFF2CSInterpEnv &env, FlattenParam& param)
{
switch (op)
{
@ -105,7 +105,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
}
}
static inline void flush_args (CFF2CSInterpEnv &env, FlattenParam& param)
static void flush_args (CFF2CSInterpEnv &env, FlattenParam& param)
{
for (unsigned int i = 0; i < env.argStack.get_count ();)
{
@ -130,7 +130,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
SUPER::flush_args (env, param);
}
static inline void flatten_blends (const BlendArg &arg, unsigned int i, CFF2CSInterpEnv &env, FlattenParam& param)
static void flatten_blends (const BlendArg &arg, unsigned int i, CFF2CSInterpEnv &env, FlattenParam& param)
{
/* flatten the default values */
StrEncoder encoder (param.flatStr);
@ -157,7 +157,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
encoder.encode_op (OpCode_blendcs);
}
static inline void flush_op (OpCode op, CFF2CSInterpEnv &env, FlattenParam& param)
static void flush_op (OpCode op, CFF2CSInterpEnv &env, FlattenParam& param)
{
switch (op)
{
@ -177,7 +177,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
struct CFF2CSOpSet_SubrSubset : CFF2CSOpSet<CFF2CSOpSet_SubrSubset, SubrSubsetParam>
{
static inline void process_op (OpCode op, CFF2CSInterpEnv &env, SubrSubsetParam& param)
static void process_op (OpCode op, CFF2CSInterpEnv &env, SubrSubsetParam& param)
{
switch (op) {
@ -208,9 +208,9 @@ struct CFF2CSOpSet_SubrSubset : CFF2CSOpSet<CFF2CSOpSet_SubrSubset, SubrSubsetPa
}
protected:
static inline void process_call_subr (OpCode op, CSType type,
CFF2CSInterpEnv &env, SubrSubsetParam& param,
CFF2BiasedSubrs& subrs, hb_set_t *closure)
static void process_call_subr (OpCode op, CSType type,
CFF2CSInterpEnv &env, SubrSubsetParam& param,
CFF2BiasedSubrs& subrs, hb_set_t *closure)
{
SubByteStr substr = env.substr;
env.callSubr (subrs, type);
@ -225,7 +225,7 @@ struct CFF2CSOpSet_SubrSubset : CFF2CSOpSet<CFF2CSOpSet_SubrSubset, SubrSubsetPa
struct CFF2SubrSubsetter : SubrSubsetter<CFF2SubrSubsetter, CFF2Subrs, const OT::cff2::accelerator_subset_t, CFF2CSInterpEnv, CFF2CSOpSet_SubrSubset>
{
static inline void finalize_parsed_str (CFF2CSInterpEnv &env, SubrSubsetParam& param, ParsedCStr &charstring)
static void finalize_parsed_str (CFF2CSInterpEnv &env, SubrSubsetParam& param, ParsedCStr &charstring)
{
/* vsindex is inserted at the beginning of the charstring as necessary */
if (env.seen_vsindex ())
@ -238,7 +238,7 @@ struct CFF2SubrSubsetter : SubrSubsetter<CFF2SubrSubsetter, CFF2Subrs, const OT:
};
struct cff2_subset_plan {
inline cff2_subset_plan (void)
cff2_subset_plan (void)
: final_size (0),
orig_fdcount (0),
subset_fdcount(1),
@ -254,7 +254,7 @@ struct cff2_subset_plan {
privateDictInfos.init ();
}
inline ~cff2_subset_plan (void)
~cff2_subset_plan (void)
{
subset_fdselect_ranges.fini ();
fdmap.fini ();
@ -264,7 +264,7 @@ struct cff2_subset_plan {
privateDictInfos.fini ();
}
inline bool create (const OT::cff2::accelerator_subset_t &acc,
bool create (const OT::cff2::accelerator_subset_t &acc,
hb_subset_plan_t *plan)
{
final_size = 0;
@ -412,7 +412,7 @@ struct cff2_subset_plan {
return true;
}
inline unsigned int get_final_size (void) const { return final_size; }
unsigned int get_final_size (void) const { return final_size; }
unsigned int final_size;
CFF2SubTableOffsets offsets;

View File

@ -55,9 +55,8 @@ struct hb_subset_plan_t
hb_face_t *source;
hb_face_t *dest;
inline bool
new_gid_for_codepoint (hb_codepoint_t codepoint,
hb_codepoint_t *new_gid) const
bool new_gid_for_codepoint (hb_codepoint_t codepoint,
hb_codepoint_t *new_gid) const
{
hb_codepoint_t old_gid = codepoint_to_glyph->get (codepoint);
if (old_gid == HB_MAP_VALUE_INVALID)
@ -66,9 +65,8 @@ struct hb_subset_plan_t
return new_gid_for_old_gid (old_gid, new_gid);
}
inline bool
new_gid_for_old_gid (hb_codepoint_t old_gid,
hb_codepoint_t *new_gid) const
bool new_gid_for_old_gid (hb_codepoint_t old_gid,
hb_codepoint_t *new_gid) const
{
hb_codepoint_t gid = glyph_map->get (old_gid);
if (gid == HB_MAP_VALUE_INVALID)
@ -78,7 +76,7 @@ struct hb_subset_plan_t
return true;
}
inline bool
bool
add_table (hb_tag_t tag,
hb_blob_t *contents)
{

View File

@ -39,9 +39,9 @@
struct hb_subset_context_t :
hb_dispatch_context_t<hb_subset_context_t, bool, HB_DEBUG_SUBSET>
{
inline const char *get_name (void) { return "SUBSET"; }
const char *get_name (void) { return "SUBSET"; }
template <typename T>
inline bool dispatch (const T &obj) { return obj.subset (this); }
bool dispatch (const T &obj) { return obj.subset (this); }
static bool default_return_value (void) { return true; }
hb_subset_plan_t *plan;

View File

@ -228,7 +228,7 @@ static void free_static_ucdn_funcs (void);
static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_ucdn_unicode_funcs_lazy_loader_t>
{
static inline hb_unicode_funcs_t *create (void)
static hb_unicode_funcs_t *create (void)
{
hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);

View File

@ -67,27 +67,27 @@ struct hb_unicode_funcs_t
hb_unicode_funcs_t *parent;
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name) \
inline return_type name (hb_codepoint_t unicode) { return func.name (this, unicode, user_data.name); }
return_type name (hb_codepoint_t unicode) { return func.name (this, unicode, user_data.name); }
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
#undef HB_UNICODE_FUNC_IMPLEMENT
inline hb_bool_t compose (hb_codepoint_t a, hb_codepoint_t b,
hb_codepoint_t *ab)
hb_bool_t compose (hb_codepoint_t a, hb_codepoint_t b,
hb_codepoint_t *ab)
{
*ab = 0;
if (unlikely (!a || !b)) return false;
return func.compose (this, a, b, ab, user_data.compose);
}
inline hb_bool_t decompose (hb_codepoint_t ab,
hb_codepoint_t *a, hb_codepoint_t *b)
hb_bool_t decompose (hb_codepoint_t ab,
hb_codepoint_t *a, hb_codepoint_t *b)
{
*a = ab; *b = 0;
return func.decompose (this, ab, a, b, user_data.decompose);
}
inline unsigned int decompose_compatibility (hb_codepoint_t u,
hb_codepoint_t *decomposed)
unsigned int decompose_compatibility (hb_codepoint_t u,
hb_codepoint_t *decomposed)
{
unsigned int ret = func.decompose_compatibility (this, u, decomposed, user_data.decompose_compatibility);
if (ret == 1 && u == decomposed[0]) {
@ -98,7 +98,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
return ret;
}
inline unsigned int
unsigned int
modified_combining_class (hb_codepoint_t u)
{
/* XXX This hack belongs to the Myanmar shaper. */
@ -117,14 +117,14 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
return _hb_modified_combining_class[combining_class (u)];
}
static inline hb_bool_t
static hb_bool_t
is_variation_selector (hb_codepoint_t unicode)
{
/* U+180B..180D MONGOLIAN FREE VARIATION SELECTORs are handled in the
* Arabic shaper. No need to match them here. */
return unlikely (hb_in_ranges<hb_codepoint_t> (unicode,
0xFE00u, 0xFE0Fu, /* VARIATION SELECTOR-1..16 */
0xE0100u, 0xE01EFu)); /* VARIATION SELECTOR-17..256 */
0xFE00u, 0xFE0Fu, /* VARIATION SELECTOR-1..16 */
0xE0100u, 0xE01EFu)); /* VARIATION SELECTOR-17..256 */
}
/* Default_Ignorable codepoints:
@ -164,7 +164,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
* E0100..E01EF # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256
* E01F0..E0FFF # Cn [3600] <reserved-E01F0>..<reserved-E0FFF>
*/
static inline hb_bool_t
static hb_bool_t
is_default_ignorable (hb_codepoint_t ch)
{
hb_codepoint_t plane = ch >> 16;
@ -216,7 +216,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
SPACE_PUNCTUATION,
SPACE_NARROW,
};
static inline space_t
static space_t
space_fallback_type (hb_codepoint_t u)
{
switch (u)

View File

@ -205,7 +205,7 @@ struct hb_uniscribe_shaper_funcs_t
SSOT ScriptShapeOpenType;
SPOT ScriptPlaceOpenType;
inline void init (void)
void init (void)
{
HMODULE hinstLib;
this->ScriptItemizeOpenType = nullptr;
@ -237,7 +237,7 @@ static void free_static_uniscribe_shaper_funcs (void);
static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t<hb_uniscribe_shaper_funcs_t,
hb_uniscribe_shaper_funcs_lazy_loader_t>
{
static inline hb_uniscribe_shaper_funcs_t *create (void)
static hb_uniscribe_shaper_funcs_t *create (void)
{
hb_uniscribe_shaper_funcs_t *funcs = (hb_uniscribe_shaper_funcs_t *) calloc (1, sizeof (hb_uniscribe_shaper_funcs_t));
if (unlikely (!funcs))
@ -251,11 +251,11 @@ static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unis
return funcs;
}
static inline void destroy (hb_uniscribe_shaper_funcs_t *p)
static void destroy (hb_uniscribe_shaper_funcs_t *p)
{
free ((void *) p);
}
static inline hb_uniscribe_shaper_funcs_t *get_null (void)
static hb_uniscribe_shaper_funcs_t *get_null (void)
{
return nullptr;
}
@ -288,9 +288,8 @@ struct active_feature_t {
a->rec.lParameter < b->rec.lParameter ? -1 : a->rec.lParameter > b->rec.lParameter ? 1 :
0;
}
bool operator== (const active_feature_t *f) {
return cmp (this, f) == 0;
}
bool operator== (const active_feature_t *f)
{ return cmp (this, f) == 0; }
};
struct feature_event_t {
@ -298,7 +297,8 @@ struct feature_event_t {
bool start;
active_feature_t feature;
static int cmp (const void *pa, const void *pb) {
static int cmp (const void *pa, const void *pb)
{
const feature_event_t *a = (const feature_event_t *) pa;
const feature_event_t *b = (const feature_event_t *) pb;
return a->index < b->index ? -1 : a->index > b->index ? 1 :

View File

@ -36,7 +36,7 @@ struct hb_utf8_t
{
typedef uint8_t codepoint_t;
static inline const codepoint_t *
static const codepoint_t *
next (const codepoint_t *text,
const codepoint_t *end,
hb_codepoint_t *unicode,
@ -105,7 +105,7 @@ struct hb_utf8_t
return text;
}
static inline const codepoint_t *
static const codepoint_t *
prev (const codepoint_t *text,
const codepoint_t *start,
hb_codepoint_t *unicode,
@ -122,13 +122,11 @@ struct hb_utf8_t
return end - 1;
}
static inline unsigned int
static unsigned int
strlen (const codepoint_t *text)
{
return ::strlen ((const char *) text);
}
{ return ::strlen ((const char *) text); }
static inline unsigned int
static unsigned int
encode_len (hb_codepoint_t unicode)
{
if (unicode < 0x0080u) return 1;
@ -138,7 +136,7 @@ struct hb_utf8_t
return 3;
}
static inline codepoint_t *
static codepoint_t *
encode (codepoint_t *text,
const codepoint_t *end,
hb_codepoint_t unicode)
@ -185,7 +183,7 @@ struct hb_utf16_xe_t
static_assert (sizeof (TCodepoint) == 2, "");
typedef TCodepoint codepoint_t;
static inline const codepoint_t *
static const codepoint_t *
next (const codepoint_t *text,
const codepoint_t *end,
hb_codepoint_t *unicode,
@ -217,7 +215,7 @@ struct hb_utf16_xe_t
return text;
}
static inline const codepoint_t *
static const codepoint_t *
prev (const codepoint_t *text,
const codepoint_t *start,
hb_codepoint_t *unicode,
@ -250,7 +248,7 @@ struct hb_utf16_xe_t
}
static inline unsigned int
static unsigned int
strlen (const codepoint_t *text)
{
unsigned int l = 0;
@ -258,13 +256,13 @@ struct hb_utf16_xe_t
return l;
}
static inline unsigned int
static unsigned int
encode_len (hb_codepoint_t unicode)
{
return unicode < 0x10000 ? 1 : 2;
}
static inline codepoint_t *
static codepoint_t *
encode (codepoint_t *text,
const codepoint_t *end,
hb_codepoint_t unicode)
@ -293,7 +291,7 @@ struct hb_utf32_xe_t
static_assert (sizeof (TCodepoint) == 4, "");
typedef TCodepoint codepoint_t;
static inline const TCodepoint *
static const TCodepoint *
next (const TCodepoint *text,
const TCodepoint *end HB_UNUSED,
hb_codepoint_t *unicode,
@ -305,7 +303,7 @@ struct hb_utf32_xe_t
return text;
}
static inline const TCodepoint *
static const TCodepoint *
prev (const TCodepoint *text,
const TCodepoint *start HB_UNUSED,
hb_codepoint_t *unicode,
@ -317,7 +315,7 @@ struct hb_utf32_xe_t
return text;
}
static inline unsigned int
static unsigned int
strlen (const TCodepoint *text)
{
unsigned int l = 0;
@ -325,13 +323,13 @@ struct hb_utf32_xe_t
return l;
}
static inline unsigned int
static unsigned int
encode_len (hb_codepoint_t unicode HB_UNUSED)
{
return 1;
}
static inline codepoint_t *
static codepoint_t *
encode (codepoint_t *text,
const codepoint_t *end HB_UNUSED,
hb_codepoint_t unicode)
@ -351,7 +349,7 @@ struct hb_latin1_t
{
typedef uint8_t codepoint_t;
static inline const codepoint_t *
static const codepoint_t *
next (const codepoint_t *text,
const codepoint_t *end HB_UNUSED,
hb_codepoint_t *unicode,
@ -361,7 +359,7 @@ struct hb_latin1_t
return text;
}
static inline const codepoint_t *
static const codepoint_t *
prev (const codepoint_t *text,
const codepoint_t *start HB_UNUSED,
hb_codepoint_t *unicode,
@ -371,7 +369,7 @@ struct hb_latin1_t
return text;
}
static inline unsigned int
static unsigned int
strlen (const codepoint_t *text)
{
unsigned int l = 0;
@ -379,13 +377,13 @@ struct hb_latin1_t
return l;
}
static inline unsigned int
static unsigned int
encode_len (hb_codepoint_t unicode HB_UNUSED)
{
return 1;
}
static inline codepoint_t *
static codepoint_t *
encode (codepoint_t *text,
const codepoint_t *end HB_UNUSED,
hb_codepoint_t unicode)
@ -402,7 +400,7 @@ struct hb_ascii_t
{
typedef uint8_t codepoint_t;
static inline const codepoint_t *
static const codepoint_t *
next (const codepoint_t *text,
const codepoint_t *end HB_UNUSED,
hb_codepoint_t *unicode,
@ -414,7 +412,7 @@ struct hb_ascii_t
return text;
}
static inline const codepoint_t *
static const codepoint_t *
prev (const codepoint_t *text,
const codepoint_t *start HB_UNUSED,
hb_codepoint_t *unicode,
@ -426,7 +424,7 @@ struct hb_ascii_t
return text;
}
static inline unsigned int
static unsigned int
strlen (const codepoint_t *text)
{
unsigned int l = 0;
@ -434,13 +432,13 @@ struct hb_ascii_t
return l;
}
static inline unsigned int
static unsigned int
encode_len (hb_codepoint_t unicode HB_UNUSED)
{
return 1;
}
static inline codepoint_t *
static codepoint_t *
encode (codepoint_t *text,
const codepoint_t *end HB_UNUSED,
hb_codepoint_t unicode)

View File

@ -40,8 +40,8 @@ struct hb_vector_t
enum { item_size = sizeof (Type) };
HB_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, PreallocedCount);
inline hb_vector_t (void) { init (); }
inline ~hb_vector_t (void) { fini (); }
hb_vector_t (void) { init (); }
~hb_vector_t (void) { fini (); }
unsigned int len;
private:
@ -57,14 +57,14 @@ struct hb_vector_t
arrayZ_ = nullptr;
}
inline void fini (void)
void fini (void)
{
if (arrayZ_)
free (arrayZ_);
arrayZ_ = nullptr;
allocated = len = 0;
}
inline void fini_deep (void)
void fini_deep (void)
{
Type *array = arrayZ();
unsigned int count = len;
@ -73,19 +73,19 @@ struct hb_vector_t
fini ();
}
inline Type * arrayZ (void)
Type * arrayZ (void)
{ return arrayZ_ ? arrayZ_ : static_array; }
inline const Type * arrayZ (void) const
const Type * arrayZ (void) const
{ return arrayZ_ ? arrayZ_ : static_array; }
inline Type& operator [] (int i_)
Type& operator [] (int i_)
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= len))
return Crap (Type);
return arrayZ()[i];
}
inline const Type& operator [] (int i_) const
const Type& operator [] (int i_) const
{
unsigned int i = (unsigned int) i_;
if (unlikely (i >= len))
@ -93,59 +93,59 @@ struct hb_vector_t
return arrayZ()[i];
}
inline hb_array_t<Type> as_array (void)
hb_array_t<Type> as_array (void)
{ return hb_array (arrayZ(), len); }
inline hb_array_t<const Type> as_array (void) const
hb_array_t<const Type> as_array (void) const
{ return hb_array (arrayZ(), len); }
inline hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const
hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count)
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count)
{ return as_array ().sub_array (start_offset, count);}
inline hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
{ return as_array ().sub_array (start_offset, count);}
inline hb_sorted_array_t<Type> as_sorted_array (void)
hb_sorted_array_t<Type> as_sorted_array (void)
{ return hb_sorted_array (arrayZ(), len); }
inline hb_sorted_array_t<const Type> as_sorted_array (void) const
hb_sorted_array_t<const Type> as_sorted_array (void) const
{ return hb_sorted_array (arrayZ(), len); }
inline hb_array_t<const Type> sorted_sub_array (unsigned int start_offset, unsigned int count) const
hb_array_t<const Type> sorted_sub_array (unsigned int start_offset, unsigned int count) const
{ return as_sorted_array ().sorted_sub_array (start_offset, count);}
inline hb_array_t<const Type> sorted_sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
hb_array_t<const Type> sorted_sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const
{ return as_sorted_array ().sorted_sub_array (start_offset, count);}
inline hb_array_t<Type> sorted_sub_array (unsigned int start_offset, unsigned int count)
hb_array_t<Type> sorted_sub_array (unsigned int start_offset, unsigned int count)
{ return as_sorted_array ().sorted_sub_array (start_offset, count);}
inline hb_array_t<Type> sorted_sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
hb_array_t<Type> sorted_sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */)
{ return as_sorted_array ().sorted_sub_array (start_offset, count);}
template <typename T> explicit_operator inline operator T * (void) { return arrayZ(); }
template <typename T> explicit_operator inline operator const T * (void) const { return arrayZ(); }
inline operator hb_array_t<Type> (void) { return as_array (); }
inline operator hb_array_t<const Type> (void) const { as_array (); }
template <typename T> explicit_operator operator T * (void) { return arrayZ(); }
template <typename T> explicit_operator operator const T * (void) const { return arrayZ(); }
operator hb_array_t<Type> (void) { return as_array (); }
operator hb_array_t<const Type> (void) const { as_array (); }
inline Type * operator + (unsigned int i) { return arrayZ() + i; }
inline const Type * operator + (unsigned int i) const { return arrayZ() + i; }
Type * operator + (unsigned int i) { return arrayZ() + i; }
const Type * operator + (unsigned int i) const { return arrayZ() + i; }
inline Type *push (void)
Type *push (void)
{
if (unlikely (!resize (len + 1)))
return &Crap(Type);
return &arrayZ()[len - 1];
}
inline Type *push (const Type& v)
Type *push (const Type& v)
{
Type *p = push ();
*p = v;
return p;
}
inline bool in_error (void) const { return allocated == 0; }
bool in_error (void) const { return allocated == 0; }
/* Allocate for size but don't adjust len. */
inline bool alloc (unsigned int size)
bool alloc (unsigned int size)
{
if (unlikely (!allocated))
return false;
@ -186,7 +186,7 @@ struct hb_vector_t
return true;
}
inline bool resize (int size_)
bool resize (int size_)
{
unsigned int size = size_ < 0 ? 0u : (unsigned int) size_;
if (!alloc (size))
@ -199,13 +199,13 @@ struct hb_vector_t
return true;
}
inline void pop (void)
void pop (void)
{
if (!len) return;
len--;
}
inline void remove (unsigned int i)
void remove (unsigned int i)
{
if (unlikely (i >= len))
return;
@ -216,7 +216,7 @@ struct hb_vector_t
len--;
}
inline void shrink (int size_)
void shrink (int size_)
{
unsigned int size = size_ < 0 ? 0u : (unsigned int) size_;
if (size < len)
@ -224,7 +224,7 @@ struct hb_vector_t
}
template <typename T>
inline Type *find (T v)
Type *find (T v)
{
Type *array = arrayZ();
for (unsigned int i = 0; i < len; i++)
@ -233,7 +233,7 @@ struct hb_vector_t
return nullptr;
}
template <typename T>
inline const Type *find (T v) const
const Type *find (T v) const
{
const Type *array = arrayZ();
for (unsigned int i = 0; i < len; i++)
@ -242,26 +242,26 @@ struct hb_vector_t
return nullptr;
}
inline void qsort (int (*cmp)(const void*, const void*))
void qsort (int (*cmp)(const void*, const void*))
{ as_array ().qsort (cmp); }
inline void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1)
void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1)
{ as_array ().qsort (start, end); }
template <typename T>
inline Type *lsearch (const T &x, Type *not_found = nullptr)
Type *lsearch (const T &x, Type *not_found = nullptr)
{ return as_array ().lsearch (x, not_found); }
template <typename T>
inline const Type *lsearch (const T &x, const Type *not_found = nullptr) const
const Type *lsearch (const T &x, const Type *not_found = nullptr) const
{ return as_array ().lsearch (x, not_found); }
template <typename T>
inline Type *bsearch (const T &x, Type *not_found = nullptr)
Type *bsearch (const T &x, Type *not_found = nullptr)
{ return as_sorted_array ().bsearch (x, not_found); }
template <typename T>
inline const Type *bsearch (const T &x, const Type *not_found = nullptr) const
const Type *bsearch (const T &x, const Type *not_found = nullptr) const
{ return as_sorted_array ().bsearch (x, not_found); }
template <typename T>
inline bool bfind (const T &x, unsigned int *i = nullptr,
bool bfind (const T &x, unsigned int *i = nullptr,
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{ return as_sorted_array ().bfind (x, i, not_found, to_store); }