diff --git a/src/hb-ot-face-table-list.hh b/src/hb-ot-face-table-list.hh index 4067f218b..6f030d46b 100644 --- a/src/hb-ot-face-table-list.hh +++ b/src/hb-ot-face-table-list.hh @@ -53,6 +53,9 @@ /* OpenType fundamentals. */ HB_OT_CORE_TABLE (OT, head) HB_OT_CORE_TABLE (OT, maxp) +#ifndef HB_NO_BEYOND_64K +HB_OT_CORE_TABLE (OT, MAXP) +#endif #if !defined(HB_NO_FACE_COLLECT_UNICODES) || !defined(HB_NO_OT_FONT) HB_OT_ACCELERATOR (OT, cmap) #endif diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh index 8f000526b..628dc337f 100644 --- a/src/hb-ot-maxp-table.hh +++ b/src/hb-ot-maxp-table.hh @@ -28,6 +28,7 @@ #define HB_OT_MAXP_TABLE_HH #include "hb-open-type.hh" +#include "OT/Layout/types.hh" namespace OT { @@ -38,6 +39,7 @@ namespace OT { */ #define HB_OT_TAG_maxp HB_TAG('m','a','x','p') +#define HB_OT_TAG_MAXP HB_TAG('M','A','X','P') struct maxpV1Tail { @@ -69,10 +71,9 @@ struct maxpV1Tail }; -struct maxp +template +struct maxpMAXP { - static constexpr hb_tag_t tableTag = HB_OT_TAG_maxp; - unsigned int get_num_glyphs () const { return numGlyphs; } void set_num_glyphs (unsigned int count) @@ -97,10 +98,11 @@ struct maxp bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - maxp *maxp_prime = c->serializer->embed (this); + maxpMAXP *maxp_prime = c->serializer->embed (this); if (unlikely (!maxp_prime)) return_trace (false); - maxp_prime->numGlyphs = hb_min (c->plan->num_output_glyphs (), 0xFFFFu); + maxp_prime->numGlyphs = hb_min (c->plan->num_output_glyphs (), + (1u << (8 * Types::size)) - 1); if (maxp_prime->version.major == 1) { hb_barrier (); @@ -142,11 +144,22 @@ struct maxp protected: FixedVersion<>version;/* Version of the maxp table (0.5 or 1.0), * 0x00005000u or 0x00010000u. */ - HBUINT16 numGlyphs; + typename Types::HBUINT + numGlyphs; /* The number of glyphs in the font. */ /*maxpV1Tail v1Tail[HB_VAR_ARRAY]; */ public: - DEFINE_SIZE_STATIC (6); + DEFINE_SIZE_STATIC (4 + Types::HBUINT::static_size); +}; + +struct maxp : maxpMAXP +{ + static constexpr hb_tag_t tableTag = HB_OT_TAG_maxp; +}; + +struct MAXP : maxpMAXP +{ + static constexpr hb_tag_t tableTag = HB_OT_TAG_MAXP; }; diff --git a/src/hb-static.cc b/src/hb-static.cc index 9867d3407..c38a4487d 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -72,6 +72,10 @@ const unsigned char *endchar_str = static_endchar_str; static inline unsigned load_num_glyphs_from_maxp (const hb_face_t *face) { +#ifndef HB_NO_BEYOND_64K + if (face->table.MAXP) + return face->table.MAXP->get_num_glyphs (); +#endif return face->table.maxp->get_num_glyphs (); } diff --git a/src/hb-subset-table-other.cc b/src/hb-subset-table-other.cc index 3b7ff4b32..995a41834 100644 --- a/src/hb-subset-table-other.cc +++ b/src/hb-subset-table-other.cc @@ -22,6 +22,9 @@ bool _hb_subset_table_other (hb_subset_plan_t *plan, hb_vector_t &buf, hb case HB_TAG('v','h','e','a'): *success = true; return true; /* skip vhea, handled by vmtx */ case HB_TAG('v','m','t','x'): *success = _hb_subset_table (plan, buf); return true; case HB_TAG('m','a','x','p'): *success = _hb_subset_table (plan, buf); return true; +#ifndef HB_NO_BEYOND_64K + case HB_TAG('M','A','X','P'): *success = _hb_subset_table (plan, buf); return true; +#endif case HB_TAG('l','o','c','a'): *success = true; return true; /* skip loca, handled by glyf */ case HB_TAG('c','m','a','p'): *success = _hb_subset_table (plan, buf); return true; case HB_TAG('O','S','/','2'): *success = _hb_subset_table (plan, buf); return true;