From 3caa32d737e7c2b4fe6ccd10950760998524f573 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 19 Jun 2019 19:50:54 -0700 Subject: [PATCH] [config] Add HB_NO_CMAP_LEGACY_SUBTABLES Part of https://vimeo.com/331852453/06eec89c65 --- src/hb-config.hh | 1 + src/hb-ot-cmap-table.hh | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/hb-config.hh b/src/hb-config.hh index 5fac4f4..d7ecf7d 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -106,6 +106,7 @@ #endif #ifdef HB_NO_LEGACY +#define HB_NO_CMAP_LEGACY_SUBTABLES #define HB_NO_FALLBACK_SHAPE #define HB_NO_OT_KERN #define HB_NO_OT_LAYOUT_BLACKLIST diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 724da6e..ac75bd9 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -756,10 +756,12 @@ struct CmapSubtable hb_codepoint_t *glyph) const { switch (u.format) { +#ifndef HB_NO_CMAP_LEGACY_SUBTABLES case 0: return u.format0 .get_glyph (codepoint, glyph); - case 4: return u.format4 .get_glyph (codepoint, glyph); case 6: return u.format6 .get_glyph (codepoint, glyph); case 10: return u.format10.get_glyph (codepoint, glyph); +#endif + case 4: return u.format4 .get_glyph (codepoint, glyph); case 12: return u.format12.get_glyph (codepoint, glyph); case 13: return u.format13.get_glyph (codepoint, glyph); case 14: @@ -769,10 +771,12 @@ struct CmapSubtable void collect_unicodes (hb_set_t *out) const { switch (u.format) { +#ifndef HB_NO_CMAP_LEGACY_SUBTABLES case 0: u.format0 .collect_unicodes (out); return; - case 4: u.format4 .collect_unicodes (out); return; case 6: u.format6 .collect_unicodes (out); return; case 10: u.format10.collect_unicodes (out); return; +#endif + case 4: u.format4 .collect_unicodes (out); return; case 12: u.format12.collect_unicodes (out); return; case 13: u.format13.collect_unicodes (out); return; case 14: @@ -785,10 +789,12 @@ struct CmapSubtable TRACE_SANITIZE (this); if (!u.format.sanitize (c)) return_trace (false); switch (u.format) { +#ifndef HB_NO_CMAP_LEGACY_SUBTABLES case 0: return_trace (u.format0 .sanitize (c)); - case 4: return_trace (u.format4 .sanitize (c)); case 6: return_trace (u.format6 .sanitize (c)); case 10: return_trace (u.format10.sanitize (c)); +#endif + case 4: return_trace (u.format4 .sanitize (c)); case 12: return_trace (u.format12.sanitize (c)); case 13: return_trace (u.format13.sanitize (c)); case 14: return_trace (u.format14.sanitize (c)); @@ -799,10 +805,12 @@ struct CmapSubtable public: union { HBUINT16 format; /* Format identifier */ +#ifndef HB_NO_CMAP_LEGACY_SUBTABLES CmapSubtableFormat0 format0; - CmapSubtableFormat4 format4; CmapSubtableFormat6 format6; CmapSubtableFormat10 format10; +#endif + CmapSubtableFormat4 format4; CmapSubtableFormat12 format12; CmapSubtableFormat13 format13; CmapSubtableFormat14 format14; -- 2.7.4