s/\<context\>/c/g
This commit is contained in:
parent
f679635893
commit
d7cfb3b2d1
|
@ -48,9 +48,9 @@ struct TTCHeader;
|
||||||
|
|
||||||
typedef struct TableDirectory
|
typedef struct TableDirectory
|
||||||
{
|
{
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag tag; /* 4-byte identifier. */
|
Tag tag; /* 4-byte identifier. */
|
||||||
|
@ -98,10 +98,10 @@ typedef struct OffsetTable
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& context->check_array (tableDir, TableDirectory::static_size, numTables);
|
&& c->check_array (tableDir, TableDirectory::static_size, numTables);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -127,9 +127,9 @@ struct TTCHeaderVersion1
|
||||||
inline unsigned int get_face_count (void) const { return table.len; }
|
inline unsigned int get_face_count (void) const { return table.len; }
|
||||||
inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
|
inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return table.sanitize (context, this);
|
return table.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -166,12 +166,12 @@ struct TTCHeader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!u.header.version.sanitize (context))) return false;
|
if (unlikely (!u.header.version.sanitize (c))) return false;
|
||||||
switch (u.header.version) {
|
switch (u.header.version) {
|
||||||
case 2: /* version 2 is compatible with version 1 */
|
case 2: /* version 2 is compatible with version 1 */
|
||||||
case 1: return u.version1.sanitize (context);
|
case 1: return u.version1.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,15 +228,15 @@ struct OpenTypeFontFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!u.tag.sanitize (context))) return false;
|
if (unlikely (!u.tag.sanitize (c))) return false;
|
||||||
switch (u.tag) {
|
switch (u.tag) {
|
||||||
case CFFTag: /* All the non-collection tags */
|
case CFFTag: /* All the non-collection tags */
|
||||||
case TrueTag:
|
case TrueTag:
|
||||||
case Typ1Tag:
|
case Typ1Tag:
|
||||||
case TrueTypeTag: return u.fontFace.sanitize (context);
|
case TrueTypeTag: return u.fontFace.sanitize (c);
|
||||||
case TTCTag: return u.ttcHeader.sanitize (context);
|
case TTCTag: return u.ttcHeader.sanitize (c);
|
||||||
default: return true;
|
default: return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ struct hb_trace_t<0> {
|
||||||
|
|
||||||
|
|
||||||
#define TRACE_SANITIZE() \
|
#define TRACE_SANITIZE() \
|
||||||
hb_trace_t<HB_DEBUG_SANITIZE> trace (&context->debug_depth, "SANITIZE", HB_FUNC, this); \
|
hb_trace_t<HB_DEBUG_SANITIZE> trace (&c->debug_depth, "SANITIZE", HB_FUNC, this); \
|
||||||
|
|
||||||
|
|
||||||
struct hb_sanitize_context_t
|
struct hb_sanitize_context_t
|
||||||
|
@ -278,7 +278,7 @@ template <typename Type>
|
||||||
struct Sanitizer
|
struct Sanitizer
|
||||||
{
|
{
|
||||||
static hb_blob_t *sanitize (hb_blob_t *blob) {
|
static hb_blob_t *sanitize (hb_blob_t *blob) {
|
||||||
hb_sanitize_context_t context[1] = {{0}};
|
hb_sanitize_context_t c[1] = {{0}};
|
||||||
bool sane;
|
bool sane;
|
||||||
|
|
||||||
/* TODO is_sane() stuff */
|
/* TODO is_sane() stuff */
|
||||||
|
@ -287,36 +287,36 @@ struct Sanitizer
|
||||||
if (HB_DEBUG_SANITIZE)
|
if (HB_DEBUG_SANITIZE)
|
||||||
fprintf (stderr, "Sanitizer %p start %s\n", blob, HB_FUNC);
|
fprintf (stderr, "Sanitizer %p start %s\n", blob, HB_FUNC);
|
||||||
|
|
||||||
context->init (blob);
|
c->init (blob);
|
||||||
|
|
||||||
if (unlikely (!context->start)) {
|
if (unlikely (!c->start)) {
|
||||||
context->finish ();
|
c->finish ();
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type *t = CastP<Type> (const_cast<char *> (context->start));
|
Type *t = CastP<Type> (const_cast<char *> (c->start));
|
||||||
|
|
||||||
sane = t->sanitize (context);
|
sane = t->sanitize (c);
|
||||||
if (sane) {
|
if (sane) {
|
||||||
if (context->edit_count) {
|
if (c->edit_count) {
|
||||||
if (HB_DEBUG_SANITIZE)
|
if (HB_DEBUG_SANITIZE)
|
||||||
fprintf (stderr, "Sanitizer %p passed first round with %d edits; doing a second round %s\n",
|
fprintf (stderr, "Sanitizer %p passed first round with %d edits; doing a second round %s\n",
|
||||||
blob, context->edit_count, HB_FUNC);
|
blob, c->edit_count, HB_FUNC);
|
||||||
|
|
||||||
/* sanitize again to ensure no toe-stepping */
|
/* sanitize again to ensure no toe-stepping */
|
||||||
context->edit_count = 0;
|
c->edit_count = 0;
|
||||||
sane = t->sanitize (context);
|
sane = t->sanitize (c);
|
||||||
if (context->edit_count) {
|
if (c->edit_count) {
|
||||||
if (HB_DEBUG_SANITIZE)
|
if (HB_DEBUG_SANITIZE)
|
||||||
fprintf (stderr, "Sanitizer %p requested %d edits in second round; FAILLING %s\n",
|
fprintf (stderr, "Sanitizer %p requested %d edits in second round; FAILLING %s\n",
|
||||||
blob, context->edit_count, HB_FUNC);
|
blob, c->edit_count, HB_FUNC);
|
||||||
sane = false;
|
sane = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context->finish ();
|
c->finish ();
|
||||||
} else {
|
} else {
|
||||||
unsigned int edit_count = context->edit_count;
|
unsigned int edit_count = c->edit_count;
|
||||||
context->finish ();
|
c->finish ();
|
||||||
if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
|
if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
|
||||||
/* ok, we made it writable by relocating. try again */
|
/* ok, we made it writable by relocating. try again */
|
||||||
if (HB_DEBUG_SANITIZE)
|
if (HB_DEBUG_SANITIZE)
|
||||||
|
@ -391,9 +391,9 @@ struct IntType
|
||||||
inline operator Type(void) const { return v; }
|
inline operator Type(void) const { return v; }
|
||||||
inline bool operator == (const IntType<Type> &o) const { return v == o.v; }
|
inline bool operator == (const IntType<Type> &o) const { return v == o.v; }
|
||||||
inline bool operator != (const IntType<Type> &o) const { return v != o.v; }
|
inline bool operator != (const IntType<Type> &o) const { return v != o.v; }
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return likely (context->check_struct (this));
|
return likely (c->check_struct (this));
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
BEInt<Type, sizeof (Type)> v;
|
BEInt<Type, sizeof (Type)> v;
|
||||||
|
@ -459,9 +459,9 @@ struct FixedVersion
|
||||||
{
|
{
|
||||||
inline operator uint32_t (void) const { return (major << 16) + minor; }
|
inline operator uint32_t (void) const { return (major << 16) + minor; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
USHORT major;
|
USHORT major;
|
||||||
|
@ -487,28 +487,28 @@ struct GenericOffsetTo : OffsetType
|
||||||
return StructAtOffset<Type> (base, offset);
|
return StructAtOffset<Type> (base, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, void *base) {
|
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!context->check_struct (this))) return false;
|
if (unlikely (!c->check_struct (this))) return false;
|
||||||
unsigned int offset = *this;
|
unsigned int offset = *this;
|
||||||
if (unlikely (!offset)) return true;
|
if (unlikely (!offset)) return true;
|
||||||
Type &obj = StructAtOffset<Type> (base, offset);
|
Type &obj = StructAtOffset<Type> (base, offset);
|
||||||
return likely (obj.sanitize (context)) || neuter (context);
|
return likely (obj.sanitize (c)) || neuter (c);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, void *base, T user_data) {
|
inline bool sanitize (hb_sanitize_context_t *c, void *base, T user_data) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!context->check_struct (this))) return false;
|
if (unlikely (!c->check_struct (this))) return false;
|
||||||
unsigned int offset = *this;
|
unsigned int offset = *this;
|
||||||
if (unlikely (!offset)) return true;
|
if (unlikely (!offset)) return true;
|
||||||
Type &obj = StructAtOffset<Type> (base, offset);
|
Type &obj = StructAtOffset<Type> (base, offset);
|
||||||
return likely (obj.sanitize (context, user_data)) || neuter (context);
|
return likely (obj.sanitize (c, user_data)) || neuter (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Set the offset to Null */
|
/* Set the offset to Null */
|
||||||
inline bool neuter (hb_sanitize_context_t *context) {
|
inline bool neuter (hb_sanitize_context_t *c) {
|
||||||
if (context->can_edit (this, this->static_size)) {
|
if (c->can_edit (this, this->static_size)) {
|
||||||
this->set (0); /* 0 is Null offset */
|
this->set (0); /* 0 is Null offset */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -552,9 +552,9 @@ struct GenericArrayOf
|
||||||
inline unsigned int get_size () const
|
inline unsigned int get_size () const
|
||||||
{ return len.static_size + len * Type::static_size; }
|
{ return len.static_size + len * Type::static_size; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!sanitize_shallow (context))) return false;
|
if (unlikely (!sanitize_shallow (c))) return false;
|
||||||
/* Note: for structs that do not reference other structs,
|
/* Note: for structs that do not reference other structs,
|
||||||
* we do not need to call their sanitize() as we already did
|
* we do not need to call their sanitize() as we already did
|
||||||
* a bound check on the aggregate array size, hence the return.
|
* a bound check on the aggregate array size, hence the return.
|
||||||
|
@ -565,35 +565,35 @@ struct GenericArrayOf
|
||||||
* other structs. */
|
* other structs. */
|
||||||
unsigned int count = len;
|
unsigned int count = len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (array[i].sanitize (context))
|
if (array[i].sanitize (c))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, void *base) {
|
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!sanitize_shallow (context))) return false;
|
if (unlikely (!sanitize_shallow (c))) return false;
|
||||||
unsigned int count = len;
|
unsigned int count = len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (unlikely (!array[i].sanitize (context, base)))
|
if (unlikely (!array[i].sanitize (c, base)))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, void *base, T user_data) {
|
inline bool sanitize (hb_sanitize_context_t *c, void *base, T user_data) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!sanitize_shallow (context))) return false;
|
if (unlikely (!sanitize_shallow (c))) return false;
|
||||||
unsigned int count = len;
|
unsigned int count = len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (unlikely (!array[i].sanitize (context, base, user_data)))
|
if (unlikely (!array[i].sanitize (c, base, user_data)))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool sanitize_shallow (hb_sanitize_context_t *context) {
|
inline bool sanitize_shallow (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& context->check_array (this, Type::static_size, len);
|
&& c->check_array (this, Type::static_size, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -633,14 +633,14 @@ struct OffsetListOf : OffsetArrayOf<Type>
|
||||||
return this+this->array[i];
|
return this+this->array[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return OffsetArrayOf<Type>::sanitize (context, this);
|
return OffsetArrayOf<Type>::sanitize (c, this);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, T user_data) {
|
inline bool sanitize (hb_sanitize_context_t *c, T user_data) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return OffsetArrayOf<Type>::sanitize (context, this, user_data);
|
return OffsetArrayOf<Type>::sanitize (c, this, user_data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -658,14 +658,14 @@ struct HeadlessArrayOf
|
||||||
inline unsigned int get_size () const
|
inline unsigned int get_size () const
|
||||||
{ return len.static_size + (len ? len - 1 : 0) * Type::static_size; }
|
{ return len.static_size + (len ? len - 1 : 0) * Type::static_size; }
|
||||||
|
|
||||||
inline bool sanitize_shallow (hb_sanitize_context_t *context) {
|
inline bool sanitize_shallow (hb_sanitize_context_t *c) {
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& context->check_array (this, Type::static_size, len);
|
&& c->check_array (this, Type::static_size, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!sanitize_shallow (context))) return false;
|
if (unlikely (!sanitize_shallow (c))) return false;
|
||||||
/* Note: for structs that do not reference other structs,
|
/* Note: for structs that do not reference other structs,
|
||||||
* we do not need to call their sanitize() as we already did
|
* we do not need to call their sanitize() as we already did
|
||||||
* a bound check on the aggregate array size, hence the return.
|
* a bound check on the aggregate array size, hence the return.
|
||||||
|
@ -677,7 +677,7 @@ struct HeadlessArrayOf
|
||||||
unsigned int count = len ? len - 1 : 0;
|
unsigned int count = len ? len - 1 : 0;
|
||||||
Type *a = array;
|
Type *a = array;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (unlikely (!a[i].sanitize (context)))
|
if (unlikely (!a[i].sanitize (c)))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,10 +51,10 @@
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct Record
|
struct Record
|
||||||
{
|
{
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, void *base) {
|
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& offset.sanitize (context, base);
|
&& offset.sanitize (c, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag tag; /* 4-byte Tag identifier */
|
Tag tag; /* 4-byte Tag identifier */
|
||||||
|
@ -110,9 +110,9 @@ struct RecordListOf : RecordArrayOf<Type>
|
||||||
inline const Type& operator [] (unsigned int i) const
|
inline const Type& operator [] (unsigned int i) const
|
||||||
{ return this+RecordArrayOf<Type>::operator [](i).offset; }
|
{ return this+RecordArrayOf<Type>::operator [](i).offset; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return RecordArrayOf<Type>::sanitize (context, this);
|
return RecordArrayOf<Type>::sanitize (c, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,10 +158,10 @@ struct LangSys
|
||||||
return reqFeatureIndex;;
|
return reqFeatureIndex;;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& featureIndex.sanitize (context);
|
&& featureIndex.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset lookupOrder; /* = Null (reserved for an offset to a
|
Offset lookupOrder; /* = Null (reserved for an offset to a
|
||||||
|
@ -197,10 +197,10 @@ struct Script
|
||||||
inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
|
inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
|
||||||
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return defaultLangSys.sanitize (context, this)
|
return defaultLangSys.sanitize (c, this)
|
||||||
&& langSys.sanitize (context, this);
|
&& langSys.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -228,10 +228,10 @@ struct Feature
|
||||||
unsigned int *lookup_tags /* OUT */) const
|
unsigned int *lookup_tags /* OUT */) const
|
||||||
{ return lookupIndex.get_indexes (start_index, lookup_count, lookup_tags); }
|
{ return lookupIndex.get_indexes (start_index, lookup_count, lookup_tags); }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& lookupIndex.sanitize (context);
|
&& lookupIndex.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LONGTERMTODO: implement get_feature_parameters() */
|
/* LONGTERMTODO: implement get_feature_parameters() */
|
||||||
|
@ -280,15 +280,15 @@ struct Lookup
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
/* Real sanitize of the subtables is done by GSUB/GPOS/... */
|
/* Real sanitize of the subtables is done by GSUB/GPOS/... */
|
||||||
if (!(context->check_struct (this)
|
if (!(c->check_struct (this)
|
||||||
&& subTable.sanitize (context))) return false;
|
&& subTable.sanitize (c))) return false;
|
||||||
if (unlikely (lookupFlag & LookupFlag::UseMarkFilteringSet))
|
if (unlikely (lookupFlag & LookupFlag::UseMarkFilteringSet))
|
||||||
{
|
{
|
||||||
USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
|
USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
|
||||||
if (!markFilteringSet.sanitize (context)) return false;
|
if (!markFilteringSet.sanitize (c)) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -330,9 +330,9 @@ struct CoverageFormat1
|
||||||
return NOT_COVERED;
|
return NOT_COVERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return glyphArray.sanitize (context);
|
return glyphArray.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -356,9 +356,9 @@ struct CoverageRangeRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -389,9 +389,9 @@ struct CoverageFormat2
|
||||||
return NOT_COVERED;
|
return NOT_COVERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return rangeRecord.sanitize (context);
|
return rangeRecord.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -417,12 +417,12 @@ struct Coverage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
case 2: return u.format2.sanitize (context);
|
case 2: return u.format2.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,10 +454,10 @@ struct ClassDefFormat1
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& classValue.sanitize (context);
|
&& classValue.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
USHORT classFormat; /* Format identifier--format = 1 */
|
USHORT classFormat; /* Format identifier--format = 1 */
|
||||||
|
@ -481,9 +481,9 @@ struct ClassRangeRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -513,9 +513,9 @@ struct ClassDefFormat2
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return rangeRecord.sanitize (context);
|
return rangeRecord.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
USHORT classFormat; /* Format identifier--format = 2 */
|
USHORT classFormat; /* Format identifier--format = 2 */
|
||||||
|
@ -539,12 +539,12 @@ struct ClassDef
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
case 2: return u.format2.sanitize (context);
|
case 2: return u.format2.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,10 +598,10 @@ struct Device
|
||||||
return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
|
return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& context->check_range (this, this->get_size ());
|
&& c->check_range (this, this->get_size ());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -66,10 +66,10 @@ struct AttachList
|
||||||
return points.len;
|
return points.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& attachPoint.sanitize (context, this);
|
&& attachPoint.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -92,15 +92,15 @@ struct CaretValueFormat1
|
||||||
friend struct CaretValue;
|
friend struct CaretValue;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_UNUSED) const
|
inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t glyph_id HB_UNUSED) const
|
||||||
{
|
{
|
||||||
/* TODO vertical */
|
/* TODO vertical */
|
||||||
return _hb_16dot16_mul_round (context->font->x_scale, coordinate);
|
return _hb_16dot16_mul_round (c->font->x_scale, coordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -115,19 +115,19 @@ struct CaretValueFormat2
|
||||||
friend struct CaretValue;
|
friend struct CaretValue;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
|
inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t glyph_id) const
|
||||||
{
|
{
|
||||||
/* TODO vertical */
|
/* TODO vertical */
|
||||||
hb_position_t x, y;
|
hb_position_t x, y;
|
||||||
if (hb_font_get_contour_point (context->font, context->face, caretValuePoint, glyph_id, &x, &y))
|
if (hb_font_get_contour_point (c->font, c->face, caretValuePoint, glyph_id, &x, &y))
|
||||||
return x;
|
return x;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -141,17 +141,17 @@ struct CaretValueFormat3
|
||||||
{
|
{
|
||||||
friend struct CaretValue;
|
friend struct CaretValue;
|
||||||
|
|
||||||
inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_UNUSED) const
|
inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t glyph_id HB_UNUSED) const
|
||||||
{
|
{
|
||||||
/* TODO vertical */
|
/* TODO vertical */
|
||||||
return _hb_16dot16_mul_round (context->font->x_scale, coordinate) +
|
return _hb_16dot16_mul_round (c->font->x_scale, coordinate) +
|
||||||
((this+deviceTable).get_delta (context->font->x_ppem) << 16);
|
((this+deviceTable).get_delta (c->font->x_ppem) << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this)
|
return c->check_struct (this)
|
||||||
&& deviceTable.sanitize (context, this);
|
&& deviceTable.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -167,23 +167,23 @@ struct CaretValueFormat3
|
||||||
|
|
||||||
struct CaretValue
|
struct CaretValue
|
||||||
{
|
{
|
||||||
inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
|
inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t glyph_id) const
|
||||||
{
|
{
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.get_caret_value (context, glyph_id);
|
case 1: return u.format1.get_caret_value (c, glyph_id);
|
||||||
case 2: return u.format2.get_caret_value (context, glyph_id);
|
case 2: return u.format2.get_caret_value (c, glyph_id);
|
||||||
case 3: return u.format3.get_caret_value (context, glyph_id);
|
case 3: return u.format3.get_caret_value (c, glyph_id);
|
||||||
default:return 0;
|
default:return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
case 2: return u.format2.sanitize (context);
|
case 2: return u.format2.sanitize (c);
|
||||||
case 3: return u.format3.sanitize (context);
|
case 3: return u.format3.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ struct CaretValue
|
||||||
|
|
||||||
struct LigGlyph
|
struct LigGlyph
|
||||||
{
|
{
|
||||||
inline unsigned int get_lig_carets (hb_ot_layout_context_t *context,
|
inline unsigned int get_lig_carets (hb_ot_layout_context_t *c,
|
||||||
hb_codepoint_t glyph_id,
|
hb_codepoint_t glyph_id,
|
||||||
unsigned int start_offset,
|
unsigned int start_offset,
|
||||||
unsigned int *caret_count /* IN/OUT */,
|
unsigned int *caret_count /* IN/OUT */,
|
||||||
|
@ -211,15 +211,15 @@ struct LigGlyph
|
||||||
const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_count);
|
const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_count);
|
||||||
unsigned int count = *caret_count;
|
unsigned int count = *caret_count;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
caret_array[i] = (this+array[i]).get_caret_value (context, glyph_id);
|
caret_array[i] = (this+array[i]).get_caret_value (c, glyph_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return carets.len;
|
return carets.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return carets.sanitize (context, this);
|
return carets.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -233,7 +233,7 @@ struct LigGlyph
|
||||||
|
|
||||||
struct LigCaretList
|
struct LigCaretList
|
||||||
{
|
{
|
||||||
inline unsigned int get_lig_carets (hb_ot_layout_context_t *context,
|
inline unsigned int get_lig_carets (hb_ot_layout_context_t *c,
|
||||||
hb_codepoint_t glyph_id,
|
hb_codepoint_t glyph_id,
|
||||||
unsigned int start_offset,
|
unsigned int start_offset,
|
||||||
unsigned int *caret_count /* IN/OUT */,
|
unsigned int *caret_count /* IN/OUT */,
|
||||||
|
@ -247,13 +247,13 @@ struct LigCaretList
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const LigGlyph &lig_glyph = this+ligGlyph[index];
|
const LigGlyph &lig_glyph = this+ligGlyph[index];
|
||||||
return lig_glyph.get_lig_carets (context, glyph_id, start_offset, caret_count, caret_array);
|
return lig_glyph.get_lig_carets (c, glyph_id, start_offset, caret_count, caret_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& ligGlyph.sanitize (context, this);
|
&& ligGlyph.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -273,9 +273,9 @@ struct MarkGlyphSetsFormat1
|
||||||
inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
||||||
{ return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
|
{ return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this);
|
return coverage.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -297,11 +297,11 @@ struct MarkGlyphSets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,25 +348,25 @@ struct GDEF
|
||||||
{ return (this+attachList).get_attach_points (glyph_id, start_offset, point_count, point_array); }
|
{ return (this+attachList).get_attach_points (glyph_id, start_offset, point_count, point_array); }
|
||||||
|
|
||||||
inline bool has_lig_carets () const { return ligCaretList != 0; }
|
inline bool has_lig_carets () const { return ligCaretList != 0; }
|
||||||
inline unsigned int get_lig_carets (hb_ot_layout_context_t *context,
|
inline unsigned int get_lig_carets (hb_ot_layout_context_t *c,
|
||||||
hb_codepoint_t glyph_id,
|
hb_codepoint_t glyph_id,
|
||||||
unsigned int start_offset,
|
unsigned int start_offset,
|
||||||
unsigned int *caret_count /* IN/OUT */,
|
unsigned int *caret_count /* IN/OUT */,
|
||||||
int *caret_array /* OUT */) const
|
int *caret_array /* OUT */) const
|
||||||
{ return (this+ligCaretList).get_lig_carets (context, glyph_id, start_offset, caret_count, caret_array); }
|
{ return (this+ligCaretList).get_lig_carets (c, glyph_id, start_offset, caret_count, caret_array); }
|
||||||
|
|
||||||
inline bool has_mark_sets () const { return version >= 0x00010002 && markGlyphSetsDef[0] != 0; }
|
inline bool has_mark_sets () const { return version >= 0x00010002 && markGlyphSetsDef[0] != 0; }
|
||||||
inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
||||||
{ return version >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
|
{ return version >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return version.sanitize (context) && likely (version.major == 1)
|
return version.sanitize (c) && likely (version.major == 1)
|
||||||
&& glyphClassDef.sanitize (context, this)
|
&& glyphClassDef.sanitize (c, this)
|
||||||
&& attachList.sanitize (context, this)
|
&& attachList.sanitize (c, this)
|
||||||
&& ligCaretList.sanitize (context, this)
|
&& ligCaretList.sanitize (c, this)
|
||||||
&& markAttachClassDef.sanitize (context, this)
|
&& markAttachClassDef.sanitize (c, this)
|
||||||
&& (version < 0x00010002 || markGlyphSetsDef[0].sanitize (context, this));
|
&& (version < 0x00010002 || markGlyphSetsDef[0].sanitize (c, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
#undef BUFFER
|
#undef BUFFER
|
||||||
#define BUFFER context->buffer
|
#define BUFFER c->buffer
|
||||||
|
|
||||||
|
|
||||||
struct SingleSubstFormat1
|
struct SingleSubstFormat1
|
||||||
|
@ -40,7 +40,7 @@ struct SingleSubstFormat1
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
||||||
|
@ -49,19 +49,19 @@ struct SingleSubstFormat1
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
glyph_id += deltaGlyphID;
|
glyph_id += deltaGlyphID;
|
||||||
context->buffer->replace_glyph (glyph_id);
|
c->buffer->replace_glyph (glyph_id);
|
||||||
|
|
||||||
/* We inherit the old glyph class to the substituted glyph */
|
/* We inherit the old glyph class to the substituted glyph */
|
||||||
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
|
||||||
_hb_ot_layout_set_glyph_property (context->layout->face, glyph_id, context->property);
|
_hb_ot_layout_set_glyph_property (c->layout->face, glyph_id, c->property);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& deltaGlyphID.sanitize (context);
|
&& deltaGlyphID.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -81,7 +81,7 @@ struct SingleSubstFormat2
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
||||||
|
@ -93,19 +93,19 @@ struct SingleSubstFormat2
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
glyph_id = substitute[index];
|
glyph_id = substitute[index];
|
||||||
context->buffer->replace_glyph (glyph_id);
|
c->buffer->replace_glyph (glyph_id);
|
||||||
|
|
||||||
/* We inherit the old glyph class to the substituted glyph */
|
/* We inherit the old glyph class to the substituted glyph */
|
||||||
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
|
||||||
_hb_ot_layout_set_glyph_property (context->layout->face, glyph_id, context->property);
|
_hb_ot_layout_set_glyph_property (c->layout->face, glyph_id, c->property);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& substitute.sanitize (context);
|
&& substitute.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -126,22 +126,22 @@ struct SingleSubst
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.apply (context);
|
case 1: return u.format1.apply (c);
|
||||||
case 2: return u.format2.apply (context);
|
case 2: return u.format2.apply (c);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
case 2: return u.format2.sanitize (context);
|
case 2: return u.format2.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,35 +160,35 @@ struct Sequence
|
||||||
friend struct MultipleSubstFormat1;
|
friend struct MultipleSubstFormat1;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
if (unlikely (!substitute.len))
|
if (unlikely (!substitute.len))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
context->buffer->add_output_glyphs_be16 (1,
|
c->buffer->add_output_glyphs_be16 (1,
|
||||||
substitute.len, (const uint16_t *) substitute.array,
|
substitute.len, (const uint16_t *) substitute.array,
|
||||||
0xFFFF, 0xFFFF);
|
0xFFFF, 0xFFFF);
|
||||||
|
|
||||||
/* This is a guess only ... */
|
/* This is a guess only ... */
|
||||||
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
|
||||||
{
|
{
|
||||||
unsigned int property = context->property;
|
unsigned int property = c->property;
|
||||||
if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
|
if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
|
||||||
property = HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
|
property = HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
|
||||||
|
|
||||||
unsigned int count = substitute.len;
|
unsigned int count = substitute.len;
|
||||||
for (unsigned int n = 0; n < count; n++)
|
for (unsigned int n = 0; n < count; n++)
|
||||||
_hb_ot_layout_set_glyph_property (context->layout->face, substitute[n], property);
|
_hb_ot_layout_set_glyph_property (c->layout->face, substitute[n], property);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return substitute.sanitize (context);
|
return substitute.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -204,7 +204,7 @@ struct MultipleSubstFormat1
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
|
|
||||||
|
@ -212,13 +212,13 @@ struct MultipleSubstFormat1
|
||||||
if (likely (index == NOT_COVERED))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (this+sequence[index]).apply (context);
|
return (this+sequence[index]).apply (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& sequence.sanitize (context, this);
|
&& sequence.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -239,20 +239,20 @@ struct MultipleSubst
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.apply (context);
|
case 1: return u.format1.apply (c);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ struct AlternateSubstFormat1
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
||||||
|
@ -291,9 +291,9 @@ struct AlternateSubstFormat1
|
||||||
unsigned int alt_index = 0;
|
unsigned int alt_index = 0;
|
||||||
|
|
||||||
/* XXX callback to user to choose alternate
|
/* XXX callback to user to choose alternate
|
||||||
if (context->layout->face->altfunc)
|
if (c->layout->face->altfunc)
|
||||||
alt_index = (context->layout->face->altfunc)(context->layout->layout, context->buffer,
|
alt_index = (c->layout->face->altfunc)(c->layout->layout, c->buffer,
|
||||||
context->buffer->out_pos, glyph_id,
|
c->buffer->out_pos, glyph_id,
|
||||||
alt_set.len, alt_set.array);
|
alt_set.len, alt_set.array);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -302,19 +302,19 @@ struct AlternateSubstFormat1
|
||||||
|
|
||||||
glyph_id = alt_set[alt_index];
|
glyph_id = alt_set[alt_index];
|
||||||
|
|
||||||
context->buffer->replace_glyph (glyph_id);
|
c->buffer->replace_glyph (glyph_id);
|
||||||
|
|
||||||
/* We inherit the old glyph class to the substituted glyph */
|
/* We inherit the old glyph class to the substituted glyph */
|
||||||
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
|
||||||
_hb_ot_layout_set_glyph_property (context->layout->face, glyph_id, context->property);
|
_hb_ot_layout_set_glyph_property (c->layout->face, glyph_id, c->property);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& alternateSet.sanitize (context, this);
|
&& alternateSet.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -335,20 +335,20 @@ struct AlternateSubst
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.apply (context);
|
case 1: return u.format1.apply (c);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,19 +366,19 @@ struct Ligature
|
||||||
friend struct LigatureSet;
|
friend struct LigatureSet;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, bool is_mark) const
|
inline bool apply (hb_apply_context_t *c, bool is_mark) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int count = component.len;
|
unsigned int count = component.len;
|
||||||
unsigned int end = MIN (context->buffer->in_length, context->buffer->in_pos + context->context_length);
|
unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
|
||||||
if (unlikely (context->buffer->in_pos + count > end))
|
if (unlikely (c->buffer->in_pos + count > end))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (i = 1, j = context->buffer->in_pos + 1; i < count; i++, j++)
|
for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
|
||||||
{
|
{
|
||||||
unsigned int property;
|
unsigned int property;
|
||||||
while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), context->lookup_flag, &property))
|
while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), c->lookup_flag, &property))
|
||||||
{
|
{
|
||||||
if (unlikely (j + count - i == end))
|
if (unlikely (j + count - i == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -392,23 +392,23 @@ struct Ligature
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* This is just a guess ... */
|
/* This is just a guess ... */
|
||||||
if (_hb_ot_layout_has_new_glyph_classes (context->layout->face))
|
if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
|
||||||
_hb_ot_layout_set_glyph_class (context->layout->face, ligGlyph,
|
_hb_ot_layout_set_glyph_class (c->layout->face, ligGlyph,
|
||||||
is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
|
is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
|
||||||
: HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
|
: HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
|
||||||
|
|
||||||
if (j == context->buffer->in_pos + i) /* No input glyphs skipped */
|
if (j == c->buffer->in_pos + i) /* No input glyphs skipped */
|
||||||
/* We don't use a new ligature ID if there are no skipped
|
/* We don't use a new ligature ID if there are no skipped
|
||||||
glyphs and the ligature already has an ID. */
|
glyphs and the ligature already has an ID. */
|
||||||
context->buffer->add_output_glyphs_be16 (i,
|
c->buffer->add_output_glyphs_be16 (i,
|
||||||
1, (const uint16_t *) &ligGlyph,
|
1, (const uint16_t *) &ligGlyph,
|
||||||
0,
|
0,
|
||||||
IN_LIGID (context->buffer->in_pos) && !IN_COMPONENT (context->buffer->in_pos) ?
|
IN_LIGID (c->buffer->in_pos) && !IN_COMPONENT (c->buffer->in_pos) ?
|
||||||
0xFFFF : context->buffer->allocate_lig_id ());
|
0xFFFF : c->buffer->allocate_lig_id ());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int lig_id = context->buffer->allocate_lig_id ();
|
unsigned int lig_id = c->buffer->allocate_lig_id ();
|
||||||
context->buffer->add_output_glyph (ligGlyph, 0xFFFF, lig_id);
|
c->buffer->add_output_glyph (ligGlyph, 0xFFFF, lig_id);
|
||||||
|
|
||||||
/* Now we must do a second loop to copy the skipped glyphs to
|
/* Now we must do a second loop to copy the skipped glyphs to
|
||||||
`out' and assign component values to it. We start with the
|
`out' and assign component values to it. We start with the
|
||||||
|
@ -419,10 +419,10 @@ struct Ligature
|
||||||
|
|
||||||
for ( i = 1; i < count; i++ )
|
for ( i = 1; i < count; i++ )
|
||||||
{
|
{
|
||||||
while (_hb_ot_layout_skip_mark (context->layout->face, IN_CURINFO (), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (c->layout->face, IN_CURINFO (), c->lookup_flag, NULL))
|
||||||
context->buffer->add_output_glyph (IN_CURGLYPH (), i, lig_id);
|
c->buffer->add_output_glyph (IN_CURGLYPH (), i, lig_id);
|
||||||
|
|
||||||
(context->buffer->in_pos)++;
|
(c->buffer->in_pos)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,10 +430,10 @@ struct Ligature
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return ligGlyph.sanitize (context)
|
return ligGlyph.sanitize (c)
|
||||||
&& component.sanitize (context);
|
&& component.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -451,14 +451,14 @@ struct LigatureSet
|
||||||
friend struct LigatureSubstFormat1;
|
friend struct LigatureSubstFormat1;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, bool is_mark) const
|
inline bool apply (hb_apply_context_t *c, bool is_mark) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int num_ligs = ligature.len;
|
unsigned int num_ligs = ligature.len;
|
||||||
for (unsigned int i = 0; i < num_ligs; i++)
|
for (unsigned int i = 0; i < num_ligs; i++)
|
||||||
{
|
{
|
||||||
const Ligature &lig = this+ligature[i];
|
const Ligature &lig = this+ligature[i];
|
||||||
if (lig.apply (context, is_mark))
|
if (lig.apply (c, is_mark))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,9 +466,9 @@ struct LigatureSet
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return ligature.sanitize (context, this);
|
return ligature.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -484,25 +484,25 @@ struct LigatureSubstFormat1
|
||||||
friend struct LigatureSubst;
|
friend struct LigatureSubst;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
hb_codepoint_t glyph_id = IN_CURGLYPH ();
|
||||||
|
|
||||||
bool first_is_mark = !!(context->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
|
bool first_is_mark = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
|
||||||
|
|
||||||
unsigned int index = (this+coverage) (glyph_id);
|
unsigned int index = (this+coverage) (glyph_id);
|
||||||
if (likely (index == NOT_COVERED))
|
if (likely (index == NOT_COVERED))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const LigatureSet &lig_set = this+ligatureSet[index];
|
const LigatureSet &lig_set = this+ligatureSet[index];
|
||||||
return lig_set.apply (context, first_is_mark);
|
return lig_set.apply (c, first_is_mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& ligatureSet.sanitize (context, this);
|
&& ligatureSet.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -522,20 +522,20 @@ struct LigatureSubst
|
||||||
friend struct SubstLookupSubTable;
|
friend struct SubstLookupSubTable;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.apply (context);
|
case 1: return u.format1.apply (c);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,17 +549,17 @@ struct LigatureSubst
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static inline bool substitute_lookup (hb_apply_context_t *context, unsigned int lookup_index);
|
static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index);
|
||||||
|
|
||||||
struct ContextSubst : Context
|
struct ContextSubst : Context
|
||||||
{
|
{
|
||||||
friend struct SubstLookupSubTable;
|
friend struct SubstLookupSubTable;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
return Context::apply (context, substitute_lookup);
|
return Context::apply (c, substitute_lookup);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -568,10 +568,10 @@ struct ChainContextSubst : ChainContext
|
||||||
friend struct SubstLookupSubTable;
|
friend struct SubstLookupSubTable;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
return ChainContext::apply (context, substitute_lookup);
|
return ChainContext::apply (c, substitute_lookup);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -589,9 +589,9 @@ struct ExtensionSubst : Extension
|
||||||
return StructAtOffset<SubstLookupSubTable> (this, offset);
|
return StructAtOffset<SubstLookupSubTable> (this, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const;
|
inline bool apply (hb_apply_context_t *c) const;
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context);
|
inline bool sanitize (hb_sanitize_context_t *c);
|
||||||
|
|
||||||
inline bool is_reverse (void) const;
|
inline bool is_reverse (void) const;
|
||||||
};
|
};
|
||||||
|
@ -602,10 +602,10 @@ struct ReverseChainSingleSubstFormat1
|
||||||
friend struct ReverseChainSingleSubst;
|
friend struct ReverseChainSingleSubst;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
if (unlikely (context->context_length != NO_CONTEXT))
|
if (unlikely (c->context_length != NO_CONTEXT))
|
||||||
return false; /* No chaining to this type */
|
return false; /* No chaining to this type */
|
||||||
|
|
||||||
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
||||||
|
@ -615,32 +615,32 @@ struct ReverseChainSingleSubstFormat1
|
||||||
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||||
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
|
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
|
||||||
|
|
||||||
if (match_backtrack (context,
|
if (match_backtrack (c,
|
||||||
backtrack.len, (USHORT *) backtrack.array,
|
backtrack.len, (USHORT *) backtrack.array,
|
||||||
match_coverage, this) &&
|
match_coverage, this) &&
|
||||||
match_lookahead (context,
|
match_lookahead (c,
|
||||||
lookahead.len, (USHORT *) lookahead.array,
|
lookahead.len, (USHORT *) lookahead.array,
|
||||||
match_coverage, this,
|
match_coverage, this,
|
||||||
1))
|
1))
|
||||||
{
|
{
|
||||||
IN_CURGLYPH () = substitute[index];
|
IN_CURGLYPH () = substitute[index];
|
||||||
context->buffer->in_pos--; /* Reverse! */
|
c->buffer->in_pos--; /* Reverse! */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!(coverage.sanitize (context, this)
|
if (!(coverage.sanitize (c, this)
|
||||||
&& backtrack.sanitize (context, this)))
|
&& backtrack.sanitize (c, this)))
|
||||||
return false;
|
return false;
|
||||||
OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||||
if (!lookahead.sanitize (context, this))
|
if (!lookahead.sanitize (c, this))
|
||||||
return false;
|
return false;
|
||||||
ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
|
ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
|
||||||
return substitute.sanitize (context);
|
return substitute.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -668,20 +668,20 @@ struct ReverseChainSingleSubst
|
||||||
friend struct SubstLookupSubTable;
|
friend struct SubstLookupSubTable;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context) const
|
inline bool apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.apply (context);
|
case 1: return u.format1.apply (c);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,33 +714,33 @@ struct SubstLookupSubTable
|
||||||
ReverseChainSingle = 8
|
ReverseChainSingle = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context, unsigned int lookup_type) const
|
inline bool apply (hb_apply_context_t *c, unsigned int lookup_type) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (lookup_type) {
|
switch (lookup_type) {
|
||||||
case Single: return u.single.apply (context);
|
case Single: return u.single.apply (c);
|
||||||
case Multiple: return u.multiple.apply (context);
|
case Multiple: return u.multiple.apply (c);
|
||||||
case Alternate: return u.alternate.apply (context);
|
case Alternate: return u.alternate.apply (c);
|
||||||
case Ligature: return u.ligature.apply (context);
|
case Ligature: return u.ligature.apply (c);
|
||||||
case Context: return u.context.apply (context);
|
case Context: return u.c.apply (c);
|
||||||
case ChainContext: return u.chainContext.apply (context);
|
case ChainContext: return u.chainContext.apply (c);
|
||||||
case Extension: return u.extension.apply (context);
|
case Extension: return u.extension.apply (c);
|
||||||
case ReverseChainSingle: return u.reverseChainContextSingle.apply (context);
|
case ReverseChainSingle: return u.reverseChainContextSingle.apply (c);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, unsigned int lookup_type) {
|
inline bool sanitize (hb_sanitize_context_t *c, unsigned int lookup_type) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
switch (lookup_type) {
|
switch (lookup_type) {
|
||||||
case Single: return u.single.sanitize (context);
|
case Single: return u.single.sanitize (c);
|
||||||
case Multiple: return u.multiple.sanitize (context);
|
case Multiple: return u.multiple.sanitize (c);
|
||||||
case Alternate: return u.alternate.sanitize (context);
|
case Alternate: return u.alternate.sanitize (c);
|
||||||
case Ligature: return u.ligature.sanitize (context);
|
case Ligature: return u.ligature.sanitize (c);
|
||||||
case Context: return u.context.sanitize (context);
|
case Context: return u.c.sanitize (c);
|
||||||
case ChainContext: return u.chainContext.sanitize (context);
|
case ChainContext: return u.chainContext.sanitize (c);
|
||||||
case Extension: return u.extension.sanitize (context);
|
case Extension: return u.extension.sanitize (c);
|
||||||
case ReverseChainSingle: return u.reverseChainContextSingle.sanitize (context);
|
case ReverseChainSingle: return u.reverseChainContextSingle.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,7 +752,7 @@ struct SubstLookupSubTable
|
||||||
MultipleSubst multiple;
|
MultipleSubst multiple;
|
||||||
AlternateSubst alternate;
|
AlternateSubst alternate;
|
||||||
LigatureSubst ligature;
|
LigatureSubst ligature;
|
||||||
ContextSubst context;
|
ContextSubst c;
|
||||||
ChainContextSubst chainContext;
|
ChainContextSubst chainContext;
|
||||||
ExtensionSubst extension;
|
ExtensionSubst extension;
|
||||||
ReverseChainSingleSubst reverseChainContextSingle;
|
ReverseChainSingleSubst reverseChainContextSingle;
|
||||||
|
@ -785,15 +785,15 @@ struct SubstLookup : Lookup
|
||||||
unsigned int nesting_level_left) const
|
unsigned int nesting_level_left) const
|
||||||
{
|
{
|
||||||
unsigned int lookup_type = get_type ();
|
unsigned int lookup_type = get_type ();
|
||||||
hb_apply_context_t context[1] = {{0}};
|
hb_apply_context_t c[1] = {{0}};
|
||||||
|
|
||||||
context->layout = layout;
|
c->layout = layout;
|
||||||
context->buffer = buffer;
|
c->buffer = buffer;
|
||||||
context->context_length = context_length;
|
c->context_length = context_length;
|
||||||
context->nesting_level_left = nesting_level_left;
|
c->nesting_level_left = nesting_level_left;
|
||||||
context->lookup_flag = get_flag ();
|
c->lookup_flag = get_flag ();
|
||||||
|
|
||||||
if (!_hb_ot_layout_check_glyph_property (context->layout->face, IN_CURINFO (), context->lookup_flag, &context->property))
|
if (!_hb_ot_layout_check_glyph_property (c->layout->face, IN_CURINFO (), c->lookup_flag, &c->property))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (unlikely (lookup_type == SubstLookupSubTable::Extension))
|
if (unlikely (lookup_type == SubstLookupSubTable::Extension))
|
||||||
|
@ -812,7 +812,7 @@ struct SubstLookup : Lookup
|
||||||
|
|
||||||
unsigned int count = get_subtable_count ();
|
unsigned int count = get_subtable_count ();
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (get_subtable (i).apply (context, lookup_type))
|
if (get_subtable (i).apply (c, lookup_type))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -865,11 +865,11 @@ struct SubstLookup : Lookup
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!Lookup::sanitize (context))) return false;
|
if (unlikely (!Lookup::sanitize (c))) return false;
|
||||||
OffsetArrayOf<SubstLookupSubTable> &list = CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable);
|
OffsetArrayOf<SubstLookupSubTable> &list = CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable);
|
||||||
return list.sanitize (context, this, get_type ());
|
return list.sanitize (c, this, get_type ());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -892,11 +892,11 @@ struct GSUB : GSUBGPOS
|
||||||
hb_mask_t mask) const
|
hb_mask_t mask) const
|
||||||
{ return get_lookup (lookup_index).apply_string (layout, buffer, mask); }
|
{ return get_lookup (lookup_index).apply_string (layout, buffer, mask); }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!GSUBGPOS::sanitize (context))) return false;
|
if (unlikely (!GSUBGPOS::sanitize (c))) return false;
|
||||||
OffsetTo<SubstLookupList> &list = CastR<OffsetTo<SubstLookupList> > (lookupList);
|
OffsetTo<SubstLookupList> &list = CastR<OffsetTo<SubstLookupList> > (lookupList);
|
||||||
return list.sanitize (context, this);
|
return list.sanitize (c, this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (10);
|
DEFINE_SIZE_STATIC (10);
|
||||||
|
@ -905,19 +905,19 @@ struct GSUB : GSUBGPOS
|
||||||
|
|
||||||
/* Out-of-class implementation for methods recursing */
|
/* Out-of-class implementation for methods recursing */
|
||||||
|
|
||||||
inline bool ExtensionSubst::apply (hb_apply_context_t *context) const
|
inline bool ExtensionSubst::apply (hb_apply_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
return get_subtable ().apply (context, get_type ());
|
return get_subtable ().apply (c, get_type ());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *context)
|
inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *c)
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!Extension::sanitize (context))) return false;
|
if (unlikely (!Extension::sanitize (c))) return false;
|
||||||
unsigned int offset = get_offset ();
|
unsigned int offset = get_offset ();
|
||||||
if (unlikely (!offset)) return true;
|
if (unlikely (!offset)) return true;
|
||||||
return StructAtOffset<SubstLookupSubTable> (this, offset).sanitize (context, get_type ());
|
return StructAtOffset<SubstLookupSubTable> (this, offset).sanitize (c, get_type ());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ExtensionSubst::is_reverse (void) const
|
inline bool ExtensionSubst::is_reverse (void) const
|
||||||
|
@ -928,18 +928,18 @@ inline bool ExtensionSubst::is_reverse (void) const
|
||||||
return SubstLookup::lookup_type_is_reverse (type);
|
return SubstLookup::lookup_type_is_reverse (type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool substitute_lookup (hb_apply_context_t *context, unsigned int lookup_index)
|
static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index)
|
||||||
{
|
{
|
||||||
const GSUB &gsub = *(context->layout->face->ot_layout.gsub);
|
const GSUB &gsub = *(c->layout->face->ot_layout.gsub);
|
||||||
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
||||||
|
|
||||||
if (unlikely (context->nesting_level_left == 0))
|
if (unlikely (c->nesting_level_left == 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (unlikely (context->context_length < 1))
|
if (unlikely (c->context_length < 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return l.apply_once (context->layout, context->buffer, context->context_length, context->nesting_level_left - 1);
|
return l.apply_once (c->layout, c->buffer, c->context_length, c->nesting_level_left - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TRACE_APPLY() \
|
#define TRACE_APPLY() \
|
||||||
hb_trace_t<HB_DEBUG_APPLY> trace (&context->debug_depth, "APPLY", HB_FUNC, this); \
|
hb_trace_t<HB_DEBUG_APPLY> trace (&c->debug_depth, "APPLY", HB_FUNC, this); \
|
||||||
|
|
||||||
|
|
||||||
struct hb_apply_context_t
|
struct hb_apply_context_t
|
||||||
|
@ -54,11 +54,11 @@ struct hb_apply_context_t
|
||||||
|
|
||||||
|
|
||||||
#undef BUFFER
|
#undef BUFFER
|
||||||
#define BUFFER context->buffer
|
#define BUFFER c->buffer
|
||||||
|
|
||||||
|
|
||||||
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
|
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
|
||||||
typedef bool (*apply_lookup_func_t) (hb_apply_context_t *context, unsigned int lookup_index);
|
typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
|
||||||
|
|
||||||
struct ContextFuncs
|
struct ContextFuncs
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline bool match_input (hb_apply_context_t *context,
|
static inline bool match_input (hb_apply_context_t *c,
|
||||||
unsigned int count, /* Including the first glyph (not matched) */
|
unsigned int count, /* Including the first glyph (not matched) */
|
||||||
const USHORT input[], /* Array of input values--start with second glyph */
|
const USHORT input[], /* Array of input values--start with second glyph */
|
||||||
match_func_t match_func,
|
match_func_t match_func,
|
||||||
|
@ -93,13 +93,13 @@ static inline bool match_input (hb_apply_context_t *context,
|
||||||
unsigned int *context_length_out)
|
unsigned int *context_length_out)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int end = MIN (context->buffer->in_length, context->buffer->in_pos + context->context_length);
|
unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
|
||||||
if (unlikely (context->buffer->in_pos + count > end))
|
if (unlikely (c->buffer->in_pos + count > end))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (i = 1, j = context->buffer->in_pos + 1; i < count; i++, j++)
|
for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
|
||||||
{
|
{
|
||||||
while (_hb_ot_layout_skip_mark (context->layout->face, IN_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (c->layout->face, IN_INFO (j), c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j + count - i == end))
|
if (unlikely (j + count - i == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -110,23 +110,23 @@ static inline bool match_input (hb_apply_context_t *context,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*context_length_out = j - context->buffer->in_pos;
|
*context_length_out = j - c->buffer->in_pos;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool match_backtrack (hb_apply_context_t *context,
|
static inline bool match_backtrack (hb_apply_context_t *c,
|
||||||
unsigned int count,
|
unsigned int count,
|
||||||
const USHORT backtrack[],
|
const USHORT backtrack[],
|
||||||
match_func_t match_func,
|
match_func_t match_func,
|
||||||
const void *match_data)
|
const void *match_data)
|
||||||
{
|
{
|
||||||
if (unlikely (context->buffer->out_pos < count))
|
if (unlikely (c->buffer->out_pos < count))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (unsigned int i = 0, j = context->buffer->out_pos - 1; i < count; i++, j--)
|
for (unsigned int i = 0, j = c->buffer->out_pos - 1; i < count; i++, j--)
|
||||||
{
|
{
|
||||||
while (_hb_ot_layout_skip_mark (context->layout->face, OUT_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (c->layout->face, OUT_INFO (j), c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j + 1 == count - i))
|
if (unlikely (j + 1 == count - i))
|
||||||
return false;
|
return false;
|
||||||
|
@ -140,7 +140,7 @@ static inline bool match_backtrack (hb_apply_context_t *context,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool match_lookahead (hb_apply_context_t *context,
|
static inline bool match_lookahead (hb_apply_context_t *c,
|
||||||
unsigned int count,
|
unsigned int count,
|
||||||
const USHORT lookahead[],
|
const USHORT lookahead[],
|
||||||
match_func_t match_func,
|
match_func_t match_func,
|
||||||
|
@ -148,13 +148,13 @@ static inline bool match_lookahead (hb_apply_context_t *context,
|
||||||
unsigned int offset)
|
unsigned int offset)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int end = MIN (context->buffer->in_length, context->buffer->in_pos + context->context_length);
|
unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
|
||||||
if (unlikely (context->buffer->in_pos + offset + count > end))
|
if (unlikely (c->buffer->in_pos + offset + count > end))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (i = 0, j = context->buffer->in_pos + offset; i < count; i++, j++)
|
for (i = 0, j = c->buffer->in_pos + offset; i < count; i++, j++)
|
||||||
{
|
{
|
||||||
while (_hb_ot_layout_skip_mark (context->layout->face, OUT_INFO (j), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (c->layout->face, OUT_INFO (j), c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (j + count - i == end))
|
if (unlikely (j + count - i == end))
|
||||||
return false;
|
return false;
|
||||||
|
@ -171,9 +171,9 @@ static inline bool match_lookahead (hb_apply_context_t *context,
|
||||||
|
|
||||||
struct LookupRecord
|
struct LookupRecord
|
||||||
{
|
{
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
USHORT sequenceIndex; /* Index into current glyph
|
USHORT sequenceIndex; /* Index into current glyph
|
||||||
|
@ -184,14 +184,14 @@ struct LookupRecord
|
||||||
DEFINE_SIZE_STATIC (4);
|
DEFINE_SIZE_STATIC (4);
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool apply_lookup (hb_apply_context_t *context,
|
static inline bool apply_lookup (hb_apply_context_t *c,
|
||||||
unsigned int count, /* Including the first glyph */
|
unsigned int count, /* Including the first glyph */
|
||||||
unsigned int lookupCount,
|
unsigned int lookupCount,
|
||||||
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
|
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
|
||||||
apply_lookup_func_t apply_func)
|
apply_lookup_func_t apply_func)
|
||||||
{
|
{
|
||||||
unsigned int end = MIN (context->buffer->in_length, context->buffer->in_pos + context->context_length);
|
unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
|
||||||
if (unlikely (context->buffer->in_pos + count > end))
|
if (unlikely (c->buffer->in_pos + count > end))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* TODO We don't support lookupRecord arrays that are not increasing:
|
/* TODO We don't support lookupRecord arrays that are not increasing:
|
||||||
|
@ -203,26 +203,26 @@ static inline bool apply_lookup (hb_apply_context_t *context,
|
||||||
*/
|
*/
|
||||||
for (unsigned int i = 0; i < count; /* NOP */)
|
for (unsigned int i = 0; i < count; /* NOP */)
|
||||||
{
|
{
|
||||||
while (_hb_ot_layout_skip_mark (context->layout->face, IN_CURINFO (), context->lookup_flag, NULL))
|
while (_hb_ot_layout_skip_mark (c->layout->face, IN_CURINFO (), c->lookup_flag, NULL))
|
||||||
{
|
{
|
||||||
if (unlikely (context->buffer->in_pos == end))
|
if (unlikely (c->buffer->in_pos == end))
|
||||||
return true;
|
return true;
|
||||||
/* No lookup applied for this index */
|
/* No lookup applied for this index */
|
||||||
context->buffer->next_glyph ();
|
c->buffer->next_glyph ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookupCount && i == lookupRecord->sequenceIndex)
|
if (lookupCount && i == lookupRecord->sequenceIndex)
|
||||||
{
|
{
|
||||||
unsigned int old_pos = context->buffer->in_pos;
|
unsigned int old_pos = c->buffer->in_pos;
|
||||||
|
|
||||||
/* Apply a lookup */
|
/* Apply a lookup */
|
||||||
bool done = apply_func (context, lookupRecord->lookupListIndex);
|
bool done = apply_func (c, lookupRecord->lookupListIndex);
|
||||||
|
|
||||||
lookupRecord++;
|
lookupRecord++;
|
||||||
lookupCount--;
|
lookupCount--;
|
||||||
/* Err, this is wrong if the lookup jumped over some glyphs */
|
/* Err, this is wrong if the lookup jumped over some glyphs */
|
||||||
i += context->buffer->in_pos - old_pos;
|
i += c->buffer->in_pos - old_pos;
|
||||||
if (unlikely (context->buffer->in_pos == end))
|
if (unlikely (c->buffer->in_pos == end))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
|
@ -232,7 +232,7 @@ static inline bool apply_lookup (hb_apply_context_t *context,
|
||||||
{
|
{
|
||||||
not_applied:
|
not_applied:
|
||||||
/* No lookup applied for this index */
|
/* No lookup applied for this index */
|
||||||
context->buffer->next_glyph ();
|
c->buffer->next_glyph ();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,15 +249,15 @@ struct ContextLookupContext
|
||||||
const void *match_data;
|
const void *match_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool context_lookup (hb_apply_context_t *context,
|
static inline bool context_lookup (hb_apply_context_t *c,
|
||||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||||
const USHORT input[], /* Array of input values--start with second glyph */
|
const USHORT input[], /* Array of input values--start with second glyph */
|
||||||
unsigned int lookupCount,
|
unsigned int lookupCount,
|
||||||
const LookupRecord lookupRecord[],
|
const LookupRecord lookupRecord[],
|
||||||
ContextLookupContext &lookup_context)
|
ContextLookupContext &lookup_context)
|
||||||
{
|
{
|
||||||
hb_apply_context_t new_context = *context;
|
hb_apply_context_t new_context = *c;
|
||||||
return match_input (context,
|
return match_input (c,
|
||||||
inputCount, input,
|
inputCount, input,
|
||||||
lookup_context.funcs.match, lookup_context.match_data,
|
lookup_context.funcs.match, lookup_context.match_data,
|
||||||
&new_context.context_length)
|
&new_context.context_length)
|
||||||
|
@ -272,22 +272,22 @@ struct Rule
|
||||||
friend struct RuleSet;
|
friend struct RuleSet;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, ContextLookupContext &lookup_context) const
|
inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
|
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
|
||||||
return context_lookup (context,
|
return context_lookup (c,
|
||||||
inputCount, input,
|
inputCount, input,
|
||||||
lookupCount, lookupRecord,
|
lookupCount, lookupRecord,
|
||||||
lookup_context);
|
lookup_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return inputCount.sanitize (context)
|
return inputCount.sanitize (c)
|
||||||
&& lookupCount.sanitize (context)
|
&& lookupCount.sanitize (c)
|
||||||
&& context->check_range (input,
|
&& c->check_range (input,
|
||||||
input[0].static_size * inputCount
|
input[0].static_size * inputCount
|
||||||
+ lookupRecordX[0].static_size * lookupCount);
|
+ lookupRecordX[0].static_size * lookupCount);
|
||||||
}
|
}
|
||||||
|
@ -307,22 +307,22 @@ struct Rule
|
||||||
|
|
||||||
struct RuleSet
|
struct RuleSet
|
||||||
{
|
{
|
||||||
inline bool apply (hb_apply_context_t *context, ContextLookupContext &lookup_context) const
|
inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int num_rules = rule.len;
|
unsigned int num_rules = rule.len;
|
||||||
for (unsigned int i = 0; i < num_rules; i++)
|
for (unsigned int i = 0; i < num_rules; i++)
|
||||||
{
|
{
|
||||||
if ((this+rule[i]).apply (context, lookup_context))
|
if ((this+rule[i]).apply (c, lookup_context))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return rule.sanitize (context, this);
|
return rule.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -339,7 +339,7 @@ struct ContextFormat1
|
||||||
friend struct Context;
|
friend struct Context;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
||||||
|
@ -351,13 +351,13 @@ struct ContextFormat1
|
||||||
{match_glyph, apply_func},
|
{match_glyph, apply_func},
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
return rule_set.apply (context, lookup_context);
|
return rule_set.apply (c, lookup_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& ruleSet.sanitize (context, this);
|
&& ruleSet.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -378,7 +378,7 @@ struct ContextFormat2
|
||||||
friend struct Context;
|
friend struct Context;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
||||||
|
@ -395,14 +395,14 @@ struct ContextFormat2
|
||||||
{match_class, apply_func},
|
{match_class, apply_func},
|
||||||
&class_def
|
&class_def
|
||||||
};
|
};
|
||||||
return rule_set.apply (context, lookup_context);
|
return rule_set.apply (c, lookup_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& classDef.sanitize (context, this)
|
&& classDef.sanitize (c, this)
|
||||||
&& ruleSet.sanitize (context, this);
|
&& ruleSet.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -426,7 +426,7 @@ struct ContextFormat3
|
||||||
friend struct Context;
|
friend struct Context;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int index = (this+coverage[0]) (IN_CURGLYPH ());
|
unsigned int index = (this+coverage[0]) (IN_CURGLYPH ());
|
||||||
|
@ -438,21 +438,21 @@ struct ContextFormat3
|
||||||
{match_coverage, apply_func},
|
{match_coverage, apply_func},
|
||||||
this
|
this
|
||||||
};
|
};
|
||||||
return context_lookup (context,
|
return context_lookup (c,
|
||||||
glyphCount, (const USHORT *) (coverage + 1),
|
glyphCount, (const USHORT *) (coverage + 1),
|
||||||
lookupCount, lookupRecord,
|
lookupCount, lookupRecord,
|
||||||
lookup_context);
|
lookup_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!context->check_struct (this)) return false;
|
if (!c->check_struct (this)) return false;
|
||||||
unsigned int count = glyphCount;
|
unsigned int count = glyphCount;
|
||||||
if (!context->check_array (coverage, coverage[0].static_size, count)) return false;
|
if (!c->check_array (coverage, coverage[0].static_size, count)) return false;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (!coverage[i].sanitize (context, this)) return false;
|
if (!coverage[i].sanitize (c, this)) return false;
|
||||||
LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * count);
|
LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * count);
|
||||||
return context->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount);
|
return c->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -472,24 +472,24 @@ struct ContextFormat3
|
||||||
struct Context
|
struct Context
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.apply (context, apply_func);
|
case 1: return u.format1.apply (c, apply_func);
|
||||||
case 2: return u.format2.apply (context, apply_func);
|
case 2: return u.format2.apply (c, apply_func);
|
||||||
case 3: return u.format3.apply (context, apply_func);
|
case 3: return u.format3.apply (c, apply_func);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
case 2: return u.format2.sanitize (context);
|
case 2: return u.format2.sanitize (c);
|
||||||
case 3: return u.format3.sanitize (context);
|
case 3: return u.format3.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ struct ChainContextLookupContext
|
||||||
const void *match_data[3];
|
const void *match_data[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool chain_context_lookup (hb_apply_context_t *context,
|
static inline bool chain_context_lookup (hb_apply_context_t *c,
|
||||||
unsigned int backtrackCount,
|
unsigned int backtrackCount,
|
||||||
const USHORT backtrack[],
|
const USHORT backtrack[],
|
||||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||||
|
@ -524,20 +524,20 @@ static inline bool chain_context_lookup (hb_apply_context_t *context,
|
||||||
ChainContextLookupContext &lookup_context)
|
ChainContextLookupContext &lookup_context)
|
||||||
{
|
{
|
||||||
/* First guess */
|
/* First guess */
|
||||||
if (unlikely (context->buffer->out_pos < backtrackCount ||
|
if (unlikely (c->buffer->out_pos < backtrackCount ||
|
||||||
context->buffer->in_pos + inputCount + lookaheadCount > context->buffer->in_length ||
|
c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->in_length ||
|
||||||
inputCount + lookaheadCount > context->context_length))
|
inputCount + lookaheadCount > c->context_length))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
hb_apply_context_t new_context = *context;
|
hb_apply_context_t new_context = *c;
|
||||||
return match_backtrack (context,
|
return match_backtrack (c,
|
||||||
backtrackCount, backtrack,
|
backtrackCount, backtrack,
|
||||||
lookup_context.funcs.match, lookup_context.match_data[0])
|
lookup_context.funcs.match, lookup_context.match_data[0])
|
||||||
&& match_input (context,
|
&& match_input (c,
|
||||||
inputCount, input,
|
inputCount, input,
|
||||||
lookup_context.funcs.match, lookup_context.match_data[1],
|
lookup_context.funcs.match, lookup_context.match_data[1],
|
||||||
&new_context.context_length)
|
&new_context.context_length)
|
||||||
&& match_lookahead (context,
|
&& match_lookahead (c,
|
||||||
lookaheadCount, lookahead,
|
lookaheadCount, lookahead,
|
||||||
lookup_context.funcs.match, lookup_context.match_data[2],
|
lookup_context.funcs.match, lookup_context.match_data[2],
|
||||||
new_context.context_length)
|
new_context.context_length)
|
||||||
|
@ -552,13 +552,13 @@ struct ChainRule
|
||||||
friend struct ChainRuleSet;
|
friend struct ChainRuleSet;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, ChainContextLookupContext &lookup_context) const
|
inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||||
return chain_context_lookup (context,
|
return chain_context_lookup (c,
|
||||||
backtrack.len, backtrack.array,
|
backtrack.len, backtrack.array,
|
||||||
input.len, input.array,
|
input.len, input.array,
|
||||||
lookahead.len, lookahead.array,
|
lookahead.len, lookahead.array,
|
||||||
|
@ -568,15 +568,15 @@ struct ChainRule
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!backtrack.sanitize (context)) return false;
|
if (!backtrack.sanitize (c)) return false;
|
||||||
HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||||
if (!input.sanitize (context)) return false;
|
if (!input.sanitize (c)) return false;
|
||||||
ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||||
if (!lookahead.sanitize (context)) return false;
|
if (!lookahead.sanitize (c)) return false;
|
||||||
ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||||
return lookup.sanitize (context);
|
return lookup.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -599,22 +599,22 @@ struct ChainRule
|
||||||
|
|
||||||
struct ChainRuleSet
|
struct ChainRuleSet
|
||||||
{
|
{
|
||||||
inline bool apply (hb_apply_context_t *context, ChainContextLookupContext &lookup_context) const
|
inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int num_rules = rule.len;
|
unsigned int num_rules = rule.len;
|
||||||
for (unsigned int i = 0; i < num_rules; i++)
|
for (unsigned int i = 0; i < num_rules; i++)
|
||||||
{
|
{
|
||||||
if ((this+rule[i]).apply (context, lookup_context))
|
if ((this+rule[i]).apply (c, lookup_context))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return rule.sanitize (context, this);
|
return rule.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -630,7 +630,7 @@ struct ChainContextFormat1
|
||||||
friend struct ChainContext;
|
friend struct ChainContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
||||||
|
@ -642,13 +642,13 @@ struct ChainContextFormat1
|
||||||
{match_glyph, apply_func},
|
{match_glyph, apply_func},
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
return rule_set.apply (context, lookup_context);
|
return rule_set.apply (c, lookup_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& ruleSet.sanitize (context, this);
|
&& ruleSet.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -668,7 +668,7 @@ struct ChainContextFormat2
|
||||||
friend struct ChainContext;
|
friend struct ChainContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
unsigned int index = (this+coverage) (IN_CURGLYPH ());
|
||||||
|
@ -690,16 +690,16 @@ struct ChainContextFormat2
|
||||||
&input_class_def,
|
&input_class_def,
|
||||||
&lookahead_class_def}
|
&lookahead_class_def}
|
||||||
};
|
};
|
||||||
return rule_set.apply (context, lookup_context);
|
return rule_set.apply (c, lookup_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return coverage.sanitize (context, this)
|
return coverage.sanitize (c, this)
|
||||||
&& backtrackClassDef.sanitize (context, this)
|
&& backtrackClassDef.sanitize (c, this)
|
||||||
&& inputClassDef.sanitize (context, this)
|
&& inputClassDef.sanitize (c, this)
|
||||||
&& lookaheadClassDef.sanitize (context, this)
|
&& lookaheadClassDef.sanitize (c, this)
|
||||||
&& ruleSet.sanitize (context, this);
|
&& ruleSet.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -732,7 +732,7 @@ struct ChainContextFormat3
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||||
|
@ -747,7 +747,7 @@ struct ChainContextFormat3
|
||||||
{match_coverage, apply_func},
|
{match_coverage, apply_func},
|
||||||
{this, this, this}
|
{this, this, this}
|
||||||
};
|
};
|
||||||
return chain_context_lookup (context,
|
return chain_context_lookup (c,
|
||||||
backtrack.len, (const USHORT *) backtrack.array,
|
backtrack.len, (const USHORT *) backtrack.array,
|
||||||
input.len, (const USHORT *) input.array + 1,
|
input.len, (const USHORT *) input.array + 1,
|
||||||
lookahead.len, (const USHORT *) lookahead.array,
|
lookahead.len, (const USHORT *) lookahead.array,
|
||||||
|
@ -756,15 +756,15 @@ struct ChainContextFormat3
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!backtrack.sanitize (context, this)) return false;
|
if (!backtrack.sanitize (c, this)) return false;
|
||||||
OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||||
if (!input.sanitize (context, this)) return false;
|
if (!input.sanitize (c, this)) return false;
|
||||||
OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
|
OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
|
||||||
if (!lookahead.sanitize (context, this)) return false;
|
if (!lookahead.sanitize (c, this)) return false;
|
||||||
ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||||
return lookup.sanitize (context);
|
return lookup.sanitize (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -791,24 +791,24 @@ struct ChainContextFormat3
|
||||||
struct ChainContext
|
struct ChainContext
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const
|
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY ();
|
TRACE_APPLY ();
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.apply (context, apply_func);
|
case 1: return u.format1.apply (c, apply_func);
|
||||||
case 2: return u.format2.apply (context, apply_func);
|
case 2: return u.format2.apply (c, apply_func);
|
||||||
case 3: return u.format3.apply (context, apply_func);
|
case 3: return u.format3.apply (c, apply_func);
|
||||||
default:return false;
|
default:return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
case 2: return u.format2.sanitize (context);
|
case 2: return u.format2.sanitize (c);
|
||||||
case 3: return u.format3.sanitize (context);
|
case 3: return u.format3.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -831,9 +831,9 @@ struct ExtensionFormat1
|
||||||
inline unsigned int get_type (void) const { return extensionLookupType; }
|
inline unsigned int get_type (void) const { return extensionLookupType; }
|
||||||
inline unsigned int get_offset (void) const { return extensionOffset; }
|
inline unsigned int get_offset (void) const { return extensionOffset; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return context->check_struct (this);
|
return c->check_struct (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -864,11 +864,11 @@ struct Extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!u.format.sanitize (context)) return false;
|
if (!u.format.sanitize (c)) return false;
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.sanitize (context);
|
case 1: return u.format1.sanitize (c);
|
||||||
default:return true;
|
default:return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -921,12 +921,12 @@ struct GSUBGPOS
|
||||||
inline const Lookup& get_lookup (unsigned int i) const
|
inline const Lookup& get_lookup (unsigned int i) const
|
||||||
{ return (this+lookupList)[i]; }
|
{ return (this+lookupList)[i]; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return version.sanitize (context) && likely (version.major == 1)
|
return version.sanitize (c) && likely (version.major == 1)
|
||||||
&& scriptList.sanitize (context, this)
|
&& scriptList.sanitize (c, this)
|
||||||
&& featureList.sanitize (context, this)
|
&& featureList.sanitize (c, this)
|
||||||
&& lookupList.sanitize (context, this);
|
&& lookupList.sanitize (c, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -320,10 +320,10 @@ hb_ot_layout_get_lig_carets (hb_font_t *font,
|
||||||
unsigned int *caret_count /* IN/OUT */,
|
unsigned int *caret_count /* IN/OUT */,
|
||||||
int *caret_array /* OUT */)
|
int *caret_array /* OUT */)
|
||||||
{
|
{
|
||||||
hb_ot_layout_context_t context;
|
hb_ot_layout_context_t c;
|
||||||
context.font = font;
|
c.font = font;
|
||||||
context.face = face;
|
c.face = face;
|
||||||
return _get_gdef (face).get_lig_carets (&context, glyph, start_offset, caret_count, caret_array);
|
return _get_gdef (face).get_lig_carets (&c, glyph, start_offset, caret_count, caret_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -564,10 +564,10 @@ hb_ot_layout_substitute_lookup (hb_face_t *face,
|
||||||
unsigned int lookup_index,
|
unsigned int lookup_index,
|
||||||
hb_mask_t mask)
|
hb_mask_t mask)
|
||||||
{
|
{
|
||||||
hb_ot_layout_context_t context;
|
hb_ot_layout_context_t c;
|
||||||
context.font = NULL;
|
c.font = NULL;
|
||||||
context.face = face;
|
c.face = face;
|
||||||
return _get_gsub (face).substitute_lookup (&context, buffer, lookup_index, mask);
|
return _get_gsub (face).substitute_lookup (&c, buffer, lookup_index, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -588,10 +588,10 @@ hb_ot_layout_position_lookup (hb_font_t *font,
|
||||||
unsigned int lookup_index,
|
unsigned int lookup_index,
|
||||||
hb_mask_t mask)
|
hb_mask_t mask)
|
||||||
{
|
{
|
||||||
hb_ot_layout_context_t context;
|
hb_ot_layout_context_t c;
|
||||||
context.font = font;
|
c.font = font;
|
||||||
context.face = face;
|
c.face = face;
|
||||||
return _get_gpos (face).position_lookup (&context, buffer, lookup_index, mask);
|
return _get_gpos (face).position_lookup (&c, buffer, lookup_index, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue