X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fhb-ot-map.hh;h=8af8129ceba70e11dabfd2882f2b4ed7403bf931;hb=f0a0bdf96095ae4b3524be4ee4bc32ebe2dfd564;hp=5f2afae281b5c1fa352a91a9b832b7a6bbf285f9;hpb=8b9bac85deb2ace750acafa5e0da676f633aadeb;p=platform%2Fupstream%2Fharfbuzz.git diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 5f2afae..8af8129 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -56,9 +56,17 @@ struct hb_ot_map_t unsigned int auto_zwnj : 1; unsigned int auto_zwj : 1; unsigned int random : 1; + unsigned int per_syllable : 1; int cmp (const hb_tag_t tag_) const { return tag_ < tag ? -1 : tag_ > tag ? 1 : 0; } + + HB_INTERNAL static int cmp (const void *pa, const void *pb) + { + const feature_map_t *a = (const feature_map_t *) pa; + const feature_map_t *b = (const feature_map_t *) pb; + return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; + } }; struct lookup_map_t { @@ -66,7 +74,9 @@ struct hb_ot_map_t unsigned short auto_zwnj : 1; unsigned short auto_zwj : 1; unsigned short random : 1; + unsigned short per_syllable : 1; hb_mask_t mask; + hb_tag_t feature_tag; HB_INTERNAL static int cmp (const void *pa, const void *pb) { @@ -76,7 +86,9 @@ struct hb_ot_map_t } }; - typedef void (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); + /* Pause functions return true if new glyph indices might have been + * added to the buffer. This is used to update buffer digest. */ + typedef bool (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); struct stage_map_t { unsigned int last_lookup; /* Cumulative */ @@ -85,13 +97,13 @@ struct hb_ot_map_t void init () { - memset (this, 0, sizeof (*this)); + hb_memset (this, 0, sizeof (*this)); - features.init (); + features.init0 (); for (unsigned int table_index = 0; table_index < 2; table_index++) { - lookups[table_index].init (); - stages[table_index].init (); + lookups[table_index].init0 (); + stages[table_index].init0 (); } } void fini () @@ -137,19 +149,15 @@ struct hb_ot_map_t return map ? map->stage[table_index] : UINT_MAX; } - void get_stage_lookups (unsigned int table_index, unsigned int stage, - const struct lookup_map_t **plookups, unsigned int *lookup_count) const + hb_array_t + get_stage_lookups (unsigned int table_index, unsigned int stage) const { if (unlikely (stage > stages[table_index].length)) - { - *plookups = nullptr; - *lookup_count = 0; - return; - } + return hb_array (nullptr, 0); + unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0; unsigned int end = stage < stages[table_index].length ? stages[table_index][stage].last_lookup : lookups[table_index].length; - *plookups = end == start ? nullptr : &lookups[table_index][start]; - *lookup_count = end - start; + return lookups[table_index].as_array ().sub_array (start, end - start); } HB_INTERNAL void collect_lookups (unsigned int table_index, hb_set_t *lookups) const; @@ -165,7 +173,7 @@ struct hb_ot_map_t private: - hb_mask_t global_mask; + hb_mask_t global_mask = 0; hb_sorted_vector_t features; hb_vector_t lookups[2]; /* GSUB/GPOS */ @@ -183,7 +191,8 @@ enum hb_ot_map_feature_flags_t F_GLOBAL_MANUAL_JOINERS= F_GLOBAL | F_MANUAL_JOINERS, F_GLOBAL_HAS_FALLBACK = F_GLOBAL | F_HAS_FALLBACK, F_GLOBAL_SEARCH = 0x0010u, /* If feature not found in LangSys, look for it in global feature list and pick one. */ - F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ + F_RANDOM = 0x0020u, /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ + F_PER_SYLLABLE = 0x0040u /* Contain lookup application to within syllable. */ }; HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t); @@ -201,7 +210,7 @@ struct hb_ot_map_builder_t public: HB_INTERNAL hb_ot_map_builder_t (hb_face_t *face_, - const hb_segment_properties_t *props_); + const hb_segment_properties_t &props_); HB_INTERNAL ~hb_ot_map_builder_t (); @@ -209,6 +218,8 @@ struct hb_ot_map_builder_t hb_ot_map_feature_flags_t flags=F_NONE, unsigned int value=1); + HB_INTERNAL bool has_feature (hb_tag_t tag); + void add_feature (const hb_ot_map_feature_t &feat) { add_feature (feat.tag, feat.flags); } @@ -237,7 +248,9 @@ struct hb_ot_map_builder_t hb_mask_t mask, bool auto_zwnj = true, bool auto_zwj = true, - bool random = false); + bool random = false, + bool per_syllable = false, + hb_tag_t feature_tag = HB_TAG(' ',' ',' ',' ')); struct feature_info_t { hb_tag_t tag; @@ -267,6 +280,7 @@ struct hb_ot_map_builder_t hb_face_t *face; hb_segment_properties_t props; + bool is_simple; hb_tag_t chosen_script[2]; bool found_script[2];