Pre-allocate buffers when adding string
We do a conservative estimate of the number of characters, but still,
this limits the number of buffer reallocs to a small constant.
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 3be3f44..3f46d68 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -723,6 +723,7 @@
} \
if (item_length == -1) \
item_length = text_length - item_offset; \
+ buffer->ensure (buffer->len + item_length * sizeof (T) / 4); \
const T *next = (const T *) text + item_offset; \
const T *end = next + item_length; \
while (next < end) { \