提交 b605db2f 编写于 作者: B Behdad Esfahbod

[aat] Clean up ankr table include mess

上级 bce437cf
......@@ -36,6 +36,8 @@
namespace AAT {
using namespace OT;
struct Anchor
{
......
......@@ -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<hb_blob_t *> (&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<hb_blob_t *> (&Null(hb_blob_t)));
inline void set_lookup_index (unsigned int i) { lookup_index = i; }
HB_INTERNAL ~hb_aat_apply_context_t (void);
inline ~hb_aat_apply_context_t (void)
{
sanitizer.end_processing ();
}
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; }
};
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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"
......
......@@ -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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册