[HarfBuzz] harfbuzz-ng: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Dec 15 01:07:51 PST 2009


 src/main.cc |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit bdd0ff5290bae4db65c3fdf95c5728031f13ca84
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Dec 15 04:07:40 2009 -0500

    Make main.cc compile without glib

diff --git a/src/main.cc b/src/main.cc
index 31264a4..23d1e82 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -29,7 +29,9 @@
 #include "hb-ot-layout-gdef-private.hh"
 #include "hb-ot-layout-gsubgpos-private.hh"
 
+#ifdef HAVE_GLIB
 #include <glib.h>
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 
@@ -41,9 +43,21 @@ main (int argc, char **argv)
     exit (1);
   }
 
+  const char *font_data = NULL;
+  int len = 0;
+
+#ifdef HAVE_GLIB
   GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL);
-  const char *font_data = g_mapped_file_get_contents (mf);
-  int len = g_mapped_file_get_length (mf);
+  font_data = g_mapped_file_get_contents (mf);
+  len = g_mapped_file_get_length (mf);
+#else
+  FILE *f = fopen (argv[1], "rb");
+  fseek (f, 0, SEEK_END);
+  len = ftell (f);
+  fseek (f, 0, SEEK_SET);
+  font_data = (const char *) malloc (len);
+  len = fread ((char *) font_data, 1, len, f);
+#endif
 
   printf ("Opened font file %s: %d bytes long\n", argv[1], len);
 



More information about the HarfBuzz mailing list