[kern] Respect more flags
This commit is contained in:
parent
9f880bad0d
commit
74c7a2c6c8
|
@ -395,8 +395,11 @@ struct KernSubTableWrapper
|
|||
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
|
||||
inline const T* thiz (void) const { return static_cast<const T *> (this); }
|
||||
|
||||
inline bool is_supported (void) const
|
||||
{ return !(thiz()->coverage & T::CheckFlags); }
|
||||
|
||||
inline bool is_horizontal (void) const
|
||||
{ return (thiz()->coverage & T::CheckFlags) == T::CheckHorizontal; }
|
||||
{ return (thiz()->coverage & T::Direction) == T::CheckHorizontal; }
|
||||
|
||||
inline bool is_override (void) const
|
||||
{ return bool (thiz()->coverage & T::Override); }
|
||||
|
@ -405,7 +408,7 @@ struct KernSubTableWrapper
|
|||
{ return thiz()->subtable.get_kerning (left, right, thiz()->format); }
|
||||
|
||||
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
||||
{ return is_horizontal () ? get_kerning (left, right) : 0; }
|
||||
{ return is_supported () && is_horizontal () ? get_kerning (left, right) : 0; }
|
||||
|
||||
inline void apply (AAT::hb_aat_apply_context_t *c) const
|
||||
{ thiz()->subtable.apply (c, thiz()->format); }
|
||||
|
@ -435,7 +438,7 @@ struct KernTable
|
|||
unsigned int count = thiz()->nTables;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
if (st->is_override ())
|
||||
if (st->is_supported () && st->is_override ())
|
||||
v = 0;
|
||||
v += st->get_h_kerning (left, right);
|
||||
st = &StructAfter<typename T::SubTableWrapper> (*st);
|
||||
|
@ -452,13 +455,19 @@ struct KernTable
|
|||
unsigned int last_override = 0;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
if (st->is_override ())
|
||||
if (st->is_supported () && st->is_override ())
|
||||
last_override = i;
|
||||
st = &StructAfter<typename T::SubTableWrapper> (*st);
|
||||
}
|
||||
st = CastP<typename T::SubTableWrapper> (&thiz()->dataZ);
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
if (!st->is_supported ())
|
||||
goto skip;
|
||||
|
||||
if (HB_DIRECTION_IS_HORIZONTAL (c->buffer->props.direction) != st->is_horizontal ())
|
||||
goto skip;
|
||||
|
||||
if (i < last_override)
|
||||
goto skip;
|
||||
|
||||
|
@ -514,7 +523,7 @@ struct KernOT : KernTable<KernOT>
|
|||
|
||||
Variation = 0x00u, /* Not supported. */
|
||||
|
||||
CheckFlags = 0x07u,
|
||||
CheckFlags = 0x06u,
|
||||
CheckHorizontal = 0x01u
|
||||
};
|
||||
|
||||
|
@ -555,7 +564,7 @@ struct KernAAT : KernTable<KernAAT>
|
|||
|
||||
Override = 0x00u, /* Not supported. */
|
||||
|
||||
CheckFlags = 0xE0u,
|
||||
CheckFlags = 0x60u,
|
||||
CheckHorizontal = 0x00u
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue