[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.
This commit is contained in:
Behdad Esfahbod 2014-08-10 17:40:24 -04:00
parent 087733dd66
commit b9993d8d6d
1 changed files with 5 additions and 1 deletions

View File

@ -735,7 +735,11 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
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);