[ft] Check stream->read instead of stream->base

The former is more robust.  See discussion on freetype-devel.
This commit is contained in:
Behdad Esfahbod 2010-03-01 22:33:45 -05:00
parent 917c227500
commit e48ed72230
1 changed files with 3 additions and 2 deletions

View File

@ -164,12 +164,13 @@ hb_ft_face_create (FT_Face ft_face,
{ {
hb_face_t *face; hb_face_t *face;
/* TODO: Handle NULL ft_face (in other places too */ /* TODO: Handle NULL ft_face (in other places too) */
if (ft_face->stream->base != NULL) { if (ft_face->stream->read == NULL) {
hb_blob_t *blob; hb_blob_t *blob;
blob = hb_blob_create ((const char *) ft_face->stream->base, blob = hb_blob_create ((const char *) ft_face->stream->base,
(unsigned int) ft_face->stream->size, (unsigned int) ft_face->stream->size,
/* TODO: Check FT_FACE_FLAG_EXTERNAL_STREAM? */
HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE, HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE,
destroy, ft_face); destroy, ft_face);
face = hb_face_create_for_data (blob, ft_face->face_index); face = hb_face_create_for_data (blob, ft_face->face_index);