Move code around
This commit is contained in:
parent
bf94b3ad22
commit
1e7c1fcbc3
|
@ -1472,6 +1472,8 @@ struct GPOS : GSUBGPOS
|
||||||
hb_mask_t mask) const
|
hb_mask_t mask) const
|
||||||
{ return get_lookup (lookup_index).apply_string (layout, buffer, mask); }
|
{ return get_lookup (lookup_index).apply_string (layout, buffer, mask); }
|
||||||
|
|
||||||
|
static inline void position_finish (hb_buffer_t *buffer);
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (unlikely (!GSUBGPOS::sanitize (c))) return false;
|
if (unlikely (!GSUBGPOS::sanitize (c))) return false;
|
||||||
|
@ -1482,6 +1484,63 @@ struct GPOS : GSUBGPOS
|
||||||
DEFINE_SIZE_STATIC (10);
|
DEFINE_SIZE_STATIC (10);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
GPOS::position_finish (hb_buffer_t *buffer)
|
||||||
|
{
|
||||||
|
unsigned int i, j;
|
||||||
|
unsigned int len = hb_buffer_get_length (buffer);
|
||||||
|
hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer);
|
||||||
|
hb_direction_t direction = buffer->props.direction;
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Handle attachments */
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
if (pos[i].back())
|
||||||
|
{
|
||||||
|
unsigned int back = i - pos[i].back();
|
||||||
|
pos[i].x_offset += pos[back].x_offset;
|
||||||
|
pos[i].y_offset += pos[back].y_offset;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
for (j = back; j < i; j++) {
|
||||||
|
pos[i].x_offset -= pos[j].x_advance;
|
||||||
|
pos[i].y_offset -= pos[j].y_advance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Out-of-class implementation for methods recursing */
|
/* Out-of-class implementation for methods recursing */
|
||||||
|
|
||||||
|
|
|
@ -447,64 +447,9 @@ hb_ot_layout_position_lookup (hb_font_t *font,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_ot_layout_position_finish (hb_font_t *font HB_UNUSED,
|
hb_ot_layout_position_finish (hb_buffer_t *buffer)
|
||||||
hb_face_t *face HB_UNUSED,
|
|
||||||
hb_buffer_t *buffer)
|
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
GPOS::position_finish (buffer);
|
||||||
unsigned int len = hb_buffer_get_length (buffer);
|
|
||||||
hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer);
|
|
||||||
hb_direction_t direction = buffer->props.direction;
|
|
||||||
|
|
||||||
/* TODO: Vertical */
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Handle attachments */
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
if (pos[i].back())
|
|
||||||
{
|
|
||||||
unsigned int back = i - pos[i].back();
|
|
||||||
pos[i].x_offset += pos[back].x_offset;
|
|
||||||
pos[i].y_offset += pos[back].y_offset;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
for (j = back; j < i; j++) {
|
|
||||||
pos[i].x_offset -= pos[j].x_advance;
|
|
||||||
pos[i].y_offset -= pos[j].y_advance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -188,9 +188,7 @@ hb_ot_layout_position_lookup (hb_font_t *font,
|
||||||
|
|
||||||
/* Should be called after all the position_lookup's are done */
|
/* Should be called after all the position_lookup's are done */
|
||||||
void
|
void
|
||||||
hb_ot_layout_position_finish (hb_font_t *font,
|
hb_ot_layout_position_finish (hb_buffer_t *buffer);
|
||||||
hb_face_t *face,
|
|
||||||
hb_buffer_t *buffer);
|
|
||||||
|
|
||||||
|
|
||||||
HB_END_DECLS
|
HB_END_DECLS
|
||||||
|
|
|
@ -121,7 +121,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
|
||||||
|
|
||||||
c->plan->map.position (c->font, c->face, c->buffer);
|
c->plan->map.position (c->font, c->face, c->buffer);
|
||||||
|
|
||||||
hb_ot_layout_position_finish (c->font, c->face, c->buffer);
|
hb_ot_layout_position_finish (c->buffer);
|
||||||
|
|
||||||
c->applied_position_complex = TRUE;
|
c->applied_position_complex = TRUE;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue