[kerx/kern] Add has_cross_stream()

This commit is contained in:
Behdad Esfahbod 2018-11-07 16:02:40 -05:00
parent ea579f9ccc
commit bc06e2805a
2 changed files with 24 additions and 0 deletions

View File

@ -848,6 +848,21 @@ struct KerxTable
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
inline const T* thiz (void) const { return static_cast<const T *> (this); }
inline bool has_cross_stream (void) const
{
typedef typename T::SubTable SubTable;
const SubTable *st = &thiz()->firstSubTable;
unsigned int count = thiz()->tableCount;
for (unsigned int i = 0; i < count; i++)
{
if (st->u.header.coverage & st->u.header.CrossStream)
return true;
st = &StructAfter<SubTable> (*st);
}
return false;
}
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{
typedef typename T::SubTable SubTable;

View File

@ -273,6 +273,15 @@ struct kern
inline bool has_data (void) const { return u.version32; }
inline bool has_cross_stream (void) const
{
switch (u.major) {
case 0: return u.ot.has_cross_stream ();
case 1: return u.aat.has_cross_stream ();
default:return false;
}
}
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{
switch (u.major) {