Clarify cursive_chain (and change its sign)

This commit is contained in:
Behdad Esfahbod 2010-10-27 13:44:59 -04:00
parent d6c9eadb88
commit 9624de5b49
2 changed files with 14 additions and 13 deletions

View File

@ -869,12 +869,12 @@ struct CursivePosFormat1
if (c->lookup_flag & LookupFlag::RightToLeft) if (c->lookup_flag & LookupFlag::RightToLeft)
{ {
c->buffer->pos[i].cursive_chain = i - j; c->buffer->pos[i].cursive_chain = j - i;
c->buffer->pos[i].y_offset = entry_y - exit_y; c->buffer->pos[i].y_offset = entry_y - exit_y;
} }
else else
{ {
c->buffer->pos[j].cursive_chain = j - i; c->buffer->pos[j].cursive_chain = i - j;
c->buffer->pos[j].y_offset = exit_y - entry_y; c->buffer->pos[j].y_offset = exit_y - entry_y;
} }

View File

@ -611,23 +611,24 @@ hb_ot_layout_position_finish (hb_font_t *font HB_UNUSED,
/* TODO: Vertical */ /* TODO: Vertical */
/* Handle cursive connections */ /* Handle cursive connections */
/* First handle all left-to-right connections */ /* First handle all chain-back connections */
for (j = 0; j < len; j++) { for (j = 0; j < len; j++) {
if (pos[j].cursive_chain > 0)
{
pos[j].y_offset += pos[j - pos[j].cursive_chain].y_offset;
pos[j].cursive_chain = 0;
}
}
/* Then handle all right-to-left connections */
for (i = len; i > 0; i--) {
j = i - 1;
if (pos[j].cursive_chain < 0) if (pos[j].cursive_chain < 0)
{ {
pos[j].y_offset += pos[j - pos[j].cursive_chain].y_offset; pos[j].y_offset += pos[j + pos[j].cursive_chain].y_offset;
pos[j].cursive_chain = 0; pos[j].cursive_chain = 0;
} }
} }
/* Then handle all chain-forward connections */
for (i = len; i > 0; i--) {
j = i - 1;
if (pos[j].cursive_chain > 0)
{
pos[j].y_offset += pos[j + pos[j].cursive_chain].y_offset;
pos[j].cursive_chain = 0;
}
}
/* Handle attachments */ /* Handle attachments */
for (i = 0; i < len; i++) for (i = 0; i < len; i++)