diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2018-10-10 23:07:03 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2018-10-10 23:07:03 -0400 |
commit | 947962a287d9aca2cb509c11f44cb5150aa6daf1 (patch) | |
tree | c526ce9ea36a93bb7f12772248b1e4b2a9d6cde7 | |
parent | 7281cb3eeb00091c6e6085895afd4a38a0516f35 (diff) |
[ankr] Implement table access
-rw-r--r-- | src/hb-aat-layout-ankr-table.hh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh index cc92ee29..3eac473a 100644 --- a/src/hb-aat-layout-ankr-table.hh +++ b/src/hb-aat-layout-ankr-table.hh @@ -45,16 +45,32 @@ struct Anchor return_trace (c->check_struct (this)); } + public: FWORD xCoordinate; FWORD yCoordinate; public: DEFINE_SIZE_STATIC (4); }; +typedef LArrayOf<Anchor> GlyphAnchors; + struct 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 { TRACE_SANITIZE (this); |