summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-10-11 01:17:57 -0400
committerBehdad Esfahbod <behdad@behdad.org>2018-10-11 01:17:57 -0400
commitb6bc0d4ff62e4509643db3b304306a72bbcb2c38 (patch)
treeded623b65067d1f293c3d337d4165e40b2005b56
parent1622ba5943d14b2d50d45dc17fb723f4c9ddb0bb (diff)
[kerx] Implement Format4 action_type=2 coordinate-based attachment
Untested.
-rw-r--r--src/hb-aat-layout-kerx-table.hh21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index 019efd57..a54e2978 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -343,6 +343,7 @@ struct KerxSubTableFormat4
if (mark_set && entry->data.ankrActionIndex != 0xFFFF)
{
+ hb_glyph_position_t &o = buffer->cur_pos();
switch (action_type)
{
case 0: /* Control Point Actions.*/
@@ -373,12 +374,9 @@ struct KerxSubTableFormat4
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;
@@ -387,14 +385,19 @@ struct KerxSubTableFormat4
const FWORD *data = (const FWORD *) &ankrData[entry->data.ankrActionIndex];
if (!c->sanitizer.check_array (data, 4))
return false;
- HB_UNUSED int markX = *data++;
- HB_UNUSED int markY = *data++;
- HB_UNUSED int currX = *data++;
- HB_UNUSED int currY = *data++;
- /* TODO */
+ int markX = *data++;
+ int markY = *data++;
+ int currX = *data++;
+ int currY = *data++;
+
+ o.x_offset = c->font->em_scale_x (markX) - c->font->em_scale_x (currX);
+ o.y_offset = c->font->em_scale_y (markY) - c->font->em_scale_y (currY);
}
break;
}
+ o.attach_type() = ATTACH_TYPE_MARK;
+ o.attach_chain() = (int) mark - (int) buffer->idx;
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
}
if (flags & Mark)