#include "hb-aat-layout-kerx-table.hh"
#include "hb-aat-layout-morx-table.hh"
#include "hb-aat-layout-trak-table.hh"
-#include "hb-aat-ltag-table.hh" // Just so we compile it; unused otherwise.
+#include "hb-aat-ltag-table.hh"
/* Table data courtesy of Apple. Converted from mnemonics to integers
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(AAT::trak);
return *(hb_ot_face_data (face)->trak.get ());
}
+static inline const AAT::ltag&
+_get_ltag (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(AAT::ltag);
+ return *(hb_ot_face_data (face)->ltag.get ());
+}
void
AAT::hb_aat_apply_context_t c (plan, font, buffer);
trak.apply (&c);
}
+
+hb_language_t
+_hb_aat_language_get (hb_face_t *face,
+ unsigned int i)
+{
+ return _get_ltag (face).get_language (i);
+}
hb_font_t *font,
hb_buffer_t *buffer);
+HB_INTERNAL hb_language_t
+_hb_aat_language_get (hb_face_t *face,
+ unsigned int i);
+
+
#endif /* HB_AAT_LAYOUT_HH */
#ifndef HB_AAT_LTAG_TABLE_HH
#define HB_AAT_LTAG_TABLE_HH
-#include "hb-aat-layout-common.hh"
+#include "hb-open-type.hh"
/*
* ltag -- Language Tag
namespace AAT {
+using namespace OT;
+
struct FTStringRange
{
+ friend struct ltag;
+
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
{
static const hb_tag_t tableTag = HB_AAT_TAG_ltag;
+ inline hb_language_t get_language (unsigned int i) const
+ {
+ const FTStringRange &range = tagRanges[i];
+ return hb_language_from_string ((const char *) (this+range.tag).arrayZ,
+ range.length);
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
- return_trace (likely (c->check_struct (this) && tagRanges.sanitize (c, this)));
+ return_trace (likely (c->check_struct (this) &&
+ version >= 1 &&
+ tagRanges.sanitize (c, this)));
}
protected:
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) \
+ HB_OT_ACCELERATOR(OT, name) \
+ HB_OT_TABLE(AAT, ltag) \
/* OpenType color fonts. */ \
HB_OT_TABLE(OT, COLR) \
HB_OT_TABLE(OT, CPAL) \
#include "hb-open-type.hh"
#include "hb-ot-name-language.hh"
+#include "hb-aat-layout.hh"
namespace OT {
struct NameRecord
{
- inline hb_language_t language (void) const
+ inline hb_language_t language (hb_face_t *face) const
{
unsigned int p = platformID;
unsigned int l = languageID;
if (p == 1)
return _hb_ot_name_language_for_mac_code (l);
- //if (p == 0)
- /* TODO use 'ltag' table? */
+ if (p == 0)
+ return _hb_aat_language_get (face, l);
return HB_LANGUAGE_INVALID;
}
hb_ot_name_entry_t *entry = this->names.push ();
entry->name_id = all_names[i].nameID;
- entry->language = all_names[i].language ();
+ entry->language = all_names[i].language (face);
entry->entry_score = all_names[i].score ();
entry->entry_index = i;
}