summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-11 13:54:08 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-05-11 13:46:44 +0100
commitb23f3bd20450aae764f9f9362c560b00bf68636b (patch)
tree160203c19635c4caca52efa1db8db29c77272c22 /util
parentee446910aa1db0ca0b54791a2ef3bb24b277c9a4 (diff)
trace: Try wrapping FT_Open_Face()
We have to be careful to disambuigate an internal call by FreeType from the application.
Diffstat (limited to 'util')
-rw-r--r--util/cairo-trace/trace.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 5a0a44a8..4b1335de 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -4144,7 +4144,6 @@ FT_New_Memory_Face (FT_Library library, const FT_Byte *mem, FT_Long size, FT_Lon
* FT_Open_Face(). So far this has not caused any issues, but it will one
* day...
*/
-#if 0
FT_Error
FT_Open_Face (FT_Library library, const FT_Open_Args *args, FT_Long index, FT_Face *face)
{
@@ -4153,21 +4152,36 @@ FT_Open_Face (FT_Library library, const FT_Open_Args *args, FT_Long index, FT_Fa
_enter_trace ();
ret = DLCALL (FT_Open_Face, library, args, index, face);
- if (args->flags & FT_OPEN_MEMORY)
- fprintf (stderr, "FT_Open_Face (mem=%p, %ld, %ld) = %p\n",
- args->memory_base, args->memory_size,
- index, *face);
- else if (args->flags & FT_OPEN_STREAM)
- fprintf (stderr, "FT_Open_Face (stream, %ld) = %p\n",
- index, *face);
- else if (args->flags & FT_OPEN_PATHNAME)
- fprintf (stderr, "FT_Open_Face (path=%s, %ld) = %p\n",
- args->pathname, index, *face);
+ if (ret == 0) {
+ Object *obj = _get_object (NONE, *face);
+ if (obj == NULL) {
+ FtFaceData *data;
+
+ data = malloc (sizeof (FtFaceData));
+ data->index = index;
+ if (args->flags & FT_OPEN_MEMORY) {
+ data->size = args->memory_size;
+ data->data = malloc (args->memory_size);
+ memcpy (data->data, mem, size);
+ } else if (args->flags & FT_OPEN_STREAM) {
+ fprintf (stderr, "FT_Open_Face (stream, %ld) = %p\n",
+ index, *face);
+ abort ();
+ } else if (args->flags & FT_OPEN_PATHNAME) {
+ data->size = 0;
+ data->data = NULL;
+ _ft_read_file (data, pathname);
+ }
+
+ obj = _type_object_create (NONE, *face);
+ obj->data = data;
+ obj->destroy = _ft_face_data_destroy;
+ }
+ }
_exit_trace ();
return ret;
}
-#endif
FT_Error
FT_Done_Face (FT_Face face)