FT_Stream_Close( FT_Stream stream ) { if ( stream && stream->close ) { stream->close( stream ); stream->close = NULL; } }
/* load a typeface from a URI */ FT_Error FT_New_Face_From_URI (FT_Library library, const gchar* uri, FT_Long face_index, FT_Face *aface) { FT_Open_Args args; FT_Stream stream; FT_Error error; stream = calloc (1, sizeof (*stream)); if (stream == NULL) return FT_Err_Out_Of_Memory; error = vfs_stream_open (stream, uri); if (error != FT_Err_Ok) { free (stream); return error; } args.flags = FT_OPEN_STREAM; args.stream = stream; error = FT_Open_Face (library, &args, face_index, aface); if (error != FT_Err_Ok) { if (stream->close != NULL) stream->close(stream); free (stream); return error; } /* so that freetype will free the stream */ (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; return error; }
FT_Stream_Close( FT_Stream stream ) { if ( stream && stream->close ) stream->close( stream ); }