diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh index 5f7656d2a..b793245a0 100644 --- a/src/hb-aat-layout-ankr-table.hh +++ b/src/hb-aat-layout-ankr-table.hh @@ -36,6 +36,8 @@ namespace AAT { +using namespace OT; + struct Anchor { diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 11c6c5a8b..ee2136ed9 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -698,36 +698,23 @@ struct hb_aat_apply_context_t : hb_face_t *face; hb_buffer_t *buffer; hb_sanitize_context_t sanitizer; - const ankr &ankr_table; + const ankr *ankr_table; const char *ankr_end; /* Unused. For debug tracing only. */ unsigned int lookup_index; unsigned int debug_depth; - inline hb_aat_apply_context_t (hb_ot_shape_plan_t *plan_, - hb_font_t *font_, - hb_buffer_t *buffer_, - hb_blob_t *blob = const_cast (&Null(hb_blob_t)), - const ankr &ankr_table_ = Null(ankr), - const char *ankr_end_ = nullptr) : - plan (plan_), font (font_), face (font->face), buffer (buffer_), - sanitizer (), - ankr_table (ankr_table_), ankr_end (ankr_end_), - lookup_index (0), debug_depth (0) - { - sanitizer.init (blob); - sanitizer.set_num_glyphs (face->get_num_glyphs ()); - sanitizer.start_processing (); - sanitizer.set_max_ops (HB_SANITIZE_MAX_OPS_MAX); - } + HB_INTERNAL hb_aat_apply_context_t (hb_ot_shape_plan_t *plan_, + hb_font_t *font_, + hb_buffer_t *buffer_, + hb_blob_t *blob = const_cast (&Null(hb_blob_t))); + + HB_INTERNAL ~hb_aat_apply_context_t (void); + + HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_, const char *ankr_end_); inline void set_lookup_index (unsigned int i) { lookup_index = i; } - - inline ~hb_aat_apply_context_t (void) - { - sanitizer.end_processing (); - } }; diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index b227af105..d2242c549 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -423,14 +423,14 @@ struct KerxSubTableFormat4 return false; unsigned int markAnchorPoint = *data++; unsigned int currAnchorPoint = *data++; - const Anchor markAnchor = c->ankr_table.get_anchor (c->buffer->info[mark].codepoint, - markAnchorPoint, - c->sanitizer.get_num_glyphs (), - c->ankr_end); - const Anchor currAnchor = c->ankr_table.get_anchor (c->buffer->cur ().codepoint, - currAnchorPoint, - c->sanitizer.get_num_glyphs (), - c->ankr_end); + const Anchor markAnchor = c->ankr_table->get_anchor (c->buffer->info[mark].codepoint, + markAnchorPoint, + c->sanitizer.get_num_glyphs (), + c->ankr_end); + const Anchor currAnchor = c->ankr_table->get_anchor (c->buffer->cur ().codepoint, + currAnchorPoint, + c->sanitizer.get_num_glyphs (), + c->ankr_end); o.x_offset = c->font->em_scale_x (markAnchor.xCoordinate) - c->font->em_scale_x (currAnchor.xCoordinate); o.y_offset = c->font->em_scale_y (markAnchor.yCoordinate) - c->font->em_scale_y (currAnchor.yCoordinate); diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index d917c29c6..80bf2d766 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -130,6 +130,44 @@ hb_aat_layout_find_feature_mapping (hb_tag_t tag) } +/* + * hb_aat_apply_context_t + */ + +AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (hb_ot_shape_plan_t *plan_, + hb_font_t *font_, + hb_buffer_t *buffer_, + hb_blob_t *blob) : + plan (plan_), + font (font_), + face (font->face), + buffer (buffer_), + sanitizer (), + ankr_table (&Null(AAT::ankr)), + ankr_end (nullptr), + lookup_index (0), + debug_depth (0) +{ + sanitizer.init (blob); + sanitizer.set_num_glyphs (face->get_num_glyphs ()); + sanitizer.start_processing (); + sanitizer.set_max_ops (HB_SANITIZE_MAX_OPS_MAX); +} + +AAT::hb_aat_apply_context_t::~hb_aat_apply_context_t (void) +{ + sanitizer.end_processing (); +} + +void +AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_, + const char *ankr_end_) +{ + ankr_table = ankr_table_; + ankr_end = ankr_end_; +} + + /* * mort/morx/kerx/trak */ @@ -273,8 +311,8 @@ hb_aat_layout_position (hb_ot_shape_plan_t *plan, hb_blob_t *ankr_blob; const AAT::ankr& ankr = _get_ankr (font->face, &ankr_blob); - AAT::hb_aat_apply_context_t c (plan, font, buffer, blob, - ankr, ankr_blob->data + ankr_blob->length); + AAT::hb_aat_apply_context_t c (plan, font, buffer, blob); + c.set_ankr_table (&ankr, ankr_blob->data + ankr_blob->length); kerx.apply (&c); } diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index e361330b0..5bc9e436c 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -30,7 +30,6 @@ #include "hb-open-type.hh" #include "hb-ot-shape.hh" #include "hb-ot-layout-gsubgpos.hh" -#include "hb-aat-layout-ankr-table.hh" // Ugly but needed. #include "hb-aat-layout-common.hh" diff --git a/src/hb-static.cc b/src/hb-static.cc index e5507960d..3669e08b7 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -28,7 +28,6 @@ #include "hb-open-type.hh" #include "hb-ot-layout-common.hh" -#include "hb-aat-layout-ankr-table.hh" /* I don't even want to know why... */ #include "hb-aat-layout-common.hh" #include "hb-face.hh"