/*
* Copyright (C) 2007,2008,2009 Red Hat, Inc.
*
- * This is part of HarfBuzz, an OpenType Layout engine library.
+ * This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
#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>
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);
- const OpenTypeFontFile &ot = OpenTypeFontFile::get_for_data (font_data);
+ const OpenTypeFontFile &ot = *CastP<OpenTypeFontFile> (font_data);
- switch (ot.tag) {
+ switch (ot.get_tag ()) {
case OpenTypeFontFile::TrueTypeTag:
printf ("OpenType font with TrueType outlines\n");
break;
case OpenTypeFontFile::TTCTag:
printf ("TrueType Collection of OpenType fonts\n");
break;
+ case OpenTypeFontFile::TrueTag:
+ printf ("Obsolete Apple TrueType font\n");
+ break;
+ case OpenTypeFontFile::Typ1Tag:
+ printf ("Obsolete Apple Type1 font in SFNT container\n");
+ break;
default:
printf ("Unknown font format\n");
break;
case GSUBGPOS::GPOSTag:
{
- const GSUBGPOS &g = GSUBGPOS::get_for_data (ot.get_table_data (table));
+ const GSUBGPOS &g = *CastP<GSUBGPOS> (font_data + table.offset);
int num_scripts = g.get_script_count ();
printf (" %d script(s) found in table\n", num_scripts);
case GDEF::Tag:
{
- const GDEF &gdef = GDEF::get_for_data (ot.get_table_data (table));
+ const GDEF &gdef = *CastP<GDEF> (font_data + table.offset);
printf (" Has %sglyph classes\n",
gdef.has_glyph_classes () ? "" : "no ");
gdef.has_attach_points () ? "" : "no ");
printf (" Has %slig carets\n",
gdef.has_lig_carets () ? "" : "no ");
+ printf (" Has %smark sets\n",
+ gdef.has_mark_sets () ? "" : "no ");
break;
}
}