From: Behdad Esfahbod Date: Thu, 20 May 2010 14:40:12 +0000 (+0100) Subject: Apply user features to ranges! X-Git-Tag: submit/master/20120920.151126~7^2~631 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6774463883978b00b4d8c719ed75edfc4537c77f;p=framework%2Fuifw%2Fharfbuzz.git Apply user features to ranges! --- diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 81892a2..509ce7d 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -116,12 +116,33 @@ setup_lookups (hb_face_t *face, add_feature (face, table_tag, feature_index, 1, lookups, num_lookups, room_lookups); } + /* Clear buffer masks. */ + unsigned int count = buffer->len; + for (unsigned int i = 0; i < count; i++) + buffer->info[i].mask = 1; + + unsigned int last_bit_used = 1; for (i = 0; i < num_features; i++) { + unsigned int bits_needed = _hb_bit_storage (features[i].value); + if (!bits_needed) + continue; + unsigned int mask = (1 << (last_bit_used + bits_needed)) - (1 << last_bit_used); + unsigned int value = features[i].value << last_bit_used; + last_bit_used += bits_needed; + if (hb_ot_layout_language_find_feature (face, table_tag, script_index, language_index, features[i].tag, &feature_index)) - add_feature (face, table_tag, feature_index, 1, lookups, num_lookups, room_lookups); + add_feature (face, table_tag, feature_index, mask, lookups, num_lookups, room_lookups); + + /* Turn mask on in the buffer, the über-slow way! */ + unsigned int count = buffer->len; + for (unsigned int i = 0; i < count; i++) { + unsigned int cluster = buffer->info[i].cluster; + if (features[i].start <= cluster && cluster < features[i].end) + buffer->info[i].mask |= value; + } } qsort (lookups, *num_lookups, sizeof (lookups[0]), cmp_lookups);