[uniscribe] Ask Uniscribe to return shaping results in logical order
See discussion on the list in the thread "Arabic presentation forms and the uniscribe backend". Based on patch from Jonathan Kew.
This commit is contained in:
parent
1d05fdd09f
commit
3409fb1c76
@ -832,9 +832,8 @@ retry:
|
|||||||
unsigned int glyphs_offset = 0;
|
unsigned int glyphs_offset = 0;
|
||||||
unsigned int glyphs_len;
|
unsigned int glyphs_len;
|
||||||
bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
|
bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
|
||||||
for (unsigned int j = 0; j < item_count; j++)
|
for (unsigned int i = 0; i < item_count; i++)
|
||||||
{
|
{
|
||||||
unsigned int i = backward ? item_count - 1 - j : j;
|
|
||||||
unsigned int chars_offset = items[i].iCharPos;
|
unsigned int chars_offset = items[i].iCharPos;
|
||||||
unsigned int item_chars_len = items[i + 1].iCharPos - chars_offset;
|
unsigned int item_chars_len = items[i + 1].iCharPos - chars_offset;
|
||||||
|
|
||||||
@ -875,6 +874,10 @@ retry:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Asking for glyphs in logical order circumvents at least
|
||||||
|
* one bug in Uniscribe. */
|
||||||
|
items[i].a.fLogicalOrder = true;
|
||||||
|
|
||||||
retry_shape:
|
retry_shape:
|
||||||
hr = funcs->ScriptShapeOpenType (font_data->hdc,
|
hr = funcs->ScriptShapeOpenType (font_data->hdc,
|
||||||
&font_data->script_cache,
|
&font_data->script_cache,
|
||||||
@ -962,15 +965,9 @@ retry:
|
|||||||
uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
|
uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
|
||||||
*p = MIN (*p, buffer->info[i].cluster);
|
*p = MIN (*p, buffer->info[i].cluster);
|
||||||
}
|
}
|
||||||
if (!backward) {
|
|
||||||
for (unsigned int i = 1; i < glyphs_len; i++)
|
for (unsigned int i = 1; i < glyphs_len; i++)
|
||||||
if (vis_clusters[i] == -1)
|
if (vis_clusters[i] == -1)
|
||||||
vis_clusters[i] = vis_clusters[i - 1];
|
vis_clusters[i] = vis_clusters[i - 1];
|
||||||
} else {
|
|
||||||
for (int i = glyphs_len - 2; i >= 0; i--)
|
|
||||||
if (vis_clusters[i] == -1)
|
|
||||||
vis_clusters[i] = vis_clusters[i + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef utf16_index
|
#undef utf16_index
|
||||||
|
|
||||||
@ -1004,10 +1001,13 @@ retry:
|
|||||||
|
|
||||||
/* TODO vertical */
|
/* TODO vertical */
|
||||||
pos->x_advance = info->mask;
|
pos->x_advance = info->mask;
|
||||||
pos->x_offset = info->var1.u32;
|
pos->x_offset = backward ? -info->var1.u32 : info->var1.u32;
|
||||||
pos->y_offset = info->var2.u32;
|
pos->y_offset = info->var2.u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (backward)
|
||||||
|
hb_buffer_reverse (buffer);
|
||||||
|
|
||||||
/* Wow, done! */
|
/* Wow, done! */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user