X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmain.cc;h=4bf809e6c3f974319fe67cb310debdc1f776a59d;hb=b65c06025d2b54a44f716e030d4b10072c65bea8;hp=ffd13b4aa83433ea8f38a9f48d4e6e123d2d5ff0;hpb=ce48f03946bef895912019046bdbe62bb1301d0b;p=profile%2Fivi%2Forg.tizen.video-player.git diff --git a/src/main.cc b/src/main.cc index ffd13b4..4bf809e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,7 +1,7 @@ /* - * Copyright (C) 2007,2008 Red Hat, Inc. + * Copyright © 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 @@ -25,13 +25,19 @@ */ #define HB_OT_LAYOUT_CC -#include "hb-ot-layout-open-private.h" -#include "hb-ot-layout-gdef-private.h" -#include "hb-ot-layout-gsub-private.h" +#include "hb-open-file-private.hh" +#include "hb-ot-layout-gdef-private.hh" +#include "hb-ot-layout-gsubgpos-private.hh" +#ifdef HAVE_GLIB +#include +#endif #include #include +HB_BEGIN_DECLS + + int main (int argc, char **argv) { @@ -40,15 +46,27 @@ 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); - const OpenTypeFontFile &ot = OpenTypeFontFile::get_for_data (font_data); + const OpenTypeFontFile &ot = *CastP (font_data); - switch (ot.get_tag()) { + switch (ot.get_tag ()) { case OpenTypeFontFile::TrueTypeTag: printf ("OpenType font with TrueType outlines\n"); break; @@ -58,6 +76,12 @@ main (int argc, char **argv) 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; @@ -73,16 +97,18 @@ main (int argc, char **argv) printf (" %d table(s) found in font\n", num_tables); for (int n_table = 0; n_table < num_tables; n_table++) { const OpenTypeTable &table = font.get_table (n_table); - printf (" Table %2d of %2d: %.4s (0x%08lx+0x%08lx)\n", n_table, num_tables, - (const char *)table.get_tag(), table.get_offset(), table.get_length()); + printf (" Table %2d of %2d: %.4s (0x%08x+0x%08x)\n", n_table, num_tables, + (const char *)table.tag, + (unsigned int) table.offset, + (unsigned int) table.length); - switch (table.get_tag ()) { + switch (table.tag) { case GSUBGPOS::GSUBTag: case GSUBGPOS::GPOSTag: { - const GSUBGPOS &g = GSUBGPOS::get_for_data (ot.get_table_data (table)); + const GSUBGPOS &g = *CastP (font_data + table.offset); int num_scripts = g.get_script_count (); printf (" %d script(s) found in table\n", num_scripts); @@ -103,13 +129,12 @@ main (int argc, char **argv) ? " Default Language System\n" : " Language System %2d of %2d: %.4s\n", n_langsys, num_langsys, (const char *)script.get_lang_sys_tag (n_langsys)); - if (langsys.get_required_feature_index () == NO_INDEX) + if (langsys.get_required_feature_index () == Index::NOT_FOUND_INDEX) printf (" No required feature\n"); int num_features = langsys.get_feature_count (); printf (" %d feature(s) found in language system\n", num_features); for (int n_feature = 0; n_feature < num_features; n_feature++) { - unsigned int feature_index = langsys.get_feature_index (n_feature); printf (" Feature index %2d of %2d: %d\n", n_feature, num_features, langsys.get_feature_index (n_feature)); } @@ -127,7 +152,6 @@ main (int argc, char **argv) int num_lookups = feature.get_lookup_count (); printf (" %d lookup(s) found in feature\n", num_lookups); for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) { - unsigned int lookup_index = feature.get_lookup_index (n_lookup); printf (" Lookup index %2d of %2d: %d\n", n_lookup, num_lookups, feature.get_lookup_index (n_lookup)); } @@ -137,8 +161,8 @@ main (int argc, char **argv) printf (" %d lookup(s) found in table\n", num_lookups); for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) { const Lookup &lookup = g.get_lookup (n_lookup); - printf (" Lookup %2d of %2d: type %d, flags 0x%04X\n", n_lookup, num_lookups, - lookup.get_type(), lookup.get_flag()); + printf (" Lookup %2d of %2d: type %d, props 0x%04X\n", n_lookup, num_lookups, + lookup.get_type(), lookup.get_props()); } } @@ -147,28 +171,26 @@ main (int argc, char **argv) case GDEF::Tag: { - const GDEF &gdef = GDEF::get_for_data (ot.get_table_data (table)); + const GDEF &gdef = *CastP (font_data + table.offset); printf (" Has %sglyph classes\n", gdef.has_glyph_classes () ? "" : "no "); printf (" Has %smark attachment types\n", gdef.has_mark_attachment_types () ? "" : "no "); - printf (" Has %sattach list\n", - gdef.has_attach_list () ? "" : "no "); - printf (" Has %slig caret list\n", - gdef.has_lig_caret_list () ? "" : "no "); - - for (int glyph = 0; glyph < 1; glyph++) - printf (" glyph %d has class %d and mark attachment type %d\n", - glyph, - gdef.get_glyph_class (glyph), - gdef.get_mark_attachment_type (glyph)); - - } + printf (" Has %sattach points\n", + 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; + } } } } return 0; } + + +HB_END_DECLS