Make main.cc compile without glib
This commit is contained in:
parent
8a7d168082
commit
bdd0ff5290
18
src/main.cc
18
src/main.cc
|
@ -29,7 +29,9 @@
|
||||||
#include "hb-ot-layout-gdef-private.hh"
|
#include "hb-ot-layout-gdef-private.hh"
|
||||||
#include "hb-ot-layout-gsubgpos-private.hh"
|
#include "hb-ot-layout-gsubgpos-private.hh"
|
||||||
|
|
||||||
|
#ifdef HAVE_GLIB
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -41,9 +43,21 @@ main (int argc, char **argv)
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *font_data = NULL;
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_GLIB
|
||||||
GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL);
|
GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL);
|
||||||
const char *font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
int len = g_mapped_file_get_length (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);
|
printf ("Opened font file %s: %d bytes long\n", argv[1], len);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue