From 26d69e059dc2fbf03ae28e52a08c1bd38f7ce2bf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 12 Jan 2023 12:46:44 -0700 Subject: [PATCH] [subset-input] Move constructor to .cc file --- src/hb-subset-input.cc | 160 +++++++++++++++++++++++++++++++++++++++++ src/hb-subset-input.hh | 158 +--------------------------------------- 2 files changed, 161 insertions(+), 157 deletions(-) diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 2f3f88f82..1c7b1eb5e 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -27,6 +27,166 @@ #include "hb-subset.hh" #include "hb-set.hh" #include "hb-utf.hh" + + +hb_subset_input_t::hb_subset_input_t () +{ + for (auto& set : sets_iter ()) + set = hb::shared_ptr (hb_set_create ()); + + if (in_error ()) + return; + + flags = HB_SUBSET_FLAGS_DEFAULT; + + hb_set_add_range (sets.name_ids, 0, 6); + hb_set_add (sets.name_languages, 0x0409); + + hb_tag_t default_drop_tables[] = { + // Layout disabled by default + HB_TAG ('m', 'o', 'r', 'x'), + HB_TAG ('m', 'o', 'r', 't'), + HB_TAG ('k', 'e', 'r', 'x'), + HB_TAG ('k', 'e', 'r', 'n'), + + // Copied from fontTools: + HB_TAG ('B', 'A', 'S', 'E'), + HB_TAG ('J', 'S', 'T', 'F'), + HB_TAG ('D', 'S', 'I', 'G'), + HB_TAG ('E', 'B', 'D', 'T'), + HB_TAG ('E', 'B', 'L', 'C'), + HB_TAG ('E', 'B', 'S', 'C'), + HB_TAG ('S', 'V', 'G', ' '), + HB_TAG ('P', 'C', 'L', 'T'), + HB_TAG ('L', 'T', 'S', 'H'), + // Graphite tables + HB_TAG ('F', 'e', 'a', 't'), + HB_TAG ('G', 'l', 'a', 't'), + HB_TAG ('G', 'l', 'o', 'c'), + HB_TAG ('S', 'i', 'l', 'f'), + HB_TAG ('S', 'i', 'l', 'l'), + }; + sets.drop_tables->add_array (default_drop_tables, ARRAY_LENGTH (default_drop_tables)); + + hb_tag_t default_no_subset_tables[] = { + HB_TAG ('a', 'v', 'a', 'r'), + HB_TAG ('g', 'a', 's', 'p'), + HB_TAG ('c', 'v', 't', ' '), + HB_TAG ('f', 'p', 'g', 'm'), + HB_TAG ('p', 'r', 'e', 'p'), + HB_TAG ('V', 'D', 'M', 'X'), + HB_TAG ('D', 'S', 'I', 'G'), + HB_TAG ('M', 'V', 'A', 'R'), + HB_TAG ('c', 'v', 'a', 'r'), + }; + sets.no_subset_tables->add_array (default_no_subset_tables, + ARRAY_LENGTH (default_no_subset_tables)); + + //copied from _layout_features_groups in fonttools + hb_tag_t default_layout_features[] = { + // default shaper + // common + HB_TAG ('r', 'v', 'r', 'n'), + HB_TAG ('c', 'c', 'm', 'p'), + HB_TAG ('l', 'i', 'g', 'a'), + HB_TAG ('l', 'o', 'c', 'l'), + HB_TAG ('m', 'a', 'r', 'k'), + HB_TAG ('m', 'k', 'm', 'k'), + HB_TAG ('r', 'l', 'i', 'g'), + + //fractions + HB_TAG ('f', 'r', 'a', 'c'), + HB_TAG ('n', 'u', 'm', 'r'), + HB_TAG ('d', 'n', 'o', 'm'), + + //horizontal + HB_TAG ('c', 'a', 'l', 't'), + HB_TAG ('c', 'l', 'i', 'g'), + HB_TAG ('c', 'u', 'r', 's'), + HB_TAG ('k', 'e', 'r', 'n'), + HB_TAG ('r', 'c', 'l', 't'), + + //vertical + HB_TAG ('v', 'a', 'l', 't'), + HB_TAG ('v', 'e', 'r', 't'), + HB_TAG ('v', 'k', 'r', 'n'), + HB_TAG ('v', 'p', 'a', 'l'), + HB_TAG ('v', 'r', 't', '2'), + + //ltr + HB_TAG ('l', 't', 'r', 'a'), + HB_TAG ('l', 't', 'r', 'm'), + + //rtl + HB_TAG ('r', 't', 'l', 'a'), + HB_TAG ('r', 't', 'l', 'm'), + + //random + HB_TAG ('r', 'a', 'n', 'd'), + + //justify + HB_TAG ('j', 'a', 'l', 't'), // HarfBuzz doesn't use; others might + + //private + HB_TAG ('H', 'a', 'r', 'f'), + HB_TAG ('H', 'A', 'R', 'F'), + HB_TAG ('B', 'u', 'z', 'z'), + HB_TAG ('B', 'U', 'Z', 'Z'), + + //shapers + + //arabic + HB_TAG ('i', 'n', 'i', 't'), + HB_TAG ('m', 'e', 'd', 'i'), + HB_TAG ('f', 'i', 'n', 'a'), + HB_TAG ('i', 's', 'o', 'l'), + HB_TAG ('m', 'e', 'd', '2'), + HB_TAG ('f', 'i', 'n', '2'), + HB_TAG ('f', 'i', 'n', '3'), + HB_TAG ('c', 's', 'w', 'h'), + HB_TAG ('m', 's', 'e', 't'), + HB_TAG ('s', 't', 'c', 'h'), + + //hangul + HB_TAG ('l', 'j', 'm', 'o'), + HB_TAG ('v', 'j', 'm', 'o'), + HB_TAG ('t', 'j', 'm', 'o'), + + //tibetan + HB_TAG ('a', 'b', 'v', 's'), + HB_TAG ('b', 'l', 'w', 's'), + HB_TAG ('a', 'b', 'v', 'm'), + HB_TAG ('b', 'l', 'w', 'm'), + + //indic + HB_TAG ('n', 'u', 'k', 't'), + HB_TAG ('a', 'k', 'h', 'n'), + HB_TAG ('r', 'p', 'h', 'f'), + HB_TAG ('r', 'k', 'r', 'f'), + HB_TAG ('p', 'r', 'e', 'f'), + HB_TAG ('b', 'l', 'w', 'f'), + HB_TAG ('h', 'a', 'l', 'f'), + HB_TAG ('a', 'b', 'v', 'f'), + HB_TAG ('p', 's', 't', 'f'), + HB_TAG ('c', 'f', 'a', 'r'), + HB_TAG ('v', 'a', 't', 'u'), + HB_TAG ('c', 'j', 'c', 't'), + HB_TAG ('i', 'n', 'i', 't'), + HB_TAG ('p', 'r', 'e', 's'), + HB_TAG ('a', 'b', 'v', 's'), + HB_TAG ('b', 'l', 'w', 's'), + HB_TAG ('p', 's', 't', 's'), + HB_TAG ('h', 'a', 'l', 'n'), + HB_TAG ('d', 'i', 's', 't'), + HB_TAG ('a', 'b', 'v', 'm'), + HB_TAG ('b', 'l', 'w', 'm'), + }; + + sets.layout_features->add_array (default_layout_features, ARRAY_LENGTH (default_layout_features)); + + sets.layout_scripts->invert (); // Default to all scripts. +} + /** * hb_subset_input_create_or_fail: * diff --git a/src/hb-subset-input.hh b/src/hb-subset-input.hh index 052b6c18b..d5d9a10e5 100644 --- a/src/hb-subset-input.hh +++ b/src/hb-subset-input.hh @@ -82,163 +82,7 @@ HB_MARK_AS_FLAG_T (hb_subset_flags_t); struct hb_subset_input_t { - hb_subset_input_t () - { - for (auto& set : sets_iter ()) - set = hb::shared_ptr (hb_set_create ()); - - if (in_error ()) - return; - - flags = HB_SUBSET_FLAGS_DEFAULT; - - hb_set_add_range (sets.name_ids, 0, 6); - hb_set_add (sets.name_languages, 0x0409); - - hb_tag_t default_drop_tables[] = { - // Layout disabled by default - HB_TAG ('m', 'o', 'r', 'x'), - HB_TAG ('m', 'o', 'r', 't'), - HB_TAG ('k', 'e', 'r', 'x'), - HB_TAG ('k', 'e', 'r', 'n'), - - // Copied from fontTools: - HB_TAG ('B', 'A', 'S', 'E'), - HB_TAG ('J', 'S', 'T', 'F'), - HB_TAG ('D', 'S', 'I', 'G'), - HB_TAG ('E', 'B', 'D', 'T'), - HB_TAG ('E', 'B', 'L', 'C'), - HB_TAG ('E', 'B', 'S', 'C'), - HB_TAG ('S', 'V', 'G', ' '), - HB_TAG ('P', 'C', 'L', 'T'), - HB_TAG ('L', 'T', 'S', 'H'), - // Graphite tables - HB_TAG ('F', 'e', 'a', 't'), - HB_TAG ('G', 'l', 'a', 't'), - HB_TAG ('G', 'l', 'o', 'c'), - HB_TAG ('S', 'i', 'l', 'f'), - HB_TAG ('S', 'i', 'l', 'l'), - }; - sets.drop_tables->add_array (default_drop_tables, ARRAY_LENGTH (default_drop_tables)); - - hb_tag_t default_no_subset_tables[] = { - HB_TAG ('a', 'v', 'a', 'r'), - HB_TAG ('g', 'a', 's', 'p'), - HB_TAG ('c', 'v', 't', ' '), - HB_TAG ('f', 'p', 'g', 'm'), - HB_TAG ('p', 'r', 'e', 'p'), - HB_TAG ('V', 'D', 'M', 'X'), - HB_TAG ('D', 'S', 'I', 'G'), - HB_TAG ('M', 'V', 'A', 'R'), - HB_TAG ('c', 'v', 'a', 'r'), - }; - sets.no_subset_tables->add_array (default_no_subset_tables, - ARRAY_LENGTH (default_no_subset_tables)); - - //copied from _layout_features_groups in fonttools - hb_tag_t default_layout_features[] = { - // default shaper - // common - HB_TAG ('r', 'v', 'r', 'n'), - HB_TAG ('c', 'c', 'm', 'p'), - HB_TAG ('l', 'i', 'g', 'a'), - HB_TAG ('l', 'o', 'c', 'l'), - HB_TAG ('m', 'a', 'r', 'k'), - HB_TAG ('m', 'k', 'm', 'k'), - HB_TAG ('r', 'l', 'i', 'g'), - - //fractions - HB_TAG ('f', 'r', 'a', 'c'), - HB_TAG ('n', 'u', 'm', 'r'), - HB_TAG ('d', 'n', 'o', 'm'), - - //horizontal - HB_TAG ('c', 'a', 'l', 't'), - HB_TAG ('c', 'l', 'i', 'g'), - HB_TAG ('c', 'u', 'r', 's'), - HB_TAG ('k', 'e', 'r', 'n'), - HB_TAG ('r', 'c', 'l', 't'), - - //vertical - HB_TAG ('v', 'a', 'l', 't'), - HB_TAG ('v', 'e', 'r', 't'), - HB_TAG ('v', 'k', 'r', 'n'), - HB_TAG ('v', 'p', 'a', 'l'), - HB_TAG ('v', 'r', 't', '2'), - - //ltr - HB_TAG ('l', 't', 'r', 'a'), - HB_TAG ('l', 't', 'r', 'm'), - - //rtl - HB_TAG ('r', 't', 'l', 'a'), - HB_TAG ('r', 't', 'l', 'm'), - - //random - HB_TAG ('r', 'a', 'n', 'd'), - - //justify - HB_TAG ('j', 'a', 'l', 't'), // HarfBuzz doesn't use; others might - - //private - HB_TAG ('H', 'a', 'r', 'f'), - HB_TAG ('H', 'A', 'R', 'F'), - HB_TAG ('B', 'u', 'z', 'z'), - HB_TAG ('B', 'U', 'Z', 'Z'), - - //shapers - - //arabic - HB_TAG ('i', 'n', 'i', 't'), - HB_TAG ('m', 'e', 'd', 'i'), - HB_TAG ('f', 'i', 'n', 'a'), - HB_TAG ('i', 's', 'o', 'l'), - HB_TAG ('m', 'e', 'd', '2'), - HB_TAG ('f', 'i', 'n', '2'), - HB_TAG ('f', 'i', 'n', '3'), - HB_TAG ('c', 's', 'w', 'h'), - HB_TAG ('m', 's', 'e', 't'), - HB_TAG ('s', 't', 'c', 'h'), - - //hangul - HB_TAG ('l', 'j', 'm', 'o'), - HB_TAG ('v', 'j', 'm', 'o'), - HB_TAG ('t', 'j', 'm', 'o'), - - //tibetan - HB_TAG ('a', 'b', 'v', 's'), - HB_TAG ('b', 'l', 'w', 's'), - HB_TAG ('a', 'b', 'v', 'm'), - HB_TAG ('b', 'l', 'w', 'm'), - - //indic - HB_TAG ('n', 'u', 'k', 't'), - HB_TAG ('a', 'k', 'h', 'n'), - HB_TAG ('r', 'p', 'h', 'f'), - HB_TAG ('r', 'k', 'r', 'f'), - HB_TAG ('p', 'r', 'e', 'f'), - HB_TAG ('b', 'l', 'w', 'f'), - HB_TAG ('h', 'a', 'l', 'f'), - HB_TAG ('a', 'b', 'v', 'f'), - HB_TAG ('p', 's', 't', 'f'), - HB_TAG ('c', 'f', 'a', 'r'), - HB_TAG ('v', 'a', 't', 'u'), - HB_TAG ('c', 'j', 'c', 't'), - HB_TAG ('i', 'n', 'i', 't'), - HB_TAG ('p', 'r', 'e', 's'), - HB_TAG ('a', 'b', 'v', 's'), - HB_TAG ('b', 'l', 'w', 's'), - HB_TAG ('p', 's', 't', 's'), - HB_TAG ('h', 'a', 'l', 'n'), - HB_TAG ('d', 'i', 's', 't'), - HB_TAG ('a', 'b', 'v', 'm'), - HB_TAG ('b', 'l', 'w', 'm'), - }; - - sets.layout_features->add_array (default_layout_features, ARRAY_LENGTH (default_layout_features)); - - sets.layout_scripts->invert (); // Default to all scripts. - } + HB_INTERNAL hb_subset_input_t (); ~hb_subset_input_t () {