[kern/kerx] Towards merge more
This commit is contained in:
parent
540ccc38b0
commit
c97dde5d55
|
@ -29,6 +29,7 @@
|
||||||
#define HB_AAT_LAYOUT_KERX_TABLE_HH
|
#define HB_AAT_LAYOUT_KERX_TABLE_HH
|
||||||
|
|
||||||
#include "hb-kern.hh"
|
#include "hb-kern.hh"
|
||||||
|
#include "hb-aat-layout-ankr-table.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kerx -- Extended Kerning
|
* kerx -- Extended Kerning
|
||||||
|
@ -57,36 +58,36 @@ kerxTupleKern (int value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct KerxSubTableHeader
|
struct hb_glyph_pair_t
|
||||||
{
|
{
|
||||||
typedef MorxTypes Types;
|
hb_codepoint_t left;
|
||||||
|
hb_codepoint_t right;
|
||||||
|
};
|
||||||
|
|
||||||
enum Coverage
|
struct KernPair
|
||||||
|
{
|
||||||
|
inline int get_kerning (void) const
|
||||||
|
{ return value; }
|
||||||
|
|
||||||
|
inline int cmp (const hb_glyph_pair_t &o) const
|
||||||
{
|
{
|
||||||
Vertical = 0x80000000, /* Set if table has vertical kerning values. */
|
int ret = left.cmp (o.left);
|
||||||
CrossStream = 0x40000000, /* Set if table has cross-stream kerning values. */
|
if (ret) return ret;
|
||||||
Variation = 0x20000000, /* Set if table has variation kerning values. */
|
return right.cmp (o.right);
|
||||||
Backwards = 0x10000000, /* If clear, process the glyphs forwards, that
|
}
|
||||||
* is, from first to last in the glyph stream.
|
|
||||||
* If we, process them from last to first.
|
|
||||||
* This flag only applies to state-table based
|
|
||||||
* 'kerx' subtables (types 1 and 4). */
|
|
||||||
Reserved = 0x0FFFFF00, /* Reserved, set to zero. */
|
|
||||||
SubtableType = 0x000000FF, /* Subtable type. */
|
|
||||||
};
|
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (likely (c->check_struct (this)));
|
return_trace (c->check_struct (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GlyphID left;
|
||||||
|
GlyphID right;
|
||||||
|
FWORD value;
|
||||||
public:
|
public:
|
||||||
HBUINT32 length;
|
DEFINE_SIZE_STATIC (6);
|
||||||
HBUINT32 coverage;
|
|
||||||
HBUINT32 tupleCount;
|
|
||||||
public:
|
|
||||||
DEFINE_SIZE_STATIC (12);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename KernSubTableHeader>
|
template <typename KernSubTableHeader>
|
||||||
|
@ -687,6 +688,39 @@ struct KerxSubTableFormat6
|
||||||
DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 24);
|
DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 24);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct KerxSubTableHeader
|
||||||
|
{
|
||||||
|
typedef MorxTypes Types;
|
||||||
|
|
||||||
|
enum Coverage
|
||||||
|
{
|
||||||
|
Vertical = 0x80000000, /* Set if table has vertical kerning values. */
|
||||||
|
CrossStream = 0x40000000, /* Set if table has cross-stream kerning values. */
|
||||||
|
Variation = 0x20000000, /* Set if table has variation kerning values. */
|
||||||
|
Backwards = 0x10000000, /* If clear, process the glyphs forwards, that
|
||||||
|
* is, from first to last in the glyph stream.
|
||||||
|
* If we, process them from last to first.
|
||||||
|
* This flag only applies to state-table based
|
||||||
|
* 'kerx' subtables (types 1 and 4). */
|
||||||
|
Reserved = 0x0FFFFF00, /* Reserved, set to zero. */
|
||||||
|
SubtableType = 0x000000FF, /* Subtable type. */
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
|
{
|
||||||
|
TRACE_SANITIZE (this);
|
||||||
|
return_trace (likely (c->check_struct (this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
HBUINT32 length;
|
||||||
|
HBUINT32 coverage;
|
||||||
|
HBUINT32 tupleCount;
|
||||||
|
public:
|
||||||
|
DEFINE_SIZE_STATIC (12);
|
||||||
|
};
|
||||||
|
|
||||||
struct KerxTable
|
struct KerxTable
|
||||||
{
|
{
|
||||||
friend struct kerx;
|
friend struct kerx;
|
||||||
|
@ -816,6 +850,7 @@ struct kerx
|
||||||
DEFINE_SIZE_MIN (8);
|
DEFINE_SIZE_MIN (8);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} /* namespace AAT */
|
} /* namespace AAT */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,39 +114,6 @@ struct hb_kern_machine_t
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct hb_glyph_pair_t
|
|
||||||
{
|
|
||||||
hb_codepoint_t left;
|
|
||||||
hb_codepoint_t right;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct KernPair
|
|
||||||
{
|
|
||||||
inline int get_kerning (void) const
|
|
||||||
{ return value; }
|
|
||||||
|
|
||||||
inline int cmp (const hb_glyph_pair_t &o) const
|
|
||||||
{
|
|
||||||
int ret = left.cmp (o.left);
|
|
||||||
if (ret) return ret;
|
|
||||||
return right.cmp (o.right);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
|
||||||
{
|
|
||||||
TRACE_SANITIZE (this);
|
|
||||||
return_trace (c->check_struct (this));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
GlyphID left;
|
|
||||||
GlyphID right;
|
|
||||||
FWORD value;
|
|
||||||
public:
|
|
||||||
DEFINE_SIZE_STATIC (6);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} /* namespace OT */
|
} /* namespace OT */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
#ifndef HB_OT_KERN_TABLE_HH
|
#ifndef HB_OT_KERN_TABLE_HH
|
||||||
#define HB_OT_KERN_TABLE_HH
|
#define HB_OT_KERN_TABLE_HH
|
||||||
|
|
||||||
#include "hb-kern.hh"
|
#include "hb-aat-layout-kerx-table.hh"
|
||||||
#include "hb-ot-shape.hh"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,7 +46,7 @@ struct KernSubTableFormat0
|
||||||
{
|
{
|
||||||
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
||||||
{
|
{
|
||||||
hb_glyph_pair_t pair = {left, right};
|
AAT::hb_glyph_pair_t pair = {left, right};
|
||||||
int i = pairs.bsearch (pair);
|
int i = pairs.bsearch (pair);
|
||||||
if (i == -1) return 0;
|
if (i == -1) return 0;
|
||||||
return pairs[i].get_kerning ();
|
return pairs[i].get_kerning ();
|
||||||
|
@ -77,7 +76,7 @@ struct KernSubTableFormat0
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
KernSubTableHeader header;
|
KernSubTableHeader header;
|
||||||
BinSearchArrayOf<KernPair, typename KernSubTableHeader::Types::HBUINT>
|
BinSearchArrayOf<AAT::KernPair, typename KernSubTableHeader::Types::HBUINT>
|
||||||
pairs; /* Array of kerning pairs. */
|
pairs; /* Array of kerning pairs. */
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_ARRAY (KernSubTableHeader::static_size + 8, pairs);
|
DEFINE_SIZE_ARRAY (KernSubTableHeader::static_size + 8, pairs);
|
||||||
|
|
Loading…
Reference in New Issue