Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/opentype.c | 28 ---------------------------- 1 file changed, 28 deletions(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 22159e29885..419326fb2be 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -104,34 +104,6 @@ struct cmap_header WORD version; WORD num_tables; struct cmap_encoding_record tables[1]; -} CMAP_Header; - -typedef struct { - DWORD startCharCode; - DWORD endCharCode; - DWORD startGlyphID; -} CMAP_SegmentedCoverage_group; - -struct cmap_segmented_coverage -{ - WORD format; - WORD reserved; - DWORD length; - DWORD language; - DWORD num_groups; - CMAP_SegmentedCoverage_group groups[1]; -}; - -struct cmap_segment_mapping -{ - WORD format; - WORD length; - WORD language; - WORD seg_count_x2; - WORD search_range; - WORD entry_selector; - WORD range_shift; - WORD end_code[1]; };
enum OPENTYPE_CMAP_TABLE_FORMAT
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/opentype.c | 70 ++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 40 deletions(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 419326fb2be..d7099b8adf9 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -3497,7 +3497,7 @@ static float opentype_scale_gpos_be_value(WORD value, float emsize, UINT16 upem)
static int opentype_layout_gpos_get_dev_value(const struct scriptshaping_context *context, unsigned int offset) { - const struct scriptshaping_cache *cache = context->cache; + const struct dwrite_fonttable *table = &context->table->table; unsigned int start_size, end_size, format, value_word; unsigned int index, ppem, mask; int value; @@ -3505,22 +3505,21 @@ static int opentype_layout_gpos_get_dev_value(const struct scriptshaping_context if (!offset) return 0;
- start_size = table_read_be_word(&cache->gpos.table, offset); - end_size = table_read_be_word(&cache->gpos.table, offset + FIELD_OFFSET(struct ot_gpos_device_table, end_size)); + start_size = table_read_be_word(table, offset); + end_size = table_read_be_word(table, offset + FIELD_OFFSET(struct ot_gpos_device_table, end_size));
ppem = context->emsize; if (ppem < start_size || ppem > end_size) return 0;
- format = table_read_be_word(&cache->gpos.table, offset + FIELD_OFFSET(struct ot_gpos_device_table, format)); + format = table_read_be_word(table, offset + FIELD_OFFSET(struct ot_gpos_device_table, format));
if (format < 1 || format > 3) return 0;
index = ppem - start_size;
- value_word = table_read_be_word(&cache->gpos.table, offset + - FIELD_OFFSET(struct ot_gpos_device_table, values[index >> (4 - format)])); + value_word = table_read_be_word(table, offset + FIELD_OFFSET(struct ot_gpos_device_table, values[index >> (4 - format)])); mask = 0xffff >> (16 - (1 << format));
value = (value_word >> ((index % (4 - format)) * (1 << format))) & mask; @@ -3812,24 +3811,21 @@ static BOOL opentype_layout_apply_gpos_single_adjustment(struct scriptshaping_co const struct lookup *lookup, unsigned int subtable_offset) { const struct dwrite_fonttable *table = &context->table->table; - struct scriptshaping_cache *cache = context->cache; UINT16 format, value_format, value_len, coverage, glyph;
unsigned int coverage_index;
- format = table_read_be_word(&cache->gpos.table, subtable_offset); + format = table_read_be_word(table, subtable_offset);
- coverage = table_read_be_word(&cache->gpos.table, subtable_offset + - FIELD_OFFSET(struct ot_gpos_singlepos_format1, coverage)); - value_format = table_read_be_word(&cache->gpos.table, subtable_offset + - FIELD_OFFSET(struct ot_gpos_singlepos_format1, value_format)); + coverage = table_read_be_word(table, subtable_offset + FIELD_OFFSET(struct ot_gpos_singlepos_format1, coverage)); + value_format = table_read_be_word(table, subtable_offset + FIELD_OFFSET(struct ot_gpos_singlepos_format1, value_format)); value_len = dwrite_popcount(value_format);
glyph = context->u.pos.glyphs[context->cur];
if (format == 1) { - const struct ot_gpos_singlepos_format1 *format1 = table_read_ensure(&cache->gpos.table, subtable_offset, + const struct ot_gpos_singlepos_format1 *format1 = table_read_ensure(table, subtable_offset, FIELD_OFFSET(struct ot_gpos_singlepos_format1, value[value_len]));
coverage_index = opentype_layout_is_glyph_covered(table, subtable_offset + coverage, glyph); @@ -3840,9 +3836,9 @@ static BOOL opentype_layout_apply_gpos_single_adjustment(struct scriptshaping_co } else if (format == 2) { - WORD value_count = table_read_be_word(&cache->gpos.table, subtable_offset + + WORD value_count = table_read_be_word(table, subtable_offset + FIELD_OFFSET(struct ot_gpos_singlepos_format2, value_count)); - const struct ot_gpos_singlepos_format2 *format2 = table_read_ensure(&cache->gpos.table, subtable_offset, + const struct ot_gpos_singlepos_format2 *format2 = table_read_ensure(table, subtable_offset, FIELD_OFFSET(struct ot_gpos_singlepos_format2, values) + value_count * value_len * sizeof(WORD));
coverage_index = opentype_layout_is_glyph_covered(table, subtable_offset + coverage, glyph); @@ -3873,8 +3869,7 @@ static int gpos_pair_adjustment_compare_format1(const void *g, const void *r) static BOOL opentype_layout_apply_gpos_pair_adjustment(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { - struct scriptshaping_cache *cache = context->cache; - const struct dwrite_fonttable *table = &cache->gpos.table; + const struct dwrite_fonttable *table = &context->table->table; unsigned int first_glyph, second_glyph; struct glyph_iterator iter_pair; WORD format, coverage; @@ -3910,8 +3905,8 @@ static BOOL opentype_layout_apply_gpos_pair_adjustment(struct scriptshaping_cont if (format == 1) { const struct ot_gpos_pairpos_format1 *format1; - WORD pairset_count = table_read_be_word(&cache->gpos.table, subtable_offset + - FIELD_OFFSET(struct ot_gpos_pairpos_format1, pairset_count)); + WORD pairset_count = table_read_be_word(table, subtable_offset + FIELD_OFFSET(struct ot_gpos_pairpos_format1, + pairset_count)); unsigned int pairvalue_len, pairset_offset; const struct ot_gpos_pairset *pairset; const WORD *pairvalue; @@ -3939,8 +3934,7 @@ static BOOL opentype_layout_apply_gpos_pair_adjustment(struct scriptshaping_cont value_len2 * sizeof(WORD);
pairset_offset = subtable_offset + GET_BE_WORD(format1->pairsets[coverage_index]); - pairset = table_read_ensure(&cache->gpos.table, subtable_offset + pairset_offset, - pairvalue_len * pairvalue_count); + pairset = table_read_ensure(table, subtable_offset + pairset_offset, pairvalue_len * pairvalue_count); if (!pairset) return FALSE;
@@ -4011,15 +4005,15 @@ static void opentype_layout_gpos_get_anchor(const struct scriptshaping_context * unsigned int glyph_index, float *x, float *y) { const struct scriptshaping_cache *cache = context->cache; + const struct dwrite_fonttable *table = &context->table->table;
- WORD format = table_read_be_word(&cache->gpos.table, anchor_offset); + WORD format = table_read_be_word(table, anchor_offset);
*x = *y = 0.0f;
if (format == 1) { - const struct ot_gpos_anchor_format1 *format1 = table_read_ensure(&cache->gpos.table, anchor_offset, - sizeof(*format1)); + const struct ot_gpos_anchor_format1 *format1 = table_read_ensure(table, anchor_offset, sizeof(*format1));
if (format1) { @@ -4029,8 +4023,7 @@ static void opentype_layout_gpos_get_anchor(const struct scriptshaping_context * } else if (format == 2) { - const struct ot_gpos_anchor_format2 *format2 = table_read_ensure(&cache->gpos.table, anchor_offset, - sizeof(*format2)); + const struct ot_gpos_anchor_format2 *format2 = table_read_ensure(table, anchor_offset, sizeof(*format2));
if (format2) { @@ -4043,8 +4036,7 @@ static void opentype_layout_gpos_get_anchor(const struct scriptshaping_context * } else if (format == 3) { - const struct ot_gpos_anchor_format3 *format3 = table_read_ensure(&cache->gpos.table, anchor_offset, - sizeof(*format3)); + const struct ot_gpos_anchor_format3 *format3 = table_read_ensure(table, anchor_offset, sizeof(*format3));
if (format3) { @@ -4067,10 +4059,11 @@ static void opentype_layout_gpos_get_anchor(const struct scriptshaping_context * static BOOL opentype_layout_apply_gpos_cursive_attachment(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { - struct scriptshaping_cache *cache = context->cache; - const struct dwrite_fonttable *table = &cache->gpos.table; - WORD format = table_read_be_word(&cache->gpos.table, subtable_offset); - UINT16 glyph = context->u.pos.glyphs[context->cur]; + const struct dwrite_fonttable *table = &context->table->table; + UINT16 format, glyph; + + format = table_read_be_word(table, subtable_offset); + glyph = context->u.pos.glyphs[context->cur];
if (format == 1) { @@ -4145,8 +4138,7 @@ static BOOL opentype_layout_apply_gpos_cursive_attachment(struct scriptshaping_c static BOOL opentype_layout_apply_gpos_mark_to_base_attachment(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { - struct scriptshaping_cache *cache = context->cache; - const struct dwrite_fonttable *table = &cache->gpos.table; + const struct dwrite_fonttable *table = &context->table->table; WORD format;
format = table_read_be_word(table, subtable_offset); @@ -4224,11 +4216,10 @@ static BOOL opentype_layout_apply_gpos_mark_to_base_attachment(struct scriptshap static BOOL opentype_layout_apply_gpos_mark_to_lig_attachment(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { - struct scriptshaping_cache *cache = context->cache; - const struct dwrite_fonttable *table = &cache->gpos.table; + const struct dwrite_fonttable *table = &context->table->table; WORD format;
- format = table_read_be_word(&cache->gpos.table, subtable_offset); + format = table_read_be_word(table, subtable_offset);
if (format == 1) { @@ -4264,8 +4255,7 @@ static BOOL opentype_layout_apply_gpos_mark_to_lig_attachment(struct scriptshapi static BOOL opentype_layout_apply_gpos_mark_to_mark_attachment(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { - struct scriptshaping_cache *cache = context->cache; - const struct dwrite_fonttable *table = &cache->gpos.table; + const struct dwrite_fonttable *table = &context->table->table; WORD format;
format = table_read_be_word(table, subtable_offset); @@ -4305,7 +4295,7 @@ static BOOL opentype_layout_apply_gpos_mark_to_mark_attachment(struct scriptshap return FALSE;
mark2_array_offset = subtable_offset + GET_BE_WORD(format1->mark2_array); - if (!(count = table_read_be_word(&cache->gpos.table, mark2_array_offset))) + if (!(count = table_read_be_word(table, mark2_array_offset))) return FALSE;
mark_class_count = GET_BE_WORD(format1->mark_class_count);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/opentype.c | 88 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 79 insertions(+), 9 deletions(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index d7099b8adf9..61dcf1aca48 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -4135,6 +4135,51 @@ static BOOL opentype_layout_apply_gpos_cursive_attachment(struct scriptshaping_c return TRUE; }
+static BOOL opentype_layout_apply_mark_array(struct scriptshaping_context *context, unsigned int subtable_offset, + unsigned int mark_array, unsigned int mark_index, unsigned int glyph_index, unsigned int anchors_matrix, + unsigned int class_count, unsigned int glyph_pos) +{ + const struct dwrite_fonttable *table = &context->table->table; + unsigned int mark_class, mark_count, glyph_count; + const struct ot_gpos_mark_record *record; + float mark_x, mark_y, base_x, base_y; + const UINT16 *anchors; + + mark_count = table_read_be_word(table, subtable_offset + mark_array); + if (mark_index >= mark_count) return FALSE; + + if (!(record = table_read_ensure(table, subtable_offset + mark_array + + FIELD_OFFSET(struct ot_gpos_mark_array, records[mark_index]), sizeof(*record)))) + { + return FALSE; + } + + mark_class = GET_BE_WORD(record->mark_class); + if (mark_class >= class_count) return FALSE; + + glyph_count = table_read_be_word(table, subtable_offset + anchors_matrix); + if (glyph_index >= glyph_count) return FALSE; + + /* Anchors data is stored as two dimensional array [glyph_count][class_count], starting with row count field. */ + anchors = table_read_ensure(table, subtable_offset + anchors_matrix + 2, glyph_count * class_count * sizeof(*anchors)); + if (!anchors) return FALSE; + + opentype_layout_gpos_get_anchor(context, subtable_offset + mark_array + GET_BE_WORD(record->mark_anchor), + context->cur, &mark_x, &mark_y); + opentype_layout_gpos_get_anchor(context, subtable_offset + anchors_matrix + + GET_BE_WORD(anchors[glyph_index * class_count + mark_class]), glyph_pos, &base_x, &base_y); + + if (context->is_rtl) + context->offsets[context->cur].advanceOffset = mark_x - base_x; + else + context->offsets[context->cur].advanceOffset = -context->advances[glyph_pos] + base_x - mark_x; + + context->offsets[context->cur].ascenderOffset = base_y - mark_y; + context->cur++; + + return TRUE; +} + static BOOL opentype_layout_apply_gpos_mark_to_base_attachment(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { @@ -4213,6 +4258,18 @@ static BOOL opentype_layout_apply_gpos_mark_to_base_attachment(struct scriptshap return TRUE; }
+static BOOL table_read_array_be_word(const struct dwrite_fonttable *table, unsigned int offset, + unsigned int index, UINT16 *data) +{ + unsigned int count = table_read_be_word(table, offset); + const UINT16 *array; + + if (index >= count) return FALSE; + if (!(array = table_read_ensure(table, offset + 2, count * sizeof(*array)))) return FALSE; + *data = GET_BE_WORD(array[index]); + return TRUE; +} + static BOOL opentype_layout_apply_gpos_mark_to_lig_attachment(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { @@ -4223,17 +4280,17 @@ static BOOL opentype_layout_apply_gpos_mark_to_lig_attachment(struct scriptshapi
if (format == 1) { - const struct ot_gpos_mark_to_lig_format1 *format1 = table_read_ensure(table, subtable_offset, sizeof(*format1)); - unsigned int mark_index, lig_index; + unsigned int mark_index, lig_index, comp_index, class_count, comp_count; + const struct ot_gpos_mark_to_lig_format1 *format1; struct glyph_iterator lig_iter; + unsigned int lig_array; + UINT16 lig_attach;
- if (!format1) - return FALSE; + if (!(format1 = table_read_ensure(table, subtable_offset, sizeof(*format1)))) return FALSE;
mark_index = opentype_layout_is_glyph_covered(table, subtable_offset + GET_BE_WORD(format1->mark_coverage), context->u.pos.glyphs[context->cur]); - if (mark_index == GLYPH_NOT_COVERED) - return FALSE; + if (mark_index == GLYPH_NOT_COVERED) return FALSE;
glyph_iterator_init(context, LOOKUP_FLAG_IGNORE_MARKS, context->cur, 1, &lig_iter); if (!glyph_iterator_prev(&lig_iter)) @@ -4241,10 +4298,23 @@ static BOOL opentype_layout_apply_gpos_mark_to_lig_attachment(struct scriptshapi
lig_index = opentype_layout_is_glyph_covered(table, subtable_offset + GET_BE_WORD(format1->lig_coverage), context->u.pos.glyphs[lig_iter.pos]); - if (lig_index == GLYPH_NOT_COVERED) - return FALSE; + if (lig_index == GLYPH_NOT_COVERED) return FALSE; + + class_count = GET_BE_WORD(format1->mark_class_count); + + lig_array = GET_BE_WORD(format1->lig_array); + + if (!table_read_array_be_word(table, subtable_offset + lig_array, lig_index, &lig_attach)) return FALSE; + + comp_count = table_read_be_word(table, subtable_offset + lig_array + lig_attach); + if (!comp_count) return FALSE; + + comp_index = context->u.buffer.glyph_props[lig_iter.pos].components - + context->u.buffer.glyph_props[context->cur].lig_component - 1; + if (comp_index >= comp_count) return FALSE;
- FIXME("Unimplemented.\n"); + return opentype_layout_apply_mark_array(context, subtable_offset, GET_BE_WORD(format1->mark_array), mark_index, + comp_index, lig_array + lig_attach, class_count, lig_iter.pos); } else WARN("Unknown mark-to-ligature format %u.\n", format);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/opentype.c | 49 ++++++------------------------------------ 1 file changed, 6 insertions(+), 43 deletions(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 61dcf1aca48..bc87df5913f 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -4190,42 +4190,15 @@ static BOOL opentype_layout_apply_gpos_mark_to_base_attachment(struct scriptshap
if (format == 1) { - const struct ot_gpos_mark_to_base_format1 *format1 = table_read_ensure(table, subtable_offset, sizeof(*format1)); - unsigned int mark_class_count, count, mark_array_offset, base_array_offset; - const struct ot_gpos_mark_array *mark_array; - const struct ot_gpos_base_array *base_array; - float mark_x, mark_y, base_x, base_y; + const struct ot_gpos_mark_to_base_format1 *format1; unsigned int base_index, mark_index; struct glyph_iterator base_iter; - unsigned int base_anchor;
- if (!format1) - return FALSE; - - mark_array_offset = subtable_offset + GET_BE_WORD(format1->mark_array); - if (!(count = table_read_be_word(table, mark_array_offset))) - return FALSE; - - mark_array = table_read_ensure(table, mark_array_offset, FIELD_OFFSET(struct ot_gpos_mark_array, records[count])); - if (!mark_array) - return FALSE; - - base_array_offset = subtable_offset + GET_BE_WORD(format1->base_array); - if (!(count = table_read_be_word(table, base_array_offset))) - return FALSE; - - base_array = table_read_ensure(table, base_array_offset, - FIELD_OFFSET(struct ot_gpos_base_array, offsets[count * GET_BE_WORD(format1->mark_class_count)])); - if (!base_array) - return FALSE; - - mark_class_count = GET_BE_WORD(format1->mark_class_count); + if (!(format1 = table_read_ensure(table, subtable_offset, sizeof(*format1)))) return FALSE;
mark_index = opentype_layout_is_glyph_covered(table, subtable_offset + GET_BE_WORD(format1->mark_coverage), context->u.pos.glyphs[context->cur]); - - if (mark_index == GLYPH_NOT_COVERED || mark_index >= GET_BE_WORD(mark_array->count)) - return FALSE; + if (mark_index == GLYPH_NOT_COVERED) return FALSE;
/* Look back for first base glyph. */ glyph_iterator_init(context, LOOKUP_FLAG_IGNORE_MARKS, context->cur, 1, &base_iter); @@ -4234,20 +4207,10 @@ static BOOL opentype_layout_apply_gpos_mark_to_base_attachment(struct scriptshap
base_index = opentype_layout_is_glyph_covered(table, subtable_offset + GET_BE_WORD(format1->base_coverage), context->u.pos.glyphs[base_iter.pos]); - if (base_index == GLYPH_NOT_COVERED || base_index >= GET_BE_WORD(base_array->count)) - return FALSE; + if (base_index == GLYPH_NOT_COVERED) return FALSE;
- base_anchor = GET_BE_WORD(base_array->offsets[base_index * mark_class_count + - GET_BE_WORD(mark_array->records[mark_index].mark_class)]); - - opentype_layout_gpos_get_anchor(context, mark_array_offset + - GET_BE_WORD(mark_array->records[mark_index].mark_anchor), context->cur, &mark_x, &mark_y); - opentype_layout_gpos_get_anchor(context, base_array_offset + base_anchor, base_iter.pos, &base_x, &base_y); - - context->offsets[context->cur].advanceOffset = (context->is_rtl ? -1.0f : 1.0f) * (base_x - mark_x); - context->offsets[context->cur].ascenderOffset = base_y - mark_y; - - context->cur++; + return opentype_layout_apply_mark_array(context, subtable_offset, GET_BE_WORD(format1->mark_array), mark_index, + base_index, GET_BE_WORD(format1->base_array), GET_BE_WORD(format1->mark_class_count), base_iter.pos); } else {
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/opentype.c | 51 ++++++------------------------------------ 1 file changed, 7 insertions(+), 44 deletions(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index bc87df5913f..05ef7d76cdf 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -4295,30 +4295,15 @@ static BOOL opentype_layout_apply_gpos_mark_to_mark_attachment(struct scriptshap
if (format == 1) { - const struct ot_gpos_mark_to_mark_format1 *format1 = table_read_ensure(table, subtable_offset, sizeof(*format1)); - unsigned int count, mark1_array_offset, mark2_array_offset, mark_class_count; - unsigned int mark1_index, mark2_index, mark2_anchor; - const struct ot_gpos_mark_array *mark1_array; - const struct ot_gpos_base_array *mark2_array; - float mark1_x, mark1_y, mark2_x, mark2_y; + const struct ot_gpos_mark_to_mark_format1 *format1; + unsigned int mark1_index, mark2_index; struct glyph_iterator mark_iter;
- if (!format1) - return FALSE; + if (!(format1 = table_read_ensure(table, subtable_offset, sizeof(*format1)))) return FALSE;
mark1_index = opentype_layout_is_glyph_covered(table, subtable_offset + GET_BE_WORD(format1->mark1_coverage), context->u.pos.glyphs[context->cur]); - - mark1_array_offset = subtable_offset + GET_BE_WORD(format1->mark1_array); - if (!(count = table_read_be_word(table, mark1_array_offset))) - return FALSE; - - mark1_array = table_read_ensure(table, mark1_array_offset, FIELD_OFFSET(struct ot_gpos_mark_array, records[count])); - if (!mark1_array) - return FALSE; - - if (mark1_index == GLYPH_NOT_COVERED || mark1_index >= count) - return FALSE; + if (mark1_index == GLYPH_NOT_COVERED) return FALSE;
glyph_iterator_init(context, lookup->flags & ~LOOKUP_FLAG_IGNORE_MASK, context->cur, 1, &mark_iter); if (!glyph_iterator_prev(&mark_iter)) @@ -4327,34 +4312,12 @@ static BOOL opentype_layout_apply_gpos_mark_to_mark_attachment(struct scriptshap if (!context->u.pos.glyph_props[mark_iter.pos].isDiacritic) return FALSE;
- mark2_array_offset = subtable_offset + GET_BE_WORD(format1->mark2_array); - if (!(count = table_read_be_word(table, mark2_array_offset))) - return FALSE; - - mark_class_count = GET_BE_WORD(format1->mark_class_count); - - mark2_array = table_read_ensure(table, mark2_array_offset, - FIELD_OFFSET(struct ot_gpos_base_array, offsets[count * mark_class_count])); - if (!mark2_array) - return FALSE; - mark2_index = opentype_layout_is_glyph_covered(table, subtable_offset + GET_BE_WORD(format1->mark2_coverage), context->u.pos.glyphs[mark_iter.pos]); + if (mark2_index == GLYPH_NOT_COVERED) return FALSE;
- if (mark2_index == GLYPH_NOT_COVERED || mark2_index >= count) - return FALSE; - - mark2_anchor = GET_BE_WORD(mark2_array->offsets[mark2_index * mark_class_count + - GET_BE_WORD(mark1_array->records[mark1_index].mark_class)]); - opentype_layout_gpos_get_anchor(context, mark1_array_offset + - GET_BE_WORD(mark1_array->records[mark1_index].mark_anchor), context->cur, &mark1_x, &mark1_y); - opentype_layout_gpos_get_anchor(context, mark2_array_offset + mark2_anchor, mark_iter.pos, - &mark2_x, &mark2_y); - - context->offsets[context->cur].advanceOffset = mark2_x - mark1_x; - context->offsets[context->cur].ascenderOffset = mark2_y - mark1_y; - - context->cur++; + return opentype_layout_apply_mark_array(context, subtable_offset, GET_BE_WORD(format1->mark1_array), mark1_index, + mark2_index, GET_BE_WORD(format1->mark2_array), GET_BE_WORD(format1->mark_class_count), mark_iter.pos); } else {