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.
diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 9126822..9628dda 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh
@@ -260,7 +260,8 @@ { 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 @@ 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) {