提交 13528d0c 编写于 作者: B Behdad Esfahbod

Supposedly implement vertical support in GPOS

Not tested at all.
上级 9624de5b
......@@ -855,27 +855,40 @@ struct CursivePosFormat1
(this+this_record.exitAnchor).get_anchor (c->layout, c->buffer->info[i].codepoint, &exit_x, &exit_y);
(this+next_record.entryAnchor).get_anchor (c->layout, c->buffer->info[j].codepoint, &entry_x, &entry_y);
/* TODO vertical */
hb_direction_t direction = c->buffer->props.direction;
/* Align the exit anchor of the left glyph with the entry anchor of the right glyph. */
if (c->buffer->props.direction == HB_DIRECTION_RTL)
/* Align the exit anchor of the left/top glyph with the entry anchor of the right/bottom glyph
* by adjusting advance of the left/top glyph. */
if (HB_DIRECTION_IS_BACKWARD (direction))
{
c->buffer->pos[j].x_advance = c->buffer->pos[j].x_offset + entry_x - exit_x;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
c->buffer->pos[j].x_advance = c->buffer->pos[j].x_offset + entry_x - exit_x;
else
c->buffer->pos[j].y_advance = c->buffer->pos[j].y_offset + entry_y - exit_y;
}
else
{
c->buffer->pos[i].x_advance = c->buffer->pos[i].x_offset + exit_x - entry_x;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
c->buffer->pos[i].x_advance = c->buffer->pos[i].x_offset + exit_x - entry_x;
else
c->buffer->pos[i].y_advance = c->buffer->pos[i].y_offset + exit_y - entry_y;
}
if (c->lookup_flag & LookupFlag::RightToLeft)
{
c->buffer->pos[i].cursive_chain = j - i;
c->buffer->pos[i].y_offset = entry_y - exit_y;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
c->buffer->pos[i].y_offset = entry_y - exit_y;
else
c->buffer->pos[i].x_offset = entry_x - exit_x;
}
else
{
c->buffer->pos[j].cursive_chain = i - j;
c->buffer->pos[j].y_offset = exit_y - entry_y;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
c->buffer->pos[j].y_offset = exit_y - entry_y;
else
c->buffer->pos[j].x_offset = exit_x - entry_x;
}
c->buffer->i = j;
......
......@@ -607,25 +607,34 @@ hb_ot_layout_position_finish (hb_font_t *font HB_UNUSED,
unsigned int i, j;
unsigned int len = hb_buffer_get_length (buffer);
hb_internal_glyph_position_t *pos = (hb_internal_glyph_position_t *) hb_buffer_get_glyph_positions (buffer);
hb_direction_t direction = buffer->props.direction;
/* TODO: Vertical */
/* Handle cursive connections */
/* First handle all chain-back connections */
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;
/* Handle cursive connections:
* First handle all chain-back connections, then handle all chain-forward connections. */
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
{
for (j = 0; j < len; j++) {
if (pos[j].cursive_chain < 0)
pos[j].y_offset += pos[j + pos[j].cursive_chain].y_offset;
}
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;
}
}
/* 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;
else
{
for (j = 0; j < len; j++) {
if (pos[j].cursive_chain < 0)
pos[j].x_offset += pos[j + pos[j].cursive_chain].x_offset;
}
for (i = len; i > 0; i--) {
j = i - 1;
if (pos[j].cursive_chain > 0)
pos[j].x_offset += pos[j + pos[j].cursive_chain].x_offset;
}
}
......@@ -639,7 +648,7 @@ hb_ot_layout_position_finish (hb_font_t *font HB_UNUSED,
pos[i].x_offset += pos[back].x_offset;
pos[i].y_offset += pos[back].y_offset;
if (buffer->props.direction == HB_DIRECTION_RTL)
if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))
for (j = back + 1; j < i + 1; j++) {
pos[i].x_offset += pos[j].x_advance;
pos[i].y_offset += pos[j].y_advance;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册