pull/1/head
Behdad Esfahbod 14 years ago
parent 4101ca7dbb
commit 3cc6e9dcb4
  1. 9
      src/test.cc

@ -57,6 +57,7 @@ main (int argc, char **argv)
unsigned int len; unsigned int len;
hb_destroy_func_t destroy; hb_destroy_func_t destroy;
void *user_data; void *user_data;
hb_memory_mode_t mm;
#ifdef HAVE_GLIB #ifdef HAVE_GLIB
GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL); GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL);
@ -64,6 +65,7 @@ main (int argc, char **argv)
len = g_mapped_file_get_length (mf); len = g_mapped_file_get_length (mf);
destroy = (hb_destroy_func_t) g_mapped_file_unref; destroy = (hb_destroy_func_t) g_mapped_file_unref;
user_data = (void *) mf; user_data = (void *) mf;
mm = HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE;
#else #else
FILE *f = fopen (argv[1], "rb"); FILE *f = fopen (argv[1], "rb");
fseek (f, 0, SEEK_END); fseek (f, 0, SEEK_END);
@ -75,13 +77,14 @@ main (int argc, char **argv)
destroy = free; destroy = free;
user_data = (void *) font_data; user_data = (void *) font_data;
fclose (f); fclose (f);
mm = HB_MEMORY_MODE_WRITABLE;
#endif #endif
blob = hb_blob_create (font_data, len, blob = hb_blob_create (font_data, len, mm, user_data, destroy);
HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE,
user_data, destroy);
} }
printf ("Opened font file %s: %u bytes long\n", argv[1], hb_blob_get_length (blob));
/* Create the face */ /* Create the face */
face = hb_face_create_for_data (blob, 0 /* first face */); face = hb_face_create_for_data (blob, 0 /* first face */);

Loading…
Cancel
Save