[coretext] Fix assert on Yosemite
Apparently those functions documented as sometimes returning NULL
actually exercise that right in OS X 10.10 Yosemite. The scratch
was too small for that. I *think* I fixed it, but haven't tested
as I don't have Yosemite.
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index df3f33f..72cba8c 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -735,7 +735,11 @@
if (num_glyphs == 0)
continue;
- buffer->ensure (buffer->len + num_glyphs);
+ /* Needed buffer size in case we end up using scratch buffer. */
+ unsigned int alt_size = (sizeof (CGGlyph) + sizeof (CGPoint) + sizeof (CFIndex)) / sizeof (hb_glyph_info_t) + 2;
+ buffer->ensure (MAX (buffer->len + num_glyphs, alt_size));
+ if (buffer->in_error)
+ FAIL ("Buffer resize failed");
scratch = buffer->get_scratch_buffer (&scratch_size);