提交 e883f527 编写于 作者: B Behdad Esfahbod

Call get_nominal_glyphs() for runs of simple clusters at a time

Even without FT or OT font funcs implementing get_nominal_glyphs(), there's measurable
speedup.
上级 8008bca8
......@@ -260,7 +260,8 @@ struct hb_buffer_t
{
if (have_output)
{
if (unlikely (out_info != info || out_len != idx)) {
if (out_info != info || out_len != idx)
{
if (unlikely (!make_room_for (1, 1))) return;
out_info[out_len] = info[idx];
}
......@@ -269,6 +270,23 @@ struct hb_buffer_t
idx++;
}
/* Copies n glyphs at idx to output and advance idx.
* If there's no output, just advance idx. */
inline void
next_glyphs (unsigned int n)
{
if (have_output)
{
if (out_info != info || out_len != idx)
{
if (unlikely (!make_room_for (n, n))) return;
memmove (out_info + out_len, info + idx, n * sizeof (out_info[0]));
}
out_len += n;
}
idx += n;
}
/* Advance idx without copying to output. */
inline void skip_glyph (void)
{
......
......@@ -335,6 +335,15 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
end--; /* Leave one base for the marks to cluster with. */
/* From idx to end are simple clusters. */
if (might_short_circuit)
{
unsigned int done = font->get_nominal_glyphs (end - buffer->idx,
&buffer->cur().codepoint,
sizeof (buffer->info[0]),
&buffer->cur().glyph_index(),
sizeof (buffer->info[0]));
buffer->next_glyphs (done);
}
while (buffer->idx < end && buffer->successful)
decompose_current_character (&c, might_short_circuit);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册