#include "hb-ot-glyf-table.hh"
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-kern-table.hh"
+#include "hb-ot-name-table.hh"
#include "hb-ot-post-table.hh"
#include "hb-ot-color-cbdt-table.hh"
#include "hb-ot-layout-gdef-table.hh"
* This is as good as any place. */
#define HB_OT_TABLES \
/* OpenType shaping. */ \
+ HB_OT_ACCELERATOR(OT, GDEF) \
+ HB_OT_ACCELERATOR(OT, GSUB) \
+ HB_OT_ACCELERATOR(OT, GPOS) \
HB_OT_TABLE(OT, JSTF) \
HB_OT_TABLE(OT, BASE) \
/* AAT shaping. */ \
/* OpenType math. */ \
HB_OT_TABLE(OT, MATH) \
/* OpenType fundamentals. */ \
- HB_OT_ACCELERATOR(OT, GDEF) \
- HB_OT_ACCELERATOR(OT, GSUB) \
- HB_OT_ACCELERATOR(OT, GPOS) \
HB_OT_ACCELERATOR(OT, cmap) \
HB_OT_ACCELERATOR(OT, hmtx) \
HB_OT_ACCELERATOR(OT, vmtx) \
HB_OT_ACCELERATOR(OT, post) \
+ HB_OT_ACCELERATOR(OT, name) \
HB_OT_ACCELERATOR(OT, kern) \
HB_OT_ACCELERATOR(OT, glyf) \
HB_OT_TABLE(OT, VORG) \
return 0;
}
+ inline bool supported (void) const
+ {
+ return platformID == 0 ||
+ platformID == 3;
+ /* TODO Add Apple MacRoman (0:1). */
+ }
+
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
DEFINE_SIZE_STATIC (12);
};
+static int
+_hb_ot_name_entry_cmp (const void *pa, const void *pb)
+{
+ const hb_ot_name_entry_t *a = (const hb_ot_name_entry_t *) pa;
+ const hb_ot_name_entry_t *b = (const hb_ot_name_entry_t *) pb;
+ if (a->name_id != b->name_id)
+ return a->name_id < b->name_id ? -1 : +1;
+ if (a->index != b->index)
+ return a->index < b->index ? -1 : +1;
+ return 0;
+}
+
struct name
{
static const hb_tag_t tableTag = HB_OT_TAG_name;
sanitize_records (c));
}
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face)
+ {
+ this->blob = hb_sanitize_context_t().reference_table<name> (face);
+ const name *table = this->blob->as<name> ();
+ const hb_array_t<NameRecord> &all_names = hb_array_t<NameRecord> (table->nameRecordZ.arrayZ, table->count);
+
+ this->names.init ();
+
+ for (unsigned int i = 0; i < all_names.len; i++)
+ {
+ if (!all_names[i].supported ()) continue;
+
+ unsigned int name_id = all_names[i].nameID;
+ hb_language_t language = HB_LANGUAGE_INVALID; /* XXX */
+
+ hb_ot_name_entry_t entry = {name_id, i, language};
+
+ this->names.push (entry);
+ }
+
+ this->names.qsort (_hb_ot_name_entry_cmp);
+
+ /* Walk and pick best... */
+ }
+
+ inline void fini (void)
+ {
+ this->names.fini ();
+ hb_blob_destroy (this->blob);
+ }
+
+ private:
+ hb_blob_t *blob;
+ hb_vector_t<hb_ot_name_entry_t> names;
+
+ unsigned int names_count;
+ };
+
/* We only implement format 0 for now. */
HBUINT16 format; /* Format selector (=0/1). */
HBUINT16 count; /* Number of name records. */
DEFINE_SIZE_ARRAY (6, nameRecordZ);
};
+struct name_accelerator_t : name::accelerator_t {};
} /* namespace OT */