[kern/kerx] More towards sharing

This commit is contained in:
Behdad Esfahbod 2018-11-07 10:33:46 -05:00
parent d0f8f4c200
commit 540ccc38b0
2 changed files with 11 additions and 6 deletions

View File

@ -59,6 +59,8 @@ kerxTupleKern (int value,
struct KerxSubTableHeader
{
typedef MorxTypes Types;
enum Coverage
{
Vertical = 0x80000000, /* Set if table has vertical kerning values. */
@ -134,13 +136,12 @@ struct KerxSubTableFormat0
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
pairs.sanitize (c)));
return_trace (likely (pairs.sanitize (c)));
}
protected:
KernSubTableHeader header;
BinSearchArrayOf<KernPair, HBUINT32>
BinSearchArrayOf<KernPair, typename KernSubTableHeader::Types::HBUINT>
pairs; /* Sorted kern records. */
public:
DEFINE_SIZE_ARRAY (KernSubTableHeader::static_size + 16, pairs);

View File

@ -49,8 +49,7 @@ struct KernSubTableFormat0
{
hb_glyph_pair_t pair = {left, right};
int i = pairs.bsearch (pair);
if (i == -1)
return 0;
if (i == -1) return 0;
return pairs[i].get_kerning ();
}
@ -78,7 +77,8 @@ struct KernSubTableFormat0
protected:
KernSubTableHeader header;
BinSearchArrayOf<KernPair> pairs; /* Array of kerning pairs. */
BinSearchArrayOf<KernPair, typename KernSubTableHeader::Types::HBUINT>
pairs; /* Array of kerning pairs. */
public:
DEFINE_SIZE_ARRAY (KernSubTableHeader::static_size + 8, pairs);
};
@ -543,6 +543,8 @@ struct KernOT : KernTable<KernOT>
struct SubTableHeader
{
typedef AAT::MortTypes Types;
enum Coverage
{
Direction = 0x01u,
@ -586,6 +588,8 @@ struct KernAAT : KernTable<KernAAT>
struct SubTableHeader
{
typedef AAT::MortTypes Types;
enum Coverage
{
Direction = 0x80u,