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.
This commit is contained in:
parent
8008bca83b
commit
e883f52732
|
@ -260,7 +260,8 @@ struct hb_buffer_t
|
||||||
{
|
{
|
||||||
if (have_output)
|
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;
|
if (unlikely (!make_room_for (1, 1))) return;
|
||||||
out_info[out_len] = info[idx];
|
out_info[out_len] = info[idx];
|
||||||
}
|
}
|
||||||
|
@ -269,6 +270,23 @@ struct hb_buffer_t
|
||||||
|
|
||||||
idx++;
|
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. */
|
/* Advance idx without copying to output. */
|
||||||
inline void skip_glyph (void)
|
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. */
|
end--; /* Leave one base for the marks to cluster with. */
|
||||||
|
|
||||||
/* From idx to end are simple clusters. */
|
/* 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)
|
while (buffer->idx < end && buffer->successful)
|
||||||
decompose_current_character (&c, might_short_circuit);
|
decompose_current_character (&c, might_short_circuit);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue