hb_buffer_t *buffer;
hb_sanitize_context_t sanitizer;
const ankr &ankr_table;
+ const char *ankr_end;
/* Unused. For debug tracing only. */
unsigned int lookup_index;
hb_font_t *font_,
hb_buffer_t *buffer_,
hb_blob_t *table,
- const ankr &ankr_table_ = Null(ankr)) :
+ 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_), lookup_index (0), debug_depth (0)
+ sanitizer (),
+ ankr_table (ankr_table_), ankr_end (ankr_end_),
+ lookup_index (0), debug_depth (0)
{
sanitizer.init (table);
sanitizer.set_num_glyphs (face->get_num_glyphs ());
#include "hb-open-type.hh"
#include "hb-aat-layout-common.hh"
+#include "hb-ot-layout-gpos-table.hh"
#include "hb-ot-kern-table.hh"
/*
const HBUINT16 *data = &ankrData[entry->data.ankrActionIndex];
if (!c->sanitizer.check_array (data, 2))
return false;
- HB_UNUSED unsigned int markAnchorPoint = *data++;
- HB_UNUSED unsigned int currAnchorPoint = *data++;
- /* TODO */
+ unsigned int markAnchorPoint = *data++;
+ unsigned int currAnchorPoint = *data++;
+ const Anchor markAnchor = c->ankr_table.get_anchor (c->buffer->info[mark].codepoint,
+ markAnchorPoint,
+ c->face->get_num_glyphs (),
+ c->ankr_end);
+ const Anchor currAnchor = c->ankr_table.get_anchor (c->buffer->cur ().codepoint,
+ currAnchorPoint,
+ c->face->get_num_glyphs (),
+ c->ankr_end);
+ hb_glyph_position_t &o = buffer->cur_pos();
+ 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);
+ o.attach_type() = ATTACH_TYPE_MARK;
+ o.attach_chain() = (int) mark - (int) buffer->idx;
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
}
break;
return kerx;
}
static inline const AAT::ankr&
-_get_ankr (hb_face_t *face)
+_get_ankr (hb_face_t *face, hb_blob_t **blob = nullptr)
{
- if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(AAT::ankr);
- return *(hb_ot_face_data (face)->ankr.get ());
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
+ {
+ if (blob)
+ *blob = hb_blob_get_empty ();
+ return Null(AAT::ankr);
+ }
+ const AAT::ankr& ankr = *(hb_ot_face_data (face)->ankr.get ());
+ if (blob)
+ *blob = hb_ot_face_data (face)->ankr.get_blob ();
+ return ankr;
}
hb_blob_t *blob;
const AAT::kerx& kerx = _get_kerx (font->face, &blob);
- AAT::hb_aat_apply_context_t c (plan, font, buffer, blob, _get_ankr (font->face));
+ 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);
kerx.apply (&c);
}
struct GPOS_accelerator_t : GPOS::accelerator_t {};
-#undef attach_chain
-#undef attach_type
-
-
} /* namespace OT */