[ankr] Implement table access
This commit is contained in:
parent
7281cb3eeb
commit
947962a287
|
@ -45,16 +45,32 @@ struct Anchor
|
||||||
return_trace (c->check_struct (this));
|
return_trace (c->check_struct (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
FWORD xCoordinate;
|
FWORD xCoordinate;
|
||||||
FWORD yCoordinate;
|
FWORD yCoordinate;
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (4);
|
DEFINE_SIZE_STATIC (4);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef LArrayOf<Anchor> GlyphAnchors;
|
||||||
|
|
||||||
struct ankr
|
struct ankr
|
||||||
{
|
{
|
||||||
static const hb_tag_t tableTag = HB_AAT_TAG_ankr;
|
static const hb_tag_t tableTag = HB_AAT_TAG_ankr;
|
||||||
|
|
||||||
|
inline const Anchor &get_anchor (hb_codepoint_t glyph_id,
|
||||||
|
unsigned int i,
|
||||||
|
unsigned int num_glyphs,
|
||||||
|
const char *end) const
|
||||||
|
{
|
||||||
|
unsigned int offset = (this+lookupTable).get_value_or_null (glyph_id, num_glyphs);
|
||||||
|
const GlyphAnchors &anchors = StructAtOffset<GlyphAnchors> (&(this+anchorData), offset);
|
||||||
|
/* TODO Use sanitizer; to avoid overflows and more. */
|
||||||
|
if (unlikely ((const char *) &anchors + anchors.get_size () > end))
|
||||||
|
return Null(Anchor);
|
||||||
|
return anchors[i];
|
||||||
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
|
|
Loading…
Reference in New Issue